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

Spencer Graves spencer.graves at pdf.com
Wed Aug 4 03:30:35 CEST 2004

      You may also wish to consider "VarCorr".  This function exists in 
both nlme and lme4.  Someone else mentioned "getVarCov".  However, that 
is not in the current lme4. 

      hope this helps.  spencer graves    

Thomas Lumley wrote:

>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
>>(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")
>   getS3method("pdMatrix","pdMat")
>And all this may well change when Doug finishes lme4.
>	-thomas
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list