[R-sig-ME] Covariance Matrix of fixed effects in lmer()

Ben Bolker bbolker at gmail.com
Thu Jul 19 19:52:52 CEST 2012


Matthias Suter <matthias.suter at ...> writes:

> 
> Is there a straight forward way, to get the scaled covariance matrix from a 
> lmer()? 
> 
> E.g.
> lmerout <- lmer(y ~ x1 + x2 + x3  + (1 | Groupingfactor), data)
> 
> summary(lmerout) gives the "Correlation of Fixed Effects"; I would like to 
> have direct access to the covariance matrix.
> 
> As analogy in lm():
> 
> lmout <- lm(y ~ x1 + x2 + x3, data)
> 
> Here, the scaled covariance matrix is:
> 
> summary(lmout)$sigma^2 * summary(lmout)$cov.uns
> 
> Thanks for any helpful answer,
> Matthias
> 
> 

  It sounds like you want vcov() ... ?  (vcov() works for
lm() results, and many other model types, too ...

  methods(class="mer")
  showMethods(class="mer") ## S4 methods

## or if using development lme4 from r-forge:
  methods(class="merMod")


e.g.

(fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
vcov(fm1)

2 x 2 Matrix of class "dpoMatrix"
            (Intercept)      Days
(Intercept)   46.574978 -1.451084
Days          -1.451084  2.389469

  cheers
   Ben Bolker



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