s-news
[Top] [All Lists]

Re: Help with command of returning the random effect covariance estimate

To: "Roberts, J. Kyle" <jkrobert@bcm.tmc.edu>, <s-news@lists.biostat.wustl.edu>
Subject: Re: Help with command of returning the random effect covariance estimate using 'lme' fitting
From: "Klaas Prins" <kprins@Pharsight.com>
Date: Thu, 1 Mar 2007 08:34:19 -0800
Thread-index: AcdcAAAaihde5uDbRtGbocnDPjqR/QAG4qYwAACkt2A=
Thread-topic: [S] Help with command of returning the random effect covariance estimate using 'lme' fitting
or you can plough through:
 
object$apVar  #object = dental.fit
 
where, among many other useful things, the (approximation of the) log of the random effects (i.e. attr(object$apVar,"Pars") ) and their variance covariance matrix resides. Handy for post-processing these estimates in calls like rmvnorm() etc...
 
Don't forget nlme estimates random effects in log space, thus apVar has them stored in log space, whereas summary and VarCorr will provide them they way you have introduced them into your model.
 
good luck,
Klaas
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu]On Behalf Of Roberts, J. Kyle
Sent: Thursday, March 01, 2007 5:18 PM
To: s-news@lists.biostat.wustl.edu
Subject: Re: [S] Help with command of returning the random effect covariance estimate using 'lme' fitting

Chaofeng,
 
It doesn't quite give everything you need in the same format, but if you use
VarCorr(dental.fit)
you will get the variance estimates as well as the correlations.  Just multiply these correlations by their respective SD's and you have the covariance estimates.  Beyond this, you may have to ask Doug Bates.
 
Hope this Helps,
Kyle
 
***************************************
J. Kyle Roberts, Ph.D.
Baylor College of Medicine
Center for Educational Outreach
One Baylor Plaza, MS:  BCM411
Houston, TX   77030-3411
713-798-6672 - 713-798-8201 Fax
jkrobert@bcm.edu
***************************************
 


From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Kou Chaofeng
Sent: Thursday, March 01, 2007 6:15 AM
To: s-news@lists.biostat.wustl.edu
Subject: [S] Help with command of returning the random effect covariance estimate using 'lme' fitting

Dear all
 
I am fitting and analyzing linear mixed-effects models using the Splus command 'lme'. The following is the results:

dental.fit <- lme(fixed = distance~age, random = ~age + cluster = ~subject, data = "">

> summary(dental.fit)

Variance/Covariance Components Estimates:
                 Standard Deviation(s) of Random Effect(s)
                            (Intercept)        age
                             2.134464     0.1541247
                 Correlation of Random Effects
                                 (Intercept)
                        age    -0.6024329
                 Cluster Residual Variance: 1.716232
 
Fixed Effects Estimates:
                                   Value       Approx. Std.Error        z ratio(C)
       (Intercept)         16.3406250     0.98005731        16.6731321
                 age          0.7843750      0.08275189         9.4786353
                 sex         1.0321023      1.53545472         0.6721802
                age:sex   -0.3048295      0.12964730        -2.3512218
      Conditional Correlations of Fixed Effects Estimates
                 (Intercept)        age                sex
     age       -0.8801554
     sex       -0.6382847   0.5617897
     age:sex 0.5617897   -0.6382847    -0.8801554

I have known that using command 'dental.fit$varFix' I can obtain the conditional covariance matrix of the fixed effects. My question is how i can return the covariance matrix estimate of the random effects. I tried many commands
such as 'dental.fit$varRan', 'dental.fit$var.Ran', but they didn't work.

Thanks very much!

Chaofeng

<Prev in Thread] Current Thread [Next in Thread>