My question is connected with this:
How to add a reference level for interaction in gtsummary and sjPlot
for which I did not get a solution that I am still in need.
The code is as follows:
set.seed(1000)
my_data <- rbind(
data.frame(time = "Pre", treatment = "Control", response = rnorm(100, mean=1)),
data.frame(time = "Pre", treatment = "Treatment", response = rnorm(100, mean=2)),
data.frame(time = "Post", treatment = "Control", response = rnorm(100, mean=1)),
data.frame(time = "Post", treatment = "Treatment", response = rnorm(100, mean=2))
) %>% mutate(time = factor(time, levels = c("Pre", "Post"))) %>%
mutate(treatment = factor(treatment, levels = c("Control", "Treatment")))
model3 <- lm(response ~ time * treatment, data = my_data)
I have tried a different approach this time, meaning another package:
library(ggstats)
ggstats::ggcoef_table(model3)
for which I got following results:
So my question is because ggcoef_table(model3) function has included reference levels for factor variables, would it be possible to add reference levels for interaction as well using ggstats package or any other ?
Something to the effect of:
in order to have it (reference levels for interaction term) on the plot and this coefs table situated besides the plot.
I would be grateful for any help regarding this matter, thank you.
