[R] lme fitted correlation of random effects: where is it?
Thomas Lumley
tlumley at u.washington.edu
Wed Aug 4 02:36:40 CEST 2004
On Tue, 3 Aug 2004, Jacob Wegelin wrote:
>
> 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?)
>
It's remarkably complicated. If you look at
getS3method("print","lme")
you see that it comes from
print(summary(x$modelStruct), sigma=x$sigma)
You then look at what the class of x$modelstruct is
> class(fm1$modelStruct)
[1] "lmeStructInt" "lmeStruct" "modelStruct"
and look at getS3method("print","lmeStructInt"), which doesn't exist. You
then try lmeStruct, with no luck, and then
getS3method("print","modelStruct")
After a lot more chasing through methods you find that the correlation
matrix is computed by the generic function pdMatrix. You probably want to
look at
getS3method("pdMatrix","pdSymm")
and
getS3method("pdMatrix","pdMat")
And all this may well change when Doug finishes lme4.
-thomas
More information about the R-help
mailing list