【发布时间】:2020-02-22 10:33:23
【问题描述】:
我不确定我是否做错了什么,或者这是 R 本身中的 confint 函数中的错误,但我得到的回归估计置信区间不包含估计值。
这里是reprex:
# model (converting all numeric columns in data to z-scores)
mod <-
stats::lm(
formula = cbind(mpg, disp) ~ wt,
data = purrr::modify_if(.x = mtcars, .p = is.numeric, .f = scale)
)
# tidy dataframe
broom::tidy(mod, conf.int = TRUE)
#> # A tibble: 4 x 8
#> response term estimate std.error statistic p.value conf.low conf.high
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 mpg (Intercept) 8.05e-17 0.0893 9.01e-16 1.00e+ 0 -0.182 0.182
#> 2 mpg wt -8.68e- 1 0.0908 -9.56e+ 0 1.29e-10 -1.05 -0.682
#> 3 disp (Intercept) -1.70e-16 0.0826 -2.06e-15 1.00e+ 0 -0.182 0.182
#> 4 disp wt 8.88e- 1 0.0840 1.06e+ 1 1.22e-11 -1.05 -0.682
confint(mod)
#> 2.5 % 97.5 %
#> :(Intercept) -0.1824544 0.1824544
#> :wt -1.0530332 -0.6822855
#> :(Intercept) -0.1824544 0.1824544
#> :wt -1.0530332 -0.6822855
如果您绘制估计值,这会变得更加明显:
我在这里做错了吗?或者这是预期的行为?
【问题讨论】:
-
确实,间隔看起来完全错误。见stackoverflow.com/questions/28442141/…
标签: r statistics