[R-sig-ME] Modeling variance heterogeneity in lme4 + meaning of VarCorr values

Emmanuel Curis emmanuel.curis at parisdescartes.fr
Mon Oct 20 17:15:51 CEST 2014

Dear Thierry,

Thanks for the answer, and the hints.

I created the dummy variables first to avoid correlations between
random effects (sorry I forgot to mention it) to limit the number of
parameters and because I don't really see what they would mean
practically, and second (and more importantly) to try after some more
refinate models like « is the variance at both ends higher that
variance all along other points » (as suggested by the shape of the
artery and the possible explanation of higher variances at both ends),
with only two different variances in the model. Obviously, it asks the
question of the meaning of correlations or not between random effects,
for which I have no clear idea, especially for such a model: any help
for interpreting (the origin of) such correlations would be very

For the lme variant: thanks for clarifying the syntax. I was wondering
what tools would be available to compare the random effects/models in
such a case, since I think LRT is not appropriate in these cases ---
that is why I tried first with lme4 to use after that PBmodcomp
(which, incidentaly, fails with a message about different size in data
frames, but I'm not sure yet that I correctly understood its
usage). But I will try your suggestion, to see if I obtain similar

Would the lme model with different variances in residuals be
equivalent to the model in lme4 without correlations between random
effects? Or does it induce a different variance-covariance structure
for the response?

Best regards,

On Mon, Oct 20, 2014 at 02:49:34PM +0000, ONKELINX, Thierry wrote:
« Dear Emmanuel,
« You don't need to create the dummy variables. Just convert Position to a new factor variable. It makes your code much more readable.
« d$fPosition <- factor(d$Position)
« lmer( Diametre ~ Lecteur + Position + ( 0 + fPosition|Lecture ), data = d, REML = FALSE )
« This allows for different variances of the random effect over Lecture, depending on the value of fPosition. This comes at the cost of estimating all covariances as well. So you need to estimate 36 parameters (8 variances and 28 covariances). That is a high number of parameters given the size of your dataset.
« A more efficient solution would be to use lme() from the nlme() package and allow for heterogeneity in the variance of the residuals.
« lme(Diametre ~ Lecteur + Position, random = ~1|Lecture, weights = varIdent(~ 1|fPosition), data = d, REML = FALSE)
« Best regards,
« Thierry

                                Emmanuel CURIS
                                emmanuel.curis at parisdescartes.fr

Page WWW: http://emmanuel.curis.online.fr/index.html

More information about the R-sig-mixed-models mailing list