Please consider the following:
DF <- data.frame(ID = c(5,6,8,10,10,11,12,14,14,15,15,16,17,17,18,23,25,26), time = factor(c(1,24,24,1,24,1,1,6,24,6,96,6,6,96,96,24,24,24)), CB = c(78.66,123.87,121.93,109.32,110.29,179.81,181.07,102.37,141.4,50.13,92.36,82.64,106.15,194.5,128.6,95.33,152.88,124.16), M = c(103,124.1,97.3,102.1,106.8,80.6,89.3,107.2,96.5,131.3,101.9,122.5,110.4,95.2,94.4,114.2,112.6,97.5), CC = c(120.1,148.1,126.3,116.7,133.4,159.1,139.1,111.9,138.2,82.3,131.7,107.1,116.3,162,111.8,107,160.6,129.3))
I have repeated measures data of 14 individuals distributed unevenly over 4 time points, and I'm analyzing the effect of time on CC. I have fit the data with both glmmTMB and lmer, the latter package has more complex tricks that make results more conservative, but I'm puzzled by the output and I'm wondering if I need it at all.
library(lme4) library(glmmTMB) library(emmeans) model.glmmTMB <- glmmTMB(CC ~ time + (1|ID), data=DF, REML=T) emm.glmmTMB <- emmeans(model.glmmTMB, specs=~time) ph.glmmTMB <- contrast(emm.glmmTMB, "consec", simple=list("time"), adjust="bonferroni") emmplot <- emmip(emm.glmmTMB, ~time, CI=T)
Judging from emmplot, I see some significant effects that I would expect based on the EMM. Even though my N isn't very small, the data is very sparsely distributed over my time points, so I tried another approach with lme4's Kenward-Roger df correction.
model.lmer <- lmer(CC ~ time + (1|ID), data=DF, REML=T) emm.lmer <- emmeans(model.lmer, specs=~time) ph.lmer <- contrast(emm.lmer, "consec", simple=list("time"), adjust="bonferroni")
Looking at ph.lmer, it's clear the correction has wiped any effect previously off the map. We can also see why: it completely decimated the df. However this doesn't seem to happen when regressing against CB or M, and it also doesn't happen when I log transform CC. Due to my limited knowledge of LMMs, I'm unable to figure out which strategy I have to apply now.
I have two questions stemming from this issue:
- I'm puzzled by the complete lack of effects in the face of clear differences in EMMs after applying KR, and the fact that df has been reduced to ~1 makes me wonder if the algorithm tripped up somewhere. But perhaps I'm hurting my head over this for nothing. I read that KR was developed for situations where n<<p, which not really the case here, but I want to be sure: is the Kenward-Roger correction appropriate/necessary in my situation?
- If the reduced df is correct, how is it possible that df isn't reduced as much when regressing M, or CB (whose sd is much higher)?