Skip to content

What is lmer spitting out when verbose = TRUE?

August 1, 2012

Here’s a pretty terse and technical post, mostly so I don’t forget stuff.

Each iteration of the lmer fitting algorithm is represented by a printed line, like this for example:


dl.lmer <- lmer(Ytrans ~ PC1 + (PC1 | snps), df, verbose = TRUE)
  0:     2129.0419: 0.577350 0.617213  0.00000
  1:     2067.3454:  1.54521 0.369388 -0.0426859
  2:     2057.7418:  1.41456 0.597009 -0.0729722
  3:     2050.2435:  1.21193 0.431843 -0.0347423
  4:     2048.7592:  1.17166 0.504773 -0.0678838
  5:     2048.6277:  1.09764 0.463493 -0.0386145
  6:     2048.4524:  1.10305 0.471873 -0.0502234
  7:     2048.3884:  1.11262 0.479344 -0.0595495
  8:     2048.3731:  1.12189 0.478527 -0.0554404
  9:     2048.3708:  1.12571 0.480838 -0.0579935
 10:     2048.3705:  1.12540 0.480109 -0.0573556
 11:     2048.3705:  1.12520 0.480096 -0.0574044
 12:     2048.3705:  1.12479 0.480048 -0.0574280
 13:     2048.3705:  1.12479 0.480042 -0.0574203
 14:     2048.3705:  1.12479 0.480042 -0.0574203

The first column indexes the iteration. The second gives the value of the -2 * summary(dl.lmer)@logLik. The remaining columns give the values of the variance component parameters. But what are these?

Well the short answer is that they are the elements of this slot in the resulting mer object,


dl.lmer@ST
[[1]]
            (Intercept)      PC1
(Intercept)  1.12478827 0.000000
PC1         -0.05742026 0.480042

Now this is a particularly simple model so dl.lmer@ST is a list of length one. Still not confident on when longer lists will appear here. But what this means is that if this list element is multiplied by the transpose of itself, the result is proportional to the covariance matrix of the random effects,


dl.lmer@ST[[1]]%*%t(dl.lmer@ST[[1]])
            (Intercept)         PC1
(Intercept)  1.26514865 -0.06458564
PC1         -0.06458564  0.23373744


where the constant of proportionality is the residual variance. So that the variance matrix of the random effects is,


(summary(dl.lmer)@sigma^2) * dl.lmer@ST[[1]]%*%t(dl.lmer@ST[[1]])
            (Intercept)         PC1
(Intercept)  0.62467488 -0.03188955
PC1         -0.03188955  0.11540929

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: