t-tests: one-sample and two-sample
6 min read
Short answer
When the population standard deviation is unknown, replace by the sample and use the distribution with degrees of freedom: . For two groups, (Welch).
Why t instead of z
Estimating by adds uncertainty, so the statistic has heavier tails than a normal. The distribution captures that, with the effect fading as grows: at 30 degrees of freedom it is already close to normal.
Assumptions
The data should be roughly normal, or the sample large enough for the central limit theorem to help; observations must be independent. For two samples, the groups are independent unless the data are paired, in which case test the differences with a one-sample .
Worked example
A sample of has and . Test against at 5%.
, so with degrees of freedom. The two-sided critical value is . Since , fail to reject ().
Try it yourself
Which t-test fits blood pressure measured on the same 20 patients before and after a drug?
Show the answer
A paired test: compute the 20 differences and run a one-sample -test of the mean difference against , with degrees of freedom.
Keep going with practice
Vidi's variance and standard deviation lessons are the groundwork for the s in every t statistic.