我用lmList从nlme包来运行基于不同组由功能的各种回归.鉴于我所看到的解释,我对总结结果感到有些困惑summary.lmList
The `summary.lm` method is applied to each lm component of object to produce
summary information on the individual fits, which is organized into a list of
summary statistics.
The returned object is suitable for printing with the print.summary.lmList
method.
Run Code Online (Sandbox Code Playgroud)
我的意思是以下
set.seed(123)
t <- data.frame(
name=sample(c("a","b","c"),size=500,replace=T),
x=1:500,
y=1:500+rnorm(100)
)
ta <- t[t$name=="a",]
lma <- lm(y~x,ta)
lmL <- lmList(y~x | name,t)
r1 <- summary(lmL)
r2 <- summary(lmL[["a"]])
r3 <- summary(lma)
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释为什么在r1中为"a"显示的值与r2和r3中的值不匹配,而r2中的值与r3中的值相匹配?
nlme的版本lmList和它的摘要方法有一个参数:pool
一个可选的逻辑值,指示是否应在标准差的计算或摘要的标准误差的计算中使用残差标准误差的合并估计.
我猜你如果你把它设置为FALSE你打电话给summary你时会得到相同的价值观.