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: atyre2 at 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-bounces at r-project.org on behalf of lara.sfp.silva at 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]]