Articles by R on I Should Be Writing: COVID-19 Edition

Testing The Equality of Regression Coefficients

February 15, 2021 | R on I Should Be Writing: COVID-19 Edition

The Problem Method 1: As Model Comparisons Method 2: Paternoster et al (1998) Method 3: emmeans \beta_{\text{n_comps}}\). Method 2: Paternoster et al (1998) According to Paternoster et al. (1998), we can compute a t-test to compare the coefficients:
bs <- coef(m)[-1]
V <- vcov(m)[-1, -1]

tibble::tibble(
  diff_estim = diff(bs),
  diff_SE = sqrt(V[1, 1] + V[2, 2] - 2 * V[1, 2]),
  t_stat = diff_estim / diff_SE,
  df = df.residual(m),
  p_value = 2 * pt(abs(t_stat), df = df, lower.tail = FALSE)
)
#> # A tibble: 1 x 5
#>   diff_estim diff_SE t_stat    df  p_value
#>        <dbl>   <dbl>  <dbl> <int>    <dbl>
#> 1     -0.402  0.0251  -16.0   497 6.96e-47
This gives the exact same results as the first method! (\(t^2 = (-16)^2 = 256\) is the ... [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)