I have an effect size that is a difference between two regression coefficients $\Delta\beta=\beta_a-\beta_b$. The response and predictor units are the same in each model, and the question relates directly to the difference in slopes of the two regression models.
I am however a bit lost how to calculate a confidence interval for this difference?
Here's a not perfect but functional example in R:
library(tidyverse)
data(mtcars)
dat <- mtcars |>
mutate(group = rep(c("a", "b"), times = nrow(mtcars)/2)) |>
group_by(group) |>
mutate(y = hp/mean(hp), x = disp/mean(disp)) |>
ungroup()
mod_a <- lm(data = filter(dat, group == "a"), y~x)
mod_b <- lm(data = filter(dat, group == "b"), y~x)
summary(mod_a)
summary(mod_b)
mod_a$coefficients[2]-mod_b$coefficients[2]
What would be an appropriate method for calculating a confidence interval for this difference? I know of ways to test if they are difference (compare global model with interaction term vs global model without interaction term using LRT for example), but when it comes to a figure, I would like to show more than a p-value.
Thanks in advance!