Reputation: 1227
I am using nlme
to run the following models:
library(nlme)
fm4Oats <- lme( yield ~ nitro, data = Oats, random = ~ 1 | Block/Variety )
fm4Oats2 <- lme( yield ~ nitro, data = Oats, random = ~ nitro | Block/Variety )
fm4Oats3 <- lme( yield ~ nitro, data = Oats, random = ~ nitro | Block )
fm4Oats4 <- lme( yield ~ nitro, data = Oats, random = ~ nitro | Variety )
Except for fm4Oats
, all other 3 models returned the same error message:
nlminb problem, convergence error code = 1
message = iteration limit reached without convergence (10)
I followed the post to add the control
argument:
fm4Oats5 <- lme(yield ~ nitro, data = Oats, random = ~ nitro | Variety,
control = list(msMaxIter = 1000, msMaxEval = 1000))
This led to a different error message:
Error in lme.formula(yield ~ nitro, data = Oats, random = ~nitro | Variety, :
nlminb problem, convergence error code = 1
message = singular convergence (7)
I am interested in why did I run into a convergence issue and what are possible solutions.
Upvotes: 1
Views: 811
Reputation: 3238
I'm not entirely surprised by the output of the lmer
models. It appears that the amount of variance that can be estimated by these models is pretty small. Taking the third model, which was the first to have convergence issues on my end, I created this plot to see what was going on:
ggplot(Oats,
aes(x=nitro,
y=yield))+
geom_point()+
geom_smooth()+
facet_grid(Block~Variety)
You can see here that the slopes, data points, and variation between slopes are all pretty small. The other issue is the number of levels. Given you only have 3 levels of Variety
, its not likely to approximate a good model.
Upvotes: 1