# [R-sig-ME] Model failed to converge

Carrie Perkins cperk @end|ng |rom terpm@||@umd@edu
Thu Sep 12 20:54:18 CEST 2019

```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]]

```