# How are contrasts tested when using estimated marginal means?

Forgive me for this, but I just can't work it out.

Some dummy data :

r1 <- rnorm(40)
r2 <- rnorm(40)
r2 <- r2[order(r2)]
f1 <- as.factor(c(rep(0, 20), rep(1, 20)))
g1 <- as.factor(c(rep("A", 40), rep("B", 40)))
dat <- data.frame(r = c(r1, r2), f = c(f1,f1), g = g1)


Then the model:

contrasts(dat$$f) <- cbind(c(-1,1)) contrasts(dat$$g) <- cbind(c(-1,1))
m <- aov(r ~ f*g, data = dat)

summary(m)
Df Sum Sq Mean Sq F value   Pr(>F)
f            1   6.54   6.536   9.056  0.00355 **
g            1   0.00   0.004   0.005  0.94211
f:g          1  14.06  14.056  19.476 3.32e-05 ***
Residuals   76  54.85   0.722


Then with emmeans:

 emmeans(m, pairwise ~ f | g)

$emmeans g = A: f emmean SE df lower.CL upper.CL 0 -0.0646 0.19 76 -0.443 0.3138 1 -0.3313 0.19 76 -0.710 0.0471 g = B: f emmean SE df lower.CL upper.CL 0 -0.8891 0.19 76 -1.267 -0.5107 1 0.5209 0.19 76 0.143 0.8992 Confidence level used: 0.95$contrasts
g = A:
contrast estimate    SE df t.ratio p.value
0 - 1       0.267 0.269 76  0.993  0.3240

g = B:
contrast estimate    SE df t.ratio p.value
0 - 1      -1.410 0.269 76 -5.248  <.0001


My regrettably naive question is, what test is applied to generate the contrast read out here? Or more broadly, is this information made available in the emmeans output somewhere?