首页 文章

使用线性混合模型找到重复测量相关系数

提问于
浏览
0

我正在使用Orange数据集来说明我的问题 . 在该数据集中,对于每棵树,测量周长和年龄数次 . 假设我们需要找到树木周长和年龄之间的相关系数 . 由于这两个变量包括重复措施 . 变量不是iid,因此我们不应该使用简单的线性回归 . 我正在使用线性混合模型来建模数据(lme4)

fit<-lmer(circumference~age+(1|Tree), data=Orange)
summary(fit)

以下是输出:

Linear mixed model fit by REML ['lmerMod']
Formula: circumference ~ age + (1 | Tree)
   Data: Orange

REML criterion at convergence: 303.2

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.8781 -0.6743  0.2320  0.5053  1.5416 

Random effects:
 Groups   Name        Variance Std.Dev.
 Tree     (Intercept) 389.6    19.74   
 Residual             232.9    15.26   
Number of obs: 35, groups:  Tree, 5

Fixed effects:
             Estimate Std. Error t value
(Intercept) 17.399650  10.423696   1.669
age          0.106770   0.005321  20.066

Correlation of Fixed Effects:
    (Intr)
age -0.471

在输出中,我们可以看到相关信息(最后一行中的-0.471) . 怎么解释这个数字?看起来年龄和(Intr)之间的相关性?我需要找到的是年龄和周长之间的相关系数,而不是固定效应斜率 . 有谁知道如何提取相关系数?非常感谢提前 .

1 回答

  • 0

    我使用 nlme 包,我得到像这里的相关性:

    library(nlme)
    fit <- lme(circumference~age, random = ~1|Tree, data=Orange)
    summary(fit)$cor
    

    我无法从 lme4 summary 输出中提取相关性 .

相关问题