数据中的因子(年龄)20-39在哪里(nhanes2)? [重复]

问题描述 投票:1回答:1

我使用mice包中的mice进行了估算。

然后我使用函数'summary'来查看线性回归的结果。

我可以看到因子(年龄)40-59和因子(年龄)60-99。

但我无法从结果中找到因子(年龄)20-39。

我能知道原因吗?

我认为因子(年龄)20-39不是线性模型。我对吗?

library(mice)

data("nhanes2")

attach(nhanes2)

nhanes2.lm <- lm(chl~factor(age)+bmi, data=nhanes2)

summary(nhanes2.lm)
r lm r-mice
1个回答
0
投票

20-39岁年龄组是模型中的参考组。因此,摘要为您提供了进入其他年龄组的效果。如果另一个组应该是参考组,您可以重新调整模型。

nhanes2$factorage<-factor(nhanes2$age)
levels(nhanes2$factorage)
nhanes2$factorage<-relevel(nhanes2$factorage, ref="60-99")
nhanes2.lm <- lm(chl~factorage+bmi, data=nhanes2)

summary(nhanes2.lm)
© www.soinside.com 2019 - 2024. All rights reserved.