Hi Everyone, I would like to run a mixed effects model in lmer using data from a salinity tolerance experiment. The experiment had 4 salinity treatments, and 3 replicates of 48 plant genotypes were planted in each treatment. This resulted in a total of 144 individuals per treatment, amounting to a grand total of 576 individuals in the whole experiment. I tried to run the following model in R: lmer_model <- lmer(Y~Treatment+(Treatment|Genotype),data=dataframe) In the formula above, Y refers to the response variable (in this case leaf length). Treatment refers to the 4 salinity treatments and Genotype refers to the 48 genotypes represented in the experiment. However, this model failed to converge. At first I was worried that I do not have enough degrees of freedom available. However, when I calculated degrees of freedom it seemed like this must not be the problem: Treatment (fixed effect) degrees of freedom: 4 - 1 = 3 Random effects degrees of freedom: According to Dr. Bolker's FAQ ( https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#can-i-use-aic-for-mixed-models-how-do-i-count-the-number-of-degrees-of-freedom-for-a-random-effect ) "each random term in the model with q components counts for q(q+1)/2 parameters ? for example, a term of the form (slope|group) has 3 parameters (intercept variance, slope variance, correlation between intercept and slope)". Per the statement above, I multiplied 3 X 48 Genotypes = 144 df This amounts to 3 + 144 = 147 degrees of freedom taken up by the explanatory variables Since I had 576 individuals in the experiment, I should have 429 error degrees of freedom left to play with (576 - 147). Please let me know if I am mistaken in how I calculated the degrees of freedom, because I find it very confusing to try to calculate degrees of freedom of the random effects. Any assistance in figuring out why the model failed to converge would also be great! Best, Carrie
Model failed to converge
2 messages · Carrie Perkins, Ben Bolker
I don't think the degrees of freedom per se is the problem. At the genotype level, you are trying to estimate (4*5)/2=10 parameters from 48 genotypes, which seems ambitious although not impossible (a general rule of thumb is that you want (at least) about 10x as many observations as parameters at any given level). However, this is more of an issue for singularity (see `?lme4::isSingular`) that for convergence warnings (`?lme4::convergence`, `?lme4::troubleshooting`, `?lme4::allFit`). Simplifying the model to Y~Treatment+(1|Genotype/Treatment) (i.e., assuming compound symmetry among treatments) might be worth a try. Ben Bolker
On 2019-09-12 2:54 p.m., Carrie Perkins wrote:
Hi Everyone, I would like to run a mixed effects model in lmer using data from a salinity tolerance experiment. The experiment had 4 salinity treatments, and 3 replicates of 48 plant genotypes were planted in each treatment. This resulted in a total of 144 individuals per treatment, amounting to a grand total of 576 individuals in the whole experiment. I tried to run the following model in R: lmer_model <- lmer(Y~Treatment+(Treatment|Genotype),data=dataframe) In the formula above, Y refers to the response variable (in this case leaf length). Treatment refers to the 4 salinity treatments and Genotype refers to the 48 genotypes represented in the experiment. However, this model failed to converge. At first I was worried that I do not have enough degrees of freedom available. However, when I calculated degrees of freedom it seemed like this must not be the problem: Treatment (fixed effect) degrees of freedom: 4 - 1 = 3 Random effects degrees of freedom: According to Dr. Bolker's FAQ ( https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#can-i-use-aic-for-mixed-models-how-do-i-count-the-number-of-degrees-of-freedom-for-a-random-effect ) "each random term in the model with q components counts for q(q+1)/2 parameters ? for example, a term of the form (slope|group) has 3 parameters (intercept variance, slope variance, correlation between intercept and slope)". Per the statement above, I multiplied 3 X 48 Genotypes = 144 df This amounts to 3 + 144 = 147 degrees of freedom taken up by the explanatory variables Since I had 576 individuals in the experiment, I should have 429 error degrees of freedom left to play with (576 - 147). Please let me know if I am mistaken in how I calculated the degrees of freedom, because I find it very confusing to try to calculate degrees of freedom of the random effects. Any assistance in figuring out why the model failed to converge would also be great! Best, Carrie [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models