[R-sig-ME] Convergence Problems with glmer.nb model
gaughra at tcd.ie
Mon Apr 25 14:08:49 CEST 2016
On 25 April 2016 at 13:00, Aoibheann Gaughran <gaughra at tcd.ie> wrote:
> Good morning,
> First time posting so I hope I am including all of the relevant
> I am attempting to analyse the foraging behaviour of a animal in an
> agricultural landscape. The objective is to identify the factors (habitat
> type, environmental variables and animal-specific variables) that best
> predict foraging site preference. Some fields are preferred while others
> are avoided.
> The response variable is count data - the number of times a given animal
> was in a given field in a given month. An animal's home range varies from
> month to month, so the area available to it and the fields that fall within
> its home range change somewhat every month. The count data shows an
> overdispersed, negative binomial distribution, and is zero inflated as
> fields that fell within the home range where the animal had *not *foraged
> in that month are also included in the dataset. The individual animal is
> specified as a random variable to account for pseudoreplication.
> It should be noted that at the moment I am attempting to run a the model
> on a subset of the data (n=671) as I had attempted to run the model on the
> full dataset (n=62,000) but three days later the model (which included
> interaction terms at this point) had still failed to run, and when stopped,
> R gave me a multitude of convergence warning messages e.g.
> 13: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf,
> ... :
> failure to converge in 10000 evaluations
> Simpler iterations of the model, with fewer explanatory terms, and no
> interaction terms, also gave me convergence and some scaling warnings,
> which I sought to address using:
> and by scaling the numeric variables age, slope and aspect as follows:-
> dframe1$agescale <- scale(dframe1$age, center = TRUE, scale = FALSE)
> dframe1$slopescale <- scale(dframe1$slope, center = TRUE, scale = FALSE)
> dframe1$aspectscale <- scale(dframe1$aspect, center = TRUE, scale = FALSE)
> Currently, the model looks like this:
> > model1 <- glmer.nb(field_count ~ habitat + + sex+ + agescale+ #+ mon+ + soil+ + slopescale+ + aspectscale+ + offset(log(origarea)) #take into account field size + +(1|animal),+ control=glmerControl(optCtrl=list(maxfun=20000)),+ data = dframe1)
> There were 24 warnings (use warnings() to see them)
> > warnings()Warning messages:
> 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, ... :
> Model is nearly unidentifiable: very large eigenvalue
> - Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
> - Rescale variables?
> 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, ... :
> Model failed to converge with max|grad| = 0.0134799 (tol = 0.001, component 1)
> 3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, ... :
> Model failed to converge with max|grad| = 0.148644 (tol = 0.001, component 1)
> 4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, ... :
> Model is nearly unidentifiable: large eigenvalue ratio
> - Rescale variables?
> So the model still fails to converge despite rescaling and altering the
> number of iterations. I had also received the following error in relation
> to month (in the reduced dataset there are only *four *months), so Ive
> had to exclude it for the time being. I am not sure why I am getting this
> error since the factor has four levels.
> Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
> contrasts can be applied only to factors with 2 or more levels
> I do eventually want to include interaction terms as previous analysis on
> ranging behaviour suggests there is an interaction between age and sex.
> Summary of dataset attached. Also attached is the .csv file containing
> the reduced dataset.
> I have read various suggestions online and have come across the following
> worrying line "It's perfectly possible that your data is insufficient to
> support the complexity of the model or the model is incorrectly constructed
> for the design of the study".
> I would greatly appreciate any help you could give me with understanding
> and solving the problems I am encountering with my model.
> Kind regards,
> Aoibheann Gaughran
> Behavioural and Evolutionary Ecology Research Group
> Zoology Building
> School of Natural Sciences
> Trinity College Dublin
> Dublin 2
> Phone: +353 (86) 3812615
Behavioural and Evolutionary Ecology Research Group
School of Natural Sciences
Trinity College Dublin
Phone: +353 (86) 3812615
More information about the R-sig-mixed-models