there are a lot of questions about post-hoc tests for GLMMs on this site and thanks to the replies I almost have my question solved. I want to see if there is a difference in treatment groups over time but for all pairwise comparisons.
My model has a count response (count) with a categorical predictor treatment (as factor with 3 levels: A,B,C) and year (repeated measures of count over time). I also include an interaction to test whether the treatment levels differ over time as follows (simplified here, removed random effects for brevity):
fit <- glmmTMB(count ~ treatment + year + year:treatment)
emmeans(fit, pairwise ~ treatment | year, at = list(year = c(1, 2, 3,4,5,6))) $emmeans year = 1: treatment emmean SE df lower.CL upper.CL A 13.55 0.276 423 13.00 14.1 B 13.51 0.276 423 12.96 14.0 C 13.24 0.276 423 12.69 13.8 .... year = 6: treatment emmean SE df lower.CL upper.CL A 12.90 0.241 423 12.43 13.4 B 12.89 0.241 423 12.42 13.4 C 12.58 0.241 423 12.11 13.1
But I want all pairwise contrasts for treatment:year to compare treatments within and across all years. This is easy if it were a linear model followed by Tukey's test. The result looks something like:
A:year1 - B:year1 A:year1 - B:year2 A:year1 - B:year3 A:year2 - B:year2 A:year2 - B:year3 etc.
Any help greatly appreaciated.