[R-sig-ME] Convergence Warnings Using dredge with glmmTMB
Jason Gleditsch
jmg5214 @end|ng |rom gm@||@com
Thu Oct 3 18:54:19 CEST 2019
Hi,
I am trying to relate bird counts from point counts of a bird community to various
environmental variables. Then I want to estimate the abundance of each species at each
survey location in order to run community level analyses. To do all of this I am first
running a glmmTMB (family = Poisson) model with count as the response. For the zi part of the
model, I just have a random intercept varying with site. For the count part of the model
I have 'nuisance' variables that may influence detection (i.e. since_sr, wind, rain, month).
The random factors in the count part is site again and observer (obs). All of the explanatory
variables have been standardized (x-mean/sd) so that comparisons of the betas can be made
within and across species. The code for the model is:
# CODE #
m <- glmmTMB(count ~ wind + rain + since_sr + month + (1|obs) + (1|site),
data = tmp,
ziformula = ~ (1|site),
family = "poisson")
# END CODE #
I then am using the dredge function from the package MuMIn to run all combinations of the
fixed effects. I then select the top model (in essence selecting the variables that
influence detection the most) and use the update function to include the environmental
variables of interest (which I think is just adding them to the count part). The code for
this is:
# CODE #
dd <- dredge(m)
out <- get.models(dd, subset = 1)[[1]]
m.env <- update(out, . ~ . + X.1 + X.2 + X.3 + X.4 + X.5 + X.6 + X.6_2)
#Note X.6_2 is the standardized square of the unstandardized X.6 and they are correlated
# END CODE #
I use dredge again to average the top models that have 95% of the cumulative weight. The
code I use is:
# CODE #
vars <- names(out$frame)[2:(length(names(out$frame))-2)] #Get 'nuisance' variable names
vars <- paste("cond(", vars,")", sep="") #Make sure they match the glmmTMB format
d.env <- dredge(m.env, fixed= vars, subset=dc(cond(X.6), cond(X.6_2)))
top <- get.models(d.env, subset=cumsum(weight) <= .95)
avgm <- model.avg(top)
ci <- confint(avgm)
out.env <- data.frame(cbind(avgm$coefficients[1,]), ci)
# END CODE #
I am running this code for 16 species and everything works fine for 13 of them. However, 3 of
the species (Sp03, Sp13, Sp14) return the following warnings (many times):
"In nlminb(start = par, objective = fn, gradient = gr, ... :
NA/NaN function evaluation"
"In fitTMB(TMBStruc) :
Model convergence problem; non-positive-definite Hessian matrix. See vignette('troubleshooting')"
The frustrating thing is that these warnings only occur during the dredge function and subsequent
get.models and model.avg functions. Therefore, I am not sure what is causing these issues. It does
not seem like overparameterization is creating these issues since the global model runs just fine
for every species. However, for Sp03 and Sp13 it could most certainly be that I do not have enough
data for them (only seen in <10% of surveys). For Sp14 the data is very similar to other species
that the models run just fine for (i.e. Sp01, Sp03, Sp06, Sp07, Sp09, Sp16). In fact, some of those
species have less data than Sp14. I have already tried using nbinom2 as the family and I get the
same errors for Sp14. If you can provide any help with these warnings, I would really appreciate it.
I have to be careful about disseminating the data so if you need the data please contact me directly
Thanks,
Jason
(e-mail: jmg5214 [at] gmail.com)
Summary of standardized data:
site = factor of 7 levels
obs = factor of 14 levels
since_sr = numeric (min=-1.7712; med=-0.1685; mean=0; max=4.6646)
wind = numeric (min=-1.0024; med=-0.3418; mean=0; max=3.6218)
rain = numeric (min=-0.3569; med=-0.3569; mean=0; max=5.7002)
month = factor of 12 levels
X.1 = numeric (min=-1.2878; med=-0.2288; mean=0; max=3.3103)
X.2 = numeric (min=-2.4687; med=0.2644; mean=0; max=1.4032)
X.3 = numeric (min=-1.4766; med=-0.1016; mean=0; max=1.8235)
X.4 = numeric (min=-1.9055; med=-0.1650; mean=0; max=1.2247)
X.5 = numeric (min=-1.68630; med=0.07525; mean=0; max=1.30377)
X.6 = numeric (min=-1.35405; med=0.04783; mean=0; max=2.60061)
X.6_2 = numeric (min=-0.8385; med=-0.1876; mean=0; max=3.2626)
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list