如何获取lme中随机效应的标准误差?

时间:2016-02-17 20:46:32

标签: r nlme

如果我使用lme包中的R nlme修复线性混合效果模型,如何获得随机效应估计的标准误差?

例如,如果lme给出以下结果:

null.model <- lme(fixed = fev1 ~ 1, data = Data, random = ~ 1 | conwrd)

null.model

Linear mixed-effects model fit by REML
  Data: Dat 
  Log-restricted-likelihood: -887.7505
  Fixed: fev1 ~ 1 
(Intercept) 
   15.00424 

Random effects:
 Formula: ~1 | conwrd
        (Intercept) Residual
StdDev:    3.010589 4.130609

Number of Observations: 308
Number of Groups: 11 

如何获得2级(拦截)随机效应估计和残留效应估计的标准误差?例如,Stata的mixed命令不仅返回这些估计值,还返回它们的标准误差,以及从这些标准误差导出的置信区间估计值,如下所示。注意:Stata报告方差,而R报告标准偏差,因此上述R模型输出的3.010589和4.130609等于相同数据下面Stata模型输出的9.063698和17.06193的平方根。

mixed fev1 || conwrd: , reml

[SNIP]


Mixed-effects REML regression                   Number of obs     =        308
Group variable: conwrd                          Number of groups  =         11

                                                Obs per group:
                                                              min =         25
                                                              avg =       28.0
                                                              max =         31

                                                Wald chi2(0)      =          .
Log restricted-likelihood = -887.75054          Prob > chi2       =          .

------------------------------------------------------------------------------
        fev1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   15.00424   .9378441    16.00   0.000      13.1661    16.84238
------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
conwrd: Identity             |
                  var(_cons) |   9.063698   4.324303      3.557919    23.08952
-----------------------------+------------------------------------------------
               var(Residual) |   17.06193   1.400088      14.52711    20.03905
------------------------------------------------------------------------------
LR test vs. linear model: chibar2(01) = 94.48         Prob >= chibar2 = 0.0000

这些模型使用的假数据

conwrd <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11)
fev1 <- c(23, 18, 22, 19, 16, 13, 15, 17, 16, 23, 25, 18, 21, 20, 17, 21, 17, 19, 20, 21, 21, 20, 17, 15, 15, 17, 13, 14, 19, 9, 9, 11, 10, 19, 13, 16, 12, 10, 9, 11, 11, 9, 11, 10, 12, 9, 7, 8, 11, 14, 16, 13, 9, 10, 9, 8, 16, 14, 13, 9, 11, 9, 12, 12, 13, 11, 17, 16, 17, 19, 23, 24, 28, 26, 22, 25, 19, 24, 22, 23, 20, 27, 12, 12, 10, 9, 10, 9, 4, 4, 4, 8, 9, 6, 8, 6, 9, 11, 9, 8, 9, 11, 14, 17, 11, 12, 13, 10, 10, 9, 14, 13, 15, 15, 20, 12, 13, 6, 15, 16, 12, 7, 10, 7, 15, 17, 15, 18, 20, 18, 16, 21, 22, 16, 12, 15, 11, 13, 8, 17, 19, 20, 16, 20, 18, 12, 11, 8, 12, 11, 11, 16, 17, 16, 17, 17, 14, 20, 24, 24, 24, 23, 20, 21, 25, 13, 14, 14, 15, 21, 16, 17, 15, 14, 11, 8, 11, 13, 14, 13, 15, 13, 12, 15, 17, 19, 16, 14, 16, 16, 14, 14, 11, 17, 7, 10, 16, 12, 18, 18, 15, 11, 13, 9, 12, 11, 13, 9, 11, 16, 15, 15, 18, 24, 28, 24, 24, 27, 23, 23, 21, 23, 23, 22, 15, 10, 11, 13, 17, 15, 13, 10, 15, 13, 11, 13, 18, 18, 15, 22, 18, 19, 18, 20, 17, 19, 18, 14, 13, 10, 7, 11, 14, 19, 18, 15, 14, 9, 14, 15, 14, 19, 18, 14, 10, 17, 23, 25, 26, 24, 24, 26, 25, 25, 20, 20, 20, 20, 17, 15, 14, 12, 11, 11, 11, 11, 9, 10, 11, 13, 13, 17, 16, 11, 11, 11, 12, 19, 15, 13, 15, 15, 12, 9, 12, 10, 8, 8)
Data <- data.frame(conwrd,fev1)

0 个答案:

没有答案