JWDN
JWDN

Reputation: 382

Can emmeans apply sphericity corrections to repeated-measures contrasts?

I am analysing a 2-way repeated-measures dataset, modelled as follows:

model= lmer(result ~ treatment * time + (1|subject), data=df)

... where every subject receives every treatment and is tested at every time. However when analysing the contrasts, there appears to be no correction for sphericity. Here I am using emmeans to test for a difference between each treatment and the control-treatment, at each level of "time"...

emm <- emmeans(model,c("treatment","time")
contrast(emm, "trt.vs.ctrl", ref="Control", by="time")

When I look at the output from contrast(), I confirmed there is no G-G correction by comparing with the output from GraphPad Prism for the same dataset.

Is there a simple way of achieving a sphericity-corrected analysis of the contrasts?

Upvotes: 0

Views: 329

Answers (1)

user2088356
user2088356

Reputation:

Thank's to the commentors for identifying this solution. the afex() packages is specifically designed for repeated measures factorial designs, and allows the appropriate corrections.

  • aov_ez (in the afex package) automatically applies corrections for non-sphericity
  • emmeans should specify that the model is multivariate
  • contrast (in the emmeans package) should specify the appropriate adjustment to "p"

The solution therefore would look like this...

library(afex)
library(emmeans)

model= aov_ez("subject","result",df,within=c("treatment","time"),type="III")
emm= emmeans(model,c("treatment","time"),model="multivariate")
contrast(emm,"trt.vs.ctrl",ref="Control",by="time",adjust="dunn")

Hope this is helpful for anyone else with a similar question!

Upvotes: 1

Related Questions