[R] lme fitted correlation of random effects: where is it?

Jacob Wegelin jawegelin at ucdavis.edu
Wed Aug 4 01:15:29 CEST 2004


The print method for lme *prints out* the fitted correlation matrix for
the random effects. Is there any way to get these values as an object in
R?  I have examined the components of the lme object (called "junk" in the
example below) and the components of summary(junk) without finding these
numbers.

(How I did this: I dumped the entire lme object to a text file and then
used egrep to search the text file for one of the long strings of digits
that are in the printout. The string was not in the file.  It appears that
the print method computes the fitted correlation matrix on the fly??
Or where does it get it?)

Below is the printout of the correlation matrix. One could print it to a
file and then use perl to get the numbers back, but that seems a bit
circuitous. What am I overlooking?

Of course, this correlation matrix is not the sample correlation matrix of
the random effects, as is confirmed below.

Thanks for any ideas.

Jake Wegelin

> junk
Linear mixed-effects model fit by REML
  Data: blockmat
  Log-restricted-likelihood: -426.3231
  Fixed: RESP ~ -1 + intS + tS + intC + tC + intA + tA
        intS           tS         intC           tC         intA           tA
-0.049391372  0.034116310 -0.003453588  0.200868693  0.019390920 -0.233687228

Random effects:
 Formula: ~(-1 + intS + tS) + (-1 + intC + tC) + (-1 + intA + tA) | ID
 Structure: General positive-definite, Log-Cholesky parametrization
         StdDev    Corr
intS     0.2891005 intS   tS     intC   tC     intA
tS       0.5652176  0.026
intC     0.3550297  0.661  0.144
tC       0.5335840 -0.078  0.563 -0.008
intA     0.4261338 -0.560  0.109  0.034  0.189
tA       0.6932241 -0.092  0.423  0.058  0.096 -0.141
Residual 0.5847087

Number of Observations: 360
Number of Groups: 40

> cor(junk$coefficients$random$ID)
            intS         tS         intC           tC        intA          tA
intS  1.00000000 0.00969535  0.726342257 -0.113025813 -0.63004526 -0.08474931
tS    0.00969535 1.00000000  0.189830146  0.697937620  0.13437668  0.51908803
intC  0.72634226 0.18983015  1.000000000  0.005010784 -0.01763164  0.07153269
tC   -0.11302581 0.69793762  0.005010784  1.000000000  0.25276614  0.14386815
intA -0.63004526 0.13437668 -0.017631636  0.252766142  1.00000000 -0.16658238
tA   -0.08474931 0.51908803  0.071532693  0.143868146 -0.16658238  1.00000000

> version
         _
platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    1
minor    9.1
year     2004
month    06
day      21
language R




More information about the R-help mailing list