[R] 'nlme' library - lme function results

Peter Ehlers ehlers at ucalgary.ca
Sat Jan 16 14:06:17 CET 2010



Dieter Menne wrote:
> 
> 
> Michal Figurski wrote:
>> I am running a simple mixed effects model using lme(). The call looks 
>> like this:
>> fit <- lme(Analyte~Sample, data=Data, random=~1 | Run)
>>
>> I am particularly interested in the estimated random effects. When I 
>> print the 'fit' object, it looks something like example below:
>>
>> (...)
>> Random effects:
>>   Formula: ~1 | Run
>>          (Intercept) Residual
>> StdDev:    3.483794 3.637523
>> (...)
>>
>> While I have no problem obtaining the 'Residual' value by calling 
>> fit$sigma, I have no idea how to obtain the '(Intercept)' value from the 
>> 'fit' object. Anyone can help with that?
>>
>>
> 
> There might be an official way to get it, but I would use as a hack.
> 
> library(nlme)
> fm2 <- summary(lme(distance ~ age + Sex, data = Orthodont, random = ~ 1))
> sqrt(getVarCov(fm2)[1,1])
> 
or get both from VarCorr(model):

VarCorr(fm2)
#Subject = pdLogChol(1)
#            Variance StdDev
#(Intercept) 3.266784 1.807425
#Residual    2.049456 1.431592

  -Peter Ehlers

-- 
Peter Ehlers
University of Calgary
403.202.3921



More information about the R-help mailing list