Skip to content

how to extract the values in the nlme package?

2 messages · Ming Liu, Douglas Bates

#
On Tue, Oct 7, 2008 at 2:06 AM, Ming Liu <dannyliu1002 at yahoo.com.cn> wrote:
But that only works if there are components named r.squared and coef
in the object returned by the summary method and it really has nothing
to do with the object returned by an nlme or lme fit.  If you want the
estimate of the standard deviation of the random effects, you should
look at
VarCrr> fm1 <- lme(distance ~ age, data = Orthodont, random = ~age)

VarCrr> VarCorr(fm1)
Subject = pdLogChol(age)
            Variance   StdDev    Corr
(Intercept) 5.41508751 2.3270341 (Intr)
age         0.05126955 0.2264278 -0.609
Residual    1.71620400 1.3100397

It happens that the object returned by VarCorr is a character matrix
(not a really great design, I must admit) so you would need to use
something like

as.numeric(VarCorr(fm1)["(Intercept)", "StdDev"])

to get the numeric value.