Jan Krajník
Jan Krajník

Reputation: 11

Problems with comparing means of different categorical variables using emmeans()

Hi I have a lmer model in which I am trying to see how much do categorical variables mouse_hit_target (Hit/miss) and click_number (first/second) predict QE_duration.

duration <- lmer(QE_duration ~ mouse_hit_target + click_number + (1|pid), data=lmm.data_2)
emmeans(duration, list(pairwise ~ click_number : mouse_hit_target), adjust = "tukey" )

When trying to compare the means between the different condition using emmeans the results are the same for the pairwise differences between "First Hit - Second Hit" and "First Miss - Second Miss"

emmeans of click_number, mouse_hit_target`
 click_number mouse_hit_target   emmean       SE    df lower.CL upper.CL
 First        Hit              534.5567 10.56109 22.74 512.6957 556.4177
 Second       Hit              583.7066 10.67502 23.74 561.6617 605.7516
 First        Miss             514.6081 13.05561 52.81 488.4196 540.7965
 Second       Miss             563.7580 12.97912 51.56 537.7082 589.8078

Degrees-of-freedom method: kenward-roger 
Confidence level used: 0.95 

$`pairwise differences of click_number, mouse_hit_target`
 1                         estimate        SE      df t.ratio p.value
 First Hit - Second Hit   -49.14995  5.367714 2343.50  -9.157  <.0001
 First Hit - First Miss    19.94864  8.555976 2350.95   2.332  0.0912
 First Hit - Second Miss  -29.20131  9.879585 2350.36  -2.956  0.0166
 Second Hit - First Miss   69.09858 10.316392 2347.74   6.698  <.0001
 Second Hit - Second Miss  19.94864  8.555976 2350.95   2.332  0.0912
 First Miss - Second Miss -49.14995  5.367714 2343.50  -9.157  <.0001

Do you know what might be causing this?

Upvotes: 1

Views: 346

Answers (1)

Russ Lenth
Russ Lenth

Reputation: 6760

That's because you fitted an additive model (no interaction), which posits exactly what you observe -- that the effects of one factor are the same, regardless of the other factor. If you don't think that's true, then you should fit the model

lmer(QE_duration ~ mouse_hit_target * click_number + (1|pid), data=lmm.data_2)

Upvotes: 1

Related Questions