Choosing the case and reading t.test(x, y)
◈ 7 cardsWelch, pooled, paired or z — the wording decides; R’s t.test(x, y) is Welch with fractional df by default, var.equal = TRUE pools, paired = TRUE takes differences, and each printout maps line by line onto the hand answer.
Four procedures, one decision tree
Every two-mean question resolves into one of four cases, and the wording settles it in two questions:
- Is each observation matched with one in the other sample (same unit twice, matched pairs, twins)? → Paired: differences, one-sample t, .
- Otherwise the samples are independent. Are the population SDs given? → z with . Does the question say the variances are equal? → Pooled t, . Neither? → Welch t, by hand.
The default — nothing said about the variances, SDs from the samples — is Welch. That is also R’s default.
Reading the three printouts
The paper prints R output and asks you to interpret it. Here are the module’s three cases, each from vectors holding exactly the data used by hand.
Welch, one-sided — the billing systems of L11.3:
> t.test(current, new, alternative = "greater")
Welch Two Sample t-test
data: current and new
t = 2.0373, df = 19.62, p-value = 0.02767
alternative hypothesis: true difference in means is greater than 0
sample estimates:
mean of x mean of y
31.2 24.1
t = 2.0373 is the hand 2.037. df = 19.62 is Satterthwaite — not the hand 9 — and p-value = 0.02767 is the exact upper tail on that df, inside the hand bracket and smaller than it would be on 9 df (0.0360). The title line tells you which case R ran. Decision: yours to write — , reject.
Pooled, two-sided — the grocery chains of L11.5, with var.equal = TRUE:
> t.test(chainA, chainB, var.equal = TRUE)
Two Sample t-test
t = 1.6693, df = 18, p-value = 0.1124
95 percent confidence interval:
-0.9567542 8.3567542
The title drops Welch; df = 18 is exactly ; the two-sided sits inside the hand bracket ; the interval is the hand to more digits. At 10 % two-sided: , do not reject — as by hand.
Paired — the eight stores of L11.6, with paired = TRUE:
> t.test(after, before, paired = TRUE)
Paired t-test
t = 3.5355, df = 7, p-value = 0.009527
95 percent confidence interval:
0.8279582 4.1720418
sample estimates:
mean difference
2.5
df = 7 — pairs minus one; p-value = 0.009527, inside the hand ; the interval is ; mean difference 2.5 is . The order of the arguments sets the sign: t.test(after, before, …) gives after − before.
The hand df and R’s df are both conventions
When R prints df = 19.62 and your paper says , neither is wrong. R uses an approximation that is closer to the true sampling distribution; the min rule is a deliberate, conservative simplification that can be applied from a printed table. The exam wants the min rule and — when it shows a printout — a sentence saying that R’s larger df gives a smaller p. If the two decisions ever differ, say so and report both.
The reading checklist
From any two-sample printout: read the title (Welch / Two Sample / Paired) to identify the case; read the alternative hypothesis line for the tail; compare the printed df with the one you would write; read and ; halve a two-sided only if your question is one-sided and the estimate leans the predicted way; write the decision and the sentence yourself.