I have a question about post hoc tests for glmer. I haven't been able to find a solution on this site or in the documentation. My experiment looks at repeated measures of flower counts (Total) across time (Day) on plants of 6 different genetic lines (RIL) and in 4 different treatments. The treatments are heat events at different time points (Control, Early, Peak, Late). To analyze the flower production across time, I have separated data into comparing one treatment to the control after the heat event occurred. Here is a subset of my data from this example, if that helps: https://docs.google.com/spreadsheets/d/1sOZi28PD5ruEFUgneB3kD1gcB0Xkx54TJNHc8XtdBxI/edit?usp=sharing
head(ec.a)
Plant Total Treatment Day RIL
85 2 Early 19 206
85 5 Early 21 206
85 15 Early 23 206
85 15 Early 25 206
85 29 Early 27 206
85 67 Early 29 206
m2 <-glmer(data=ec.a, Total~Day*Treatment*RIL + (1|Day)+ (Day|Plant), family=poisson(link="log"),na.action=na.exclude,control=glmerControl(check.nobs.vs.nRE="ignore"))
I would like to compare flower production (Total) at each Day for the Treatment / RIL combinations. I imagine having an output like this, and I could contrast the genetic lines too. This way I could see exactly when the control and early flower production was the same, and then if there was a specific Day when they started to produce differently.
Day contrast (Treatment)
1 Control - Early
2 Control - Early
3 Control - Early
----
39 Control - Early
40 Control - Early
My problem is when I run a post hoc test, it averages Day, as shown below.
emmeans(m2.factor, list(pairwise ~ Treatment|Day), adjust = "tukey")
$`emmeans of Treatment | Day`
Day = 30.99449:
Treatment emmean SE df asymp.LCL asymp.UCL
Control 0.1278923 0.3325298 Inf -0.5238542 0.7796387
Early 2.1599346 0.3294519 Inf 1.5142207 2.8056485
I've also tried summary(glht(m2, emm(pairwise ~ Treatment|Day)))
and the same problem occurs.
I tried to fix this by making Day a factor and running it again, but I still get the same output.
Does anyone have any suggestions on how to deal with this? Thank you
(1|Day)
term is significant when I compare a model with that term to the model without. I can try removing (1|Day) and see if that changes anything with the post hoc test results. Also, just to clarify I have more than 4 Days - the data has the Days 19-43 (but counting by 2s, so 19,21,23, etc). $\endgroup$summary(glht(m2null, emm(pairwise ~ RIL|Day)))
The model took a lot longer to run and I am not sure why it made a difference, but it worked! Thanks so much! $\endgroup$