2
$\begingroup$

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

$\endgroup$
5
  • $\begingroup$ First, you have to clarify the syntax of your glmer model. Presently, you use Day both as a grouping factor whose 4 levels are representative of a larger set of levels - hence (1|Day) - and as a factor whose 4 levels are the only ones you are interested in - hence the Day$*$Treatment$*$RIL. You have to decide which of the two scenarios best describes your study and take it from there! $\endgroup$ Jan 15, 2019 at 18:23
  • 1
    $\begingroup$ If you really care about just the 4 days and seeing what happens on each day, then a possible model could be: m2 <-glmer(data=ec.a, Total~Day$*$Treatment$*$RIL+ (Day|Plant). $\endgroup$ Jan 15, 2019 at 18:24
  • $\begingroup$ Hopefully I am understanding your comment correctly (still learning R), but I structured the Day term like that because it was suggested in several previous posts on this website for structuring repeated measures models, and the (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$
    – Abbey
    Jan 15, 2019 at 18:44
  • 1
    $\begingroup$ @IsabellaGhement changing Day to a factor instead of numerical, then removing (1|Day) from the random effects and keeping only (Day|Plant) worked in the post hoc analysis using 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$
    – Abbey
    Jan 15, 2019 at 20:56
  • $\begingroup$ I'm glad this worked for you, @Abbey! If you want to investigate the effect of Treatment by RIL combination on each Day, you do indeed have to treat Day as a factor in your model. $\endgroup$ Jan 15, 2019 at 22:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.