从nlme摘要中提取随机效应

8

我可以使用summary(fm1)从nlme摘取固定效应,但是我不知道如何获取随机效应:部分。

fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)
summary(fm1)
Linear mixed-effects model fit by REML
 Data: Orthodont 
       AIC      BIC    logLik
  454.6367 470.6173 -221.3183

Random effects:
 Formula: ~age | Subject
 Structure: General positive-definite, Log-Cholesky parametrization
            StdDev    Corr  
(Intercept) 2.3270340 (Intr)
age         0.2264278 -0.609
Residual    1.3100397       

Fixed effects: distance ~ age 
                Value Std.Error DF   t-value p-value
(Intercept) 16.761111 0.7752460 80 21.620377       0
age          0.660185 0.0712533 80  9.265333       0
 Correlation: 
    (Intr)
age -0.848

Standardized Within-Group Residuals:
         Min           Q1          Med           Q3          Max 
-3.223106086 -0.493761144  0.007316631  0.472151121  3.916033210 

Number of Observations: 108
Number of Groups: 27 

任何帮助都将不胜感激。谢谢。
1个回答

12

使用ranef(fm1)来提取每个受试者的信息。

更新后给出了从摘要表格中提取的代码:

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

> temp <- VarCorr(fm1)
> temp[,2]
(Intercept)         age    Residual 
"2.3270341" "0.2264278" "1.3100397" 

> temp[1,2]
[1] "2.3270341"

感谢您的回答。ranef提供随机效应,但标准差部分来自summary(fm1)中的Random Effects: - MYaseen208
不错。我一直在跟随lme对象的print/summary路径,但在print.modelStruct处迷失了方向。 - Roman Luštrik
谢谢,我很感激对我的回答提供反馈,这有助于我在未来给出更好的回答。 :) - Michelle

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接