After adjust some linear models I want, first, to test for homogeneity of regression slopes. The second step, and here is my doubt, I want to employ a post-hoc test to compare slopes two by two.
Here goes an example modified from https://www.datanovia.com/en/lessons/ancova-in-r/
get data
data("anxiety", package = "datarium")
anxiety <- anxiety[,c("id","group","t1","t3")]
names(anxiety)[c(3,4)] <- c("pretest","posttest")
plot regression lines
ggscatter(anxiety,x="pretest",y="posttest",color="group",add="reg.line")+
stat_regline_equation(aes(label=paste(..eq.label.., ..rr.label.., sep = "~~~~"),color = group))
check homogeneity of regression slopes
anova_test(anxiety,posttest~group*pretest)
Here we can see a not statistically significant p-value of 4.15e-01
The post-hoc test emmeans_test perform pairwise comparisons to identify which groups are different. Nevertheless I want to employ a multiple-comparison procedure to determine which B's (slopes) are different from which others.
Is there a function for this? Thanks in advance.
After reading and search more I prepared an example of the analysis I was trying to do. I hope it is useful. An important source was https://cran.r-project.org/web/packages/emmeans/vignettes/interactions.html