【发布时间】:2025-12-05 22:40:01
【问题描述】:
我使用 nlme 包中的 lmList 来运行基于不同组的各种回归 by 函数。鉴于我对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.
我的意思是下面
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)
谁能解释一下为什么 r1 中“a”显示的值与 r2 和 r3 中的值不匹配,而 r2 中的值与 r3 中的值匹配?
【问题讨论】:
标签: r regression