0

I am getting different regression coefficients for the same model when using the tab_model() function from the sjTools package compared to tidy() from the broom package.

Why is that?

This is my data:

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)

The output of tab_model(model_b):

The regression output of tab_model(model_b

The output of 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
Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
Effigy
  • 145
  • 7

1 Answers1

1

They are the same, you just have to exponentiate the ones from 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

jpsmith
  • 11,023
  • 5
  • 15
  • 36
  • Thanks! Do you know why that is? What makes more sense when presenting the results? – Effigy Mar 16 '22 at 15:51
  • 2
    The model betas are a change in log-odds of the outcome per unit change of the predictor, and so to make them the change in odds per unit outcome, you exponentiate them. Most people consider odds much more readily interpretable and are reported in the literature, just like reporting logistic regression (which is likely why `tab_model` does this, though I dont have that package - but it looks great! for reporting). If you look at the actual `model_b` values, the parameters are the same as in `broom` – jpsmith Mar 16 '22 at 16:01