[R-sig-ME] specifying custom random-effects structures

Roger Levy rlevy at ling.ucsd.edu
Mon May 25 23:46:22 CEST 2009

Douglas Bates wrote:
> On Sun, May 24, 2009 at 5:46 PM, Roger Levy <rlevy at ling.ucsd.edu> wrote:
>> Dear all,
>> I want to understand the range of random-effects covariance structure
>> specifications that (a) can be handled by lme4, MCMCglmm, and related
>> packages; and (b) that are reasonable to posit in principle as
>> random-effects covariance structures.
>> If I understand correctly, lme4 handles random-effects structures that can
>> be expressed as the direct sum of k arbitrary covariance matrices -- that
>> is, something that looks like
>> M1  0   0   0
>> 0   M2  0   0
>> 0   0  ...  0
>> 0   0   0   Mk
>> where each Mi is a covariance matrix without any constraints placed on its
>> internal structure.
> I view the variance-covariance structures available in the lme4
> package as being related to random-effects terms in the model matrix.
> A random-effects term is of the form (LMexpr | GrpFac).  The
> expression on the right of the vertical bar is evaluated as a factor,
> which I call the grouping factor.  The expression on the left is
> evaluated as a linear model expression.  The number of columns in the
> model matrix corresponding to this expression is the number of random
> effects per level of the grouping factor.
> The basic rules for the unconditional variance-covariance of the
> random effects are:
>   random effects generated from different random-effects terms are independent
>   random effects corresponding to different levels of the grouping
> factor are independent
>   the vector of random effects for a given level of the grouping
> factor have a general positive semidefinite symmetric
> variance-covariance, which is common to all the levels of the grouping
> factor.
> In future versions of lme4 I plan to allow for extensions of the
> unconditional variance-covariance structures.  If you look at the
> development version in the branches/allcoef section of the SVN archive
> at R-forge you will see that there is a virtual class called the
> reCovFac (random-effects covariance factor) class.  If an actual class
> is defined to extend reCovFac and certain methods (getPars, setPars,
> getBounds, getLambda) are defined for the actual class then it can be
> used instead of the default ST class.

Hi Doug,

Many thanks for your detailed response to my question -- I just want to 
ask one clarificatory follow-up.  By "*unconditional* 
variance-covariance structure" you are meaning prior to conditioning on 
the data, is that correct?

Best & thanks again,


>> Is it possible to place constraints on the internal structure of each of
>> these covariance matrices?  For example, suppose Mi is the covariance matrix
>> for variables x1, x2, and x3. Is it possible to specify that Mi has the
>> structure
>> \sigma_11 \sigma_12    0
>> \sigma_12 \sigma_22 \sigma_23
>>  0      \sigma_23 \sigma_33
>> ?  Likewise, if Mj is the covariance matrix for variables x4 and x5, is it
>> possible to specify that Mj has the structure
>> \sigma_44    1
>>  1      \sigma_55
>> ?
> In its current implementation, no, the lme4 package does not allow
> general modeling of the unconditional variance-covariance structure of
> the random effects.  I doubt that it will, just because I find it
> difficult to understand the model in that way.  Generalizing the model
> is not just a matter of adding hooks - you also need to decide what
> can go wrong in the generalized structure.  I have said that the most
> valuable character trait for programmers is unbounded pessimism
> because you spend so much of your time trying to decide how things
> could fail to work.  In early designs of the nlme package when we
> created a pdMat subclass to represent positive definite matrices that
> were not matrices I knew we were in trouble.
> You can try to extend the reCovFac class but doing so in a consistent
> way is not always easy.
>> Additionally, regardless of technical feasibility, are these sensible
>> specifications in principle?  I can imagine a circumstance in which the
>> latter specification would make sense: when there is theoretical reason to
>> believe that the role of x4 and x5 in determining the response is mediated
>> through some inaccessible third variable that is a linear combination of x4
>> and x5, but the parameters of the linear combination are unknown.  I'm not
>> so sure about the former specification...but for some datasets I work with,
>> I have in fact seen inferred covariance structures close to this form.
>> Best
>> Roger
>> --
>> Roger Levy                      Email: rlevy at ling.ucsd.edu
>> Assistant Professor             Phone: 858-534-7219
>> Department of Linguistics       Fax:   858-534-4789
>> UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

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