# [R-sig-ME] problems with the variance in lmer

Ben Bolker bbolker at gmail.com
Mon Nov 22 16:48:59 CET 2010

```On 11/22/2010 08:38 AM, catferr wrote:
> Dear all I am using lmer to analyze data on repeated measures of
> physiological and hormonal parameters. In two cases (on five
> parameters that I have) the variance of the random term is equal to
> zero ( 0.000), suggesting an error in the way I am modelling the
> data. I was wondering if there is any function to define different
> correlation structure with lmer (I did not find a lot about it) or
> if you have other cues that I could try . Thanks a lot in advance
> Caterina Ferrari UQAM
>
> Here the output of one of my model
>
> modid<-lmer(increase~I.II+sex+age+(1|ID), data=cort)
>> summary(modid)
> Linear mixed model fit by REML Formula: increase ~ I.II + sex + age
> + (1 | ID) Data: cort AIC   BIC logLik deviance REMLdev 249.1 258.9
> -118.6    243.2   237.1 Random effects: Groups   Name Variance
> Std.Dev. ID       (Intercept)  0.000   0.0000 Residual 39.419 6.2785
>  Number of obs: 38, groups: ID, 18
>
> Fixed effects: Estimate Std. Error t value (Intercept)  2.10456
> 3.59425   0.586 I.II         0.07807    0.12102   0.645 sexm -1.56851
> 2.29559  -0.683 agesubad     0.61569    2.26940   0.271
>
> Correlation of Fixed Effects: (Intr) I.II   sexm I.II     -0.838 sexm
> -0.167 -0.292 agesubad -0.315  0.128  0.025
>

The most common cause of this kind of problem is insufficient data.
Your data set is not as small as some I've seen, but it's pretty small
-- fitting 3 fixed effects to 38 data points (assuming each is either a
continuous covariate or a two-level factor, i.e. one parameter per
effect) is near the edge of what you can reliably manage (rule of thumb,
e.g. see Harrell's _Regression Modeling Strategies_ book, is 10-20 data
points per parameter).
In lmer you can turn off the correlation between random effects
parameters, but in your case you only have one RE parameter (variance
among intercepts of ID), so that won't help. Continuously varying
correlation (as in the correlation= argument in lme) is not available in
lmer, and unlikely to be available soon, but again I don't see how it
would apply in your case. (The specification above does not, for
example, allow for differential correlation among samples within
individuals -- the samples within individual are assumed exchangeable --
but I wouldn't feel too comfortable trying to fit a model of that
complexity anyway when you have an average of about two samples per
individual ...)
My general advice when you think you might be specifying the model
wrong is to simulate some data (esp. with larger sample sizes) and see
if you get the expected answer ...
Since this model can also be fitted in lme, I also might consider

library(nlme)
lme(increase~I.II+sex+age, random=~1|ID, data=cort)

and see whether you get similar answers.

```