[R-sig-ME] How to constrain varcov of 2 random effects so that correlation between random terms is 1 and only one global variance is estimated?

Jarrod Hadfield j.hadfield at ed.ac.uk
Sat Feb 12 13:40:14 CET 2011

Hi Alexandre,

It sounds like you want to fit something called a multi-membership  
model.  Imagine a data set set out like:

y  A  B

1  a  b
0  a  c
2  c  b
0  b  a
3  a  d

you want the effect of a in A to equal the effect of a in B, such that  
the random effect model for the 1st and 4th row are identical. Is this  

If so the covariance matrix for the random effects should actually be  
[V,V,V,V] rather than [V,1,1,V].

I'm not sure if multi-membership models can be fitted in lmer but some  
earlier posts suggest not. In MCMCglmmm you can fit this model by  


Note that this only fits a single variance V.  A and B have to be  
factors with the same levels, although it is not necessary that all  
levels are represented in each factor. In the example above, d only  
appears in B, but the analysis will still work as long as d is a level  
in A. i.e. factor(A, levels=union(A,B)).

The initial set up may be slow because the design matrices are not  
treated as sparse, but once it is MCMCing in C++ it is working with  
sparse matrices and should be relatively speedy.



Quoting Alexandre Courtiol <alexandre.courtiol at gmail.com>:

> Dear all,
> I need to do a linear mixed model and I want to constrain the varcov matrix
> of random effects. Let's say I have 2 random effects A and B, I want the
> matrix to be [V,1,1,V], i.e. V=VA=VB, and 1=cor(A,B). Both random effects
> are factors with the same levels. Is there any easy way to do that in lme,
> lmer, mcmcglmm or something else? (I don't care so much about the package to
> use as long as I can do that).
> Thanks a lot.
> --
> Alexandre Courtiol
> http://sites.google.com/site/alexandrecourtiol/home
> 	[[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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