Random-effects variance-covariance matrix in lmer?
Thanks, Philipp. I was a aware of the pdDiag and the pdCorSym solution, and so I specifically asked for pdCompSym and pdIdent ... As for your compound symmetry suggestion, it is not quite clear to me. Up to now, I would have named "(1|Worker:Machine)" a random interaction term, specifying a distinct level for each worker*machine combination (and that's what is given by ranef(m_cs). How does this relate to the covariance in the compound symmetry, where also a multiple of identity is fit to diagonal? I have also tried to sort out the pdIdent equivalent, using similar coding as you suggest below, but was not successful so far. Do you know a similar solution? Thanks again, Matthias -----Urspr?ngliche Nachricht----- Von: Phillip Alday <phillip.alday at mpi.nl> Gesendet: Mittwoch, 2. Oktober 2019 16:30 An: Suter Matthias Agroscope <matthias.suter at agroscope.admin.ch>; r-sig-mixed-models at r-project.org Betreff: Re: [R-sig-ME] Random-effects variance-covariance matrix in lmer? This is a frequent question for lme4 and MixedModels.jl and the answer is.... it's not going to be supported in any mainstream release of either package in the foreseeable future. You can however still get some of these structures by clever specification of the random effects. For example: data(Machines,package="nlme") library(lme4) m <- lmer(score ~ 1 + Machine + (0+Machine|Worker), Machines) # with compound symmetry m_cs <- lmer(score ~ 1 + Machine + (1|Worker) + (1|Worker:Machine), Machines) # pdDiag -- for continuous variables, you could just use the || syntax m_diag <- lmer(score ~ 1 + Machine + (0+dummy(Machine,"A")|Worker) + (0+dummy(Machine,"B")|Worker) + (0+dummy(Machine,"C")|Worker), Machines) I'll leave pdIdent as an exercise for the OP. ;) Best, Phillip
On 02/10/2019 15:50, matthias.suter at agroscope.admin.ch wrote:
Hi all I'm looking for a way to specify a more complex variance-covariance matrix for the random effects in lmer(). For example, in lme() (nlme package), there are the pdMat classes to specify e.g. a compound symmetry (pdCompSym) or a multiple of an identity (pdIdent) structure for the variance-covariance matrix of random effects. Is there a possibility to code an equivalent for lmer()? I'm specifically interested in "compound symmetry" and "multiple of an identity". I assume that Douglas Bates or Ben Bolker have a distinct answer on that. Thanks in advance, Matthias --------------------------------------------------------- Matthias Suter, Dr.sc.nat. Forage Production and Grassland Systems Agroscope Reckenholzstrasse 191, CH-8046 Z rich Phone +41 58 468 75 90 Fax +41 58 468 72 01 matthias.suter at agroscope.admin.ch www.agroscope.ch --------------------------------------------------------- [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models