I don't think the number of presences is the problem. "A term has fewer unique covariate combinations than specified maximum degrees of freedom" One of your covariates has a small number of unique values. lapply(your_data_frame, function(x)length(unique(x))) will print out the number of unique values in each variable. Values < 30 could be problematic -- the docs are a bit ambiguous on the default values of k, the maximum degrees of freedom for a smooth term. Another approach to diagnose the problem is to set k to a low value, like 5, and see if that makes the problem go away. I'm not familiar with biomod2, but I think doing something like MO <- BIOMOD_ModelingOptions(GAM = list(k = 5)) BIOMOD_Modeling( ..., models.options = MO, ...)
should do it. Note that setting k to a low value causes other problems, I would use mcgv::gam.check() to ensure k is large enough, but I don't know how to do that with biomod2. hth -- Drew Tyre School of Natural Resources University of Nebraska-Lincoln 416 Hardin Hall, East Campus 3310 Holdrege Street Lincoln, NE 68583-0974 phone: +1 402 472 4054 fax: +1 402 472 2946 email: aty...@unl.edu http://snr.unl.edu/tyre http://drewtyre.rbind.io The point is that our true nature is not some ideal that we have to live up to. It’s who we are right now, and that’s what we can make friends with and celebrate. Excerpted from: Awakening Loving-Kindness by Pema Chödrön On 3/18/19, 6:28 AM, "R-sig-ecology on behalf of Lara Silva" <r-sig-ecology-boun...@r-project.org on behalf of lara.sfp.si...@gmail.com> wrote: Hello I am trying to run several algorithms in biomod 2 (GLM, GAM, ANN, SRE) but I received the following menssage. Model=GAM GAM_mgcv algorithm chosen Automatic formula generation... > GAM (mgcv) modelling...Error in smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) : A term has fewer unique covariate combinations than specified maximum degrees of freedom Error in predict(model.bm, Data[, expl_var_names, drop = FALSE], on_0_1000 = TRUE) : object 'model.bm' not found *** inherits(g.pred,'try-error') ! Note : Lactuca.global_AllData_RUN1_GAM failed! I have 19 presences and 1019 pseudo-absences ... It is because the low number of presences? Thanks Lara [[alternative HTML version deleted]] _______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology&d=DwICAg&c=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo&r=aLEaSryyUcERVqcKVZl7lQ&m=2aNX9-kGSZ1EivodV2ZAVeJGY76pX4TqGpx2QXqsx00&s=-syyYDDESQAcvQx2Khl1KE_jbj3yBD2UqgKcFE4mBpw&e= _______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology