tab_model() 和 tidy() 的不同系数

问题描述 投票:0回答:2

与 broom 包中的 tidy() 相比,使用 sjTools 包中的 tab_model() 函数时,我得到了不同模型的回归系数。

这是为什么?

这是我的数据:

df <- structure(list(weed_coverage = c(0.04, 0.006, 0.03, 0.017, 0.044, 
0.03, 0.02, 0.05, 0.001, 0.008, 0.03, 0.015, 0.002, 0.015, 0.002, 
0.06, 0.002, 0.01, 0.009, 0.008), soil_moisture = c(11.03, 24.35, 
12.55, 31, 16.73, 9.28, 7.55, 33.42, 21.95, 25.02, 11.3, 36.3, 
14.82, 13.8, 13.48, 14.7, 11.2, 18, 36, 32.25), distance = structure(c(2L, 
1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 
2L, 2L, 1L), .Label = c("2", "5"), class = "factor")), class = "data.frame", row.names = c(NA, 
-20L))
betareg (weed_coverage ~ soil_moisture * distance, data = df) -> model_b

tab_model(model_b)
tidy(model_b)

tab_model(model_b)的输出:

tidy(model_b)的输出:

> tidy(model_b)
# A tibble: 5 x 6
  component term                    estimate std.error statistic  p.value
  <chr>     <chr>                      <dbl>     <dbl>     <dbl>    <dbl>
1 mean      (Intercept)              -5.11      0.728      -7.02 2.18e-12
2 mean      soil_moisture             0.0354    0.0302      1.17 2.41e- 1
3 mean      distance5                 1.99      0.835       2.38 1.72e- 2
4 mean      soil_moisture:distance5  -0.0652    0.0372     -1.75 7.99e- 2
5 precision (phi)                    77.7      26.6         2.92 3.54e- 3
r betareg
2个回答
1
投票

它们是相同的,你只需对

tidy
中的取幂:

vars <- c(-5.11, 0.0354, 1.99, -0.0652)
exp(vars)
round(exp(vars),2)

#> exp(vals)
#[1] 0.006036083 1.036034040 7.315533762 0.936880069
#> round(exp(vals),2)
#[1] 0.01 1.04 7.32 0.94

results <- broom::tidy(model_b)
exp(res$estimate)
#[1] 6.041116e-03 1.036079e+00 7.305950e+00 9.369114e-01 5.575028e+33


0
投票

tab_model(model_b, tranform=NULL
)将向您显示未转换的估计值

© www.soinside.com 2019 - 2024. All rights reserved.