Main Effects Only
This object can now be passed to emmeans, for example to obtain the marginal means of the four inferences:
m1 <- emmeans(a1, ~ inference)
m1
## inference emmean SE df lower.CL upper.CL
## MP 87.51250 1.797265 38 83.87413 91.15087
## MT 76.68125 4.064950 38 68.45219 84.91031
## AC 69.41250 4.771297 38 59.75351 79.07149
## DA 82.95625 3.837620 38 75.18740 90.72510
##
## Results are averaged over the levels of: instruction, plausibility
## Confidence level used: 0.95
This object can now also be used to compare whether or not there are differences between the levels of the factor:
## contrast estimate SE df t.ratio p.value
## MP - MT 10.83125 4.331479 38 2.501 0.0759
## MP - AC 18.10000 5.017994 38 3.607 0.0047
## MP - DA 4.55625 4.196484 38 1.086 0.7002
## MT - AC 7.26875 3.983558 38 1.825 0.2778
## MT - DA -6.27500 4.702592 38 -1.334 0.5473
## AC - DA -13.54375 5.299024 38 -2.556 0.0672
##
## Results are averaged over the levels of: instruction, plausibility
## P value adjustment: tukey method for comparing a family of 4 estimates
To obtain more powerful p-value adjustments, we can furthermore pass it to multcomp (Bretz, Hothorn, & Westfall, 2011):
summary(as.glht(pairs(m1)), test=adjusted("free"))
##
## Simultaneous Tests for General Linear Hypotheses
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## MP - MT == 0 10.831 4.331 2.501 0.05907 .
## MP - AC == 0 18.100 5.018 3.607 0.00457 **
## MP - DA == 0 4.556 4.196 1.086 0.31350
## MT - AC == 0 7.269 3.984 1.825 0.19414
## MT - DA == 0 -6.275 4.703 -1.334 0.31350
## AC - DA == 0 -13.544 5.299 -2.556 0.05907 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- free method)
A Simple interaction
We could now also be interested in the marginal means of the inferences across the two instruction types. emmeans offers two ways to do so. The first splits the contrasts across levels of the factor using the by argument.
m2 <- emmeans(a1, "inference", by = "instruction")
## equal: emmeans(a1, ~ inference|instruction)
m2
## instruction = deductive:
## inference emmean SE df lower.CL upper.CL
## MP 97.2875 2.541716 38 92.14206 102.43294
## MT 70.4000 5.748708 38 58.76235 82.03765
## AC 61.4875 6.747633 38 47.82763 75.14737
## DA 81.8125 5.427214 38 70.82568 92.79932
##
## instruction = probabilistic:
## inference emmean SE df lower.CL upper.CL
## MP 77.7375 2.541716 38 72.59206 82.88294
## MT 82.9625 5.748708 38 71.32485 94.60015
## AC 77.3375 6.747633 38 63.67763 90.99737
## DA 84.1000 5.427214 38 73.11318 95.08682
##
## Results are averaged over the levels of: plausibility
## Confidence level used: 0.95
Consequently, tests are also only performed within each level of the by factor:
## instruction = deductive:
## contrast estimate SE df t.ratio p.value
## MP - MT 26.8875 6.125636 38 4.389 0.0005
## MP - AC 35.8000 7.096515 38 5.045 0.0001
## MP - DA 15.4750 5.934724 38 2.608 0.0599
## MT - AC 8.9125 5.633601 38 1.582 0.4007
## MT - DA -11.4125 6.650469 38 -1.716 0.3297
## AC - DA -20.3250 7.493951 38 -2.712 0.0471
##
## instruction = probabilistic:
## contrast estimate SE df t.ratio p.value
## MP - MT -5.2250 6.125636 38 -0.853 0.8287
## MP - AC 0.4000 7.096515 38 0.056 0.9999
## MP - DA -6.3625 5.934724 38 -1.072 0.7084
## MT - AC 5.6250 5.633601 38 0.998 0.7512
## MT - DA -1.1375 6.650469 38 -0.171 0.9982
## AC - DA -6.7625 7.493951 38 -0.902 0.8036
##
## Results are averaged over the levels of: plausibility
## P value adjustment: tukey method for comparing a family of 4 estimates
The second version considers all factor levels together. Consequently, the number of pairwise comparisons is a lot larger:
m3 <- emmeans(a1, c("inference", "instruction"))
## equal: emmeans(a1, ~inference*instruction)
m3
## inference instruction emmean SE df lower.CL upper.CL
## MP deductive 97.2875 2.541716 38 92.14206 102.43294
## MT deductive 70.4000 5.748708 38 58.76235 82.03765
## AC deductive 61.4875 6.747633 38 47.82763 75.14737
## DA deductive 81.8125 5.427214 38 70.82568 92.79932
## MP probabilistic 77.7375 2.541716 38 72.59206 82.88294
## MT probabilistic 82.9625 5.748708 38 71.32485 94.60015
## AC probabilistic 77.3375 6.747633 38 63.67763 90.99737
## DA probabilistic 84.1000 5.427214 38 73.11318 95.08682
##
## Results are averaged over the levels of: plausibility
## Confidence level used: 0.95
## contrast estimate SE df t.ratio p.value
## MP,deductive - MT,deductive 26.8875 6.125636 38 4.389 0.0020
## MP,deductive - AC,deductive 35.8000 7.096515 38 5.045 0.0003
## MP,deductive - DA,deductive 15.4750 5.934724 38 2.608 0.1848
## MP,deductive - MP,probabilistic 19.5500 3.594529 38 5.439 0.0001
## MP,deductive - MT,probabilistic 14.3250 6.285536 38 2.279 0.3310
## MP,deductive - AC,probabilistic 19.9500 7.210470 38 2.767 0.1342
## MP,deductive - DA,probabilistic 13.1875 5.992910 38 2.201 0.3741
## MT,deductive - AC,deductive 8.9125 5.633601 38 1.582 0.7577
## MT,deductive - DA,deductive -11.4125 6.650469 38 -1.716 0.6772
## MT,deductive - MP,probabilistic -7.3375 6.285536 38 -1.167 0.9363
## MT,deductive - MT,probabilistic -12.5625 8.129901 38 -1.545 0.7783
## MT,deductive - AC,probabilistic -6.9375 8.864434 38 -0.783 0.9931
## MT,deductive - DA,probabilistic -13.7000 7.905839 38 -1.733 0.6666
## AC,deductive - DA,deductive -20.3250 7.493951 38 -2.712 0.1501
## AC,deductive - MP,probabilistic -16.2500 7.210470 38 -2.254 0.3446
## AC,deductive - MT,probabilistic -21.4750 8.864434 38 -2.423 0.2600
## AC,deductive - AC,probabilistic -15.8500 9.542594 38 -1.661 0.7111
## AC,deductive - DA,probabilistic -22.6125 8.659400 38 -2.611 0.1834
## DA,deductive - MP,probabilistic 4.0750 5.992910 38 0.680 0.9971
## DA,deductive - MT,probabilistic -1.1500 7.905839 38 -0.145 1.0000
## DA,deductive - AC,probabilistic 4.4750 8.659400 38 0.517 0.9995
## DA,deductive - DA,probabilistic -2.2875 7.675239 38 -0.298 1.0000
## MP,probabilistic - MT,probabilistic -5.2250 6.125636 38 -0.853 0.9885
## MP,probabilistic - AC,probabilistic 0.4000 7.096515 38 0.056 1.0000
## MP,probabilistic - DA,probabilistic -6.3625 5.934724 38 -1.072 0.9588
## MT,probabilistic - AC,probabilistic 5.6250 5.633601 38 0.998 0.9719
## MT,probabilistic - DA,probabilistic -1.1375 6.650469 38 -0.171 1.0000
## AC,probabilistic - DA,probabilistic -6.7625 7.493951 38 -0.902 0.9840
##
## Results are averaged over the levels of: plausibility
## P value adjustment: tukey method for comparing a family of 8 estimates
Running Custom Contrasts
Objects returned from emmeans can also be used to test specific contrasts. For this, we can simply create a list, where each element corresponds to one contrasts. A contrast is defined as a vector of constants on the reference grid (i.e., the object returned from emmeans, here m3). For example, we might be interested in whether there is a difference between the valid and invalid inferences in each of the two conditions.
c1 <- list(
v_i.ded = c(0.5, 0.5, -0.5, -0.5, 0, 0, 0, 0),
v_i.prob = c(0, 0, 0, 0, 0.5, 0.5, -0.5, -0.5)
)
contrast(m3, c1, adjust = "holm")
## contrast estimate SE df t.ratio p.value
## v_i.ded 12.19375 4.11901 38 2.96 0.0105
## v_i.prob -0.36875 4.11901 38 -0.09 0.9291
##
## Results are averaged over the levels of: plausibility
## P value adjustment: holm method for 2 tests
summary(as.glht(contrast(m3, c1)), test = adjusted("free"))
##
## Simultaneous Tests for General Linear Hypotheses
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## v_i.ded == 0 12.1937 4.1190 2.96 0.0105 *
## v_i.prob == 0 -0.3687 4.1190 -0.09 0.9291
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- free method)
The results can be interpreted as in line with expectations. Responses are larger for valid than invalid problems in the deductive, but not the probabilistic condition.