Module 1 · 14 min read · Free chapter
Testing differences: the t-test and analysis of variance
The t-test, devised by Gosset in 1908 under the name Student, asks whether the difference between two means is larger than chance would produce, using the standard error and degrees of freedom. When there are more than two groups, Fisher's analysis of variance compares variance between groups with variance within them in one F test, and two-way ANOVA also tests interaction.
Start from zero: is the difference real?
A researcher gives a language test to 15-year-old boys and girls. The girls' average is a little higher. Does this mean girls of that age really have better language ability, or did the difference arise by chance, because a different sample might have shown the opposite?
This is the central question of inferential statistics. A difference is called significant when it is unlikely to be due to chance and so probably reflects a true difference between populations. It is called non-significant when sampling fluctuation could easily explain it.
The tools for answering it are the subject of this chapter: the standard error, the t ratio, the null hypothesis and levels of significance, and analysis of variance for more than two groups. The syllabus names the t-test and two-way ANOVA; both rest on the same logic of comparing a difference with the error expected by chance.
Deep dive: standard error, the t ratio and degrees of freedom
Every obtained score carries error. Part of it is measurement error, because no test is perfectly reliable. Part is statistics error, because a sample never perfectly represents its population.
Statistics error has two faces:
- Sampling error: the difference between the population mean and a sample mean. The smaller it is, the better the sample represents the population.
- Standard error: suppose 20 random samples of high-school students in a district each give a mean IQ. The means will differ a little. Their distribution is a sampling distribution, and its standard deviation is the standard error of the mean.
For a large sample (N above 30), the standard error of the mean is SD divided by the square root of N. For a small sample (about 30 or fewer), N - 1 replaces N. Because N sits in the denominator, a bigger sample gives a smaller standard error and a more dependable mean.
The t ratio is the deviation of a sample statistic from its parameter divided by its standard error, like a z score for statistics. It was devised by W.S. Gosset in 1908, who wrote under the pen name 'Student', so it is also called Student's t. The t distribution is a family of curves: it is more leptokurtic in small samples, and as the sample grows it approaches the normal curve, where the values for the 0.05 and 0.01 levels settle at 1.96 and 2.58. In small samples the table values are larger, so a bigger t is needed to reach significance.
Degrees of freedom are the number of values free to vary once restrictions are fixed. If four numbers must add up to 20, three can be chosen freely but the fourth is then decided, so one degree of freedom is lost. Each restriction removes one: N - 1 for a mean or SD, N - 2 for a correlation, N1 + N2 - 2 for two independent samples, and N - 1 for correlated samples.
Deep dive: testing the difference between two means
To test whether two group means differ, the researcher needs the standard error of the difference between means. For two large independent samples it is the square root of (SD1 squared / N1 + SD2 squared / N2). The critical ratio (CR) is the difference between the means divided by this standard error, which is simply a z score for the difference.
The logic runs through the null hypothesis (H0): there is no true difference between the population means, and any sample difference is due to chance. It works like the rule that a person is innocent until proved guilty; the researcher must bring enough evidence to reject it. If H0 is rejected, the alternative hypothesis is accepted.
Levels of significance are the standards for that decision; 0.05 and 0.01 are most used. Between plus and minus 1.96 lie 95 percent of cases under the normal curve, and between plus and minus 2.58 lie 99 percent. A CR or t above 1.96 rejects H0 at the 0.05 level; above 2.58, at the 0.01 level.
- Worked example: two large groups have means of 52 and 48, and the standard error of the difference is 1.6. Then t = 4 / 1.6 = 2.5. It exceeds 1.96 but not 2.58, so the difference is significant at the 0.05 level but not at the 0.01 level.
Two further choices shape the test:
- Two-tailed or one-tailed: a two-tailed test asks whether groups differ in either direction. A one-tailed test is used when only one direction matters, such as whether motivation raises problem-solving scores, since a loss is not expected.
- Independent or correlated: means are independent when computed from different random samples. They are correlated when one group is tested twice, before and after, or when matched pairs are used; then the formula subtracts a term based on the correlation between the two sets of scores.
This gives four cases, each with its own formula: two large independent samples, two small independent samples, two large correlated samples and two small correlated samples. The usual steps are:
- Step 1: state H0 and the alternative hypothesis.
- Step 2: fix the level of significance and decide on a one-tailed or two-tailed test.
- Step 3: identify large or small, independent or correlated samples, and compute CR or t.
- Step 4: find degrees of freedom (N1 + N2 - 2 for independent, N - 1 for correlated samples), compare with the table and interpret.
Deep dive: one-way analysis of variance
The t-test compares only two means. With three groups, A, B and C, three separate t-tests would be needed; with eight groups, 28. The t-test also ignores spread: two groups of five with the same mean reaction time of 17 milliseconds can differ sharply in how scattered their scores are.
Analysis of variance (ANOVA) solves both problems. It was devised by Ronald Fisher, often called the father of modern statistics in the social and behavioural sciences, and first reported in 1923, with early applications in agriculture. ANOVA divides the variation in experimental data into parts, each assignable to a known source. Its statistic is:
- F = variance between groups / variance within groups.
Variance is the square of the standard deviation: the average of squared deviations from the mean. It is always positive and does not change when a constant is added to every score. The steps of one-way ANOVA are:
- Step 1: compute the correction term, the square of the grand total divided by N.
- Step 2: compute the total sum of squares (SST).
- Step 3: compute the sum of squares among groups (SSA).
- Step 4: find the sum of squares within groups, SSW = SST - SSA.
- Step 5: divide each by its degrees of freedom (k - 1 among groups, N - k within groups, where k is the number of groups) to get mean squares, and divide the first by the second to get F.
ANOVA assumes that the dependent variable is normally distributed, that the groups have homogeneous variance, and that samples are randomly drawn. F and t are linked: for two groups, F = t squared. A significant F is a global finding: it says the means are not all equal, but not which ones differ, so t-tests or post-hoc comparisons must follow.
Deep dive: two-way ANOVA and factorial designs
Often a researcher wants to study two independent variables at once. A drug company may want the separate effect of drug A on smoking, the separate effect of drug B, and their joint effect. A psychologist may study the effect of family type (joint or nuclear) and gender (boys or girls) on the cognitive development of children aged 3 to 5.
Such a study is a factorial design. With two variables of two levels each it is a 2 x 2 design; with socio-economic status at three levels (high, average, low) and gender at two, it is a 3 x 2 design. One-way ANOVA cannot handle it, so the analysis is done column-wise and row-wise: two-way ANOVA.
Two-way ANOVA tests three things:
- Main effect of A: for example, do students of high, average and low socio-economic status differ in intelligence?
- Main effect of B: do boys and girls differ?
- Interaction A x B: does the effect of one variable depend on the level of the other?
| Source of variance | What its F ratio tests |
|---|---|
| Factor A | Separate effect of the first independent variable |
| Factor B | Separate effect of the second independent variable |
| Interaction A x B | Joint effect beyond the two separate effects |
| Within groups (error) | The chance variation each F is compared with |
In one worked example, a 2 x 2 study of sex and intelligence on mathematical creativity with 40 students gave F = 19.42 for sex and 23.49 for intelligence, both above the table value of 7.42 for 1 and 36 degrees of freedom at the 0.01 level, while the interaction F was not significant even at 0.05. So both main effects were real, but their joint effect added nothing.
Deep dive: reading an interaction
Without interaction, two-way ANOVA would add little over two one-way analyses. An interaction means the joint effect of two variables differs from what their separate effects predict. Two fertilisers, urea and phosphate, may each help crops grow; used together in the right ratio they may raise growth greatly, or they may lower it. In the same way, two teaching methods that each work may, when combined, give much better results, or none.
A graph shows interaction clearly. Plot the cell means with one variable on the x-axis and a separate line for each level of the other:
- Parallel lines mean no interaction: the effect of one variable is the same at every level of the other.
- Crossing or converging lines mean an interaction: the effect of one variable changes with the level of the other.
Consider a study of personality type and anxiety on the academic achievement of 20 undergraduates. Extroverts scored 13.60 under high anxiety and 14.20 under low anxiety; introverts scored 15.40 under high anxiety and 12.20 under low anxiety. The overall means for extroverts (13.90) and introverts (13.80) were almost equal, yet the interaction was significant at the 0.01 level. On a graph the lines cross: high anxiety helped introverts but slightly hurt extroverts.
This example carries the key lesson. If only the main effect of personality had been read, the conclusion would be 'no difference', which hides a real pattern. So a significant interaction is interpreted first, and main effects are read in its light.
Critiques and debates: assumptions, errors and alternatives
The t-test and ANOVA are parametric tests. They assume a normally distributed dependent variable, interval-level data, adequate samples (more than 30 per group is recommended), independent observations except with paired data, random sampling and equal variances. If these fail, the results may be spurious.
When the assumptions are not met, non-parametric tests are used:
| Parametric test | Non-parametric alternative |
|---|---|
| Independent-samples t-test | Mann-Whitney U test |
| One-way independent ANOVA | Kruskal-Wallis test |
| Matched-pairs t-test | Wilcoxon test |
| Pearson correlation | Spearman correlation |
A common belief is that non-parametric tests are always less powerful, power being the ability to correctly reject a false null hypothesis. The non-parametric literature notes that this claim is often repeated without supporting evidence, and that the evidence for it is neither abundant nor conclusive.
Interpretation can also go wrong in two ways. A Type I error rejects a true null hypothesis, declaring a difference that is not real. A Type II error retains a false null hypothesis, missing a real difference; choosing a very strict level such as 0.001 raises its risk. ANOVA has its own limits: it is time-consuming, needs arithmetical skill, gives only a global answer, and grows harder to interpret as factors are added.
Indian application: reading a research report
These tests appear constantly in Indian research on education and development, and the unit examples themselves are built on Indian settings. A district IQ survey of high-school students uses the standard error to judge how far a sample mean represents the district. A field study of children aged 3 to 5 compares joint and nuclear families and boys and girls in a 2 x 2 design.
Reading such a report well means checking a few things:
- Which test fits the design? Two groups need a t-test; three or more, ANOVA; two factors, two-way ANOVA; pre- and post-tests on one group, the correlated formula.
- What were the degrees of freedom and level? A t of 2.1 is significant at 0.05 with large samples but may not be with very small ones.
- Was there an interaction? A finding such as 'nuclear-family children score higher' may hold only for one gender.
- Were assumptions met? Rural samples with skewed scores may need non-parametric tests.
- Significant or important? Statistical significance says a difference is unlikely to be chance, not that it is large enough to matter for policy.
A Mains answer that applies these checks to an Indian example, such as comparing learning outcomes across school types and genders, shows the examiner that the candidate understands the logic and not just the formula.
Writing a 20-mark answer and practice
Take the question: 'Discuss the logic of the t-test and two-way ANOVA. When would you prefer one over the other?' Use this frame:
- Introduction: inferential statistics asks whether a difference is real or due to chance; define the null hypothesis.
- Body heading 1, the t-test: standard error, Gosset 1908, degrees of freedom, critical values 1.96 and 2.58, independent and correlated cases, one worked number.
- Body heading 2, ANOVA: Fisher, F as between over within variance, why many t-tests are avoided, F = t squared for two groups.
- Body heading 3, two-way ANOVA: factorial designs, two main effects and the interaction, the crossing-lines graph.
- Critique: parametric assumptions, non-parametric alternatives, Type I and II errors, global F.
- Conclusion: the design decides the test: two groups t, more groups ANOVA, two factors two-way ANOVA.
These are practice questions written by us, not past papers. The UPSC questions on this topic are shown in the previous year questions panel.
| Angle | Question | Key points to cover |
|---|---|---|
| Concept (10 marks) | Explain standard error of the mean and its importance. | Sampling distribution; SD over root N; sample size. |
| Numerical (10 marks) | Means of 52 and 48 with a standard error of difference of 1.6: interpret. | t = 2.5; significant at 0.05, not 0.01. |
| Design (15 marks) | Why is ANOVA preferred over multiple t-tests? | 28 comparisons; spread; F ratio; post-hoc. |
| Interpretation (15 marks) | What is an interaction effect? Illustrate graphically. | Fertiliser example; parallel vs crossing lines; anxiety and personality. |
| Critique (10 marks) | When should non-parametric tests replace the t-test and ANOVA? | Assumptions; Mann-Whitney, Kruskal-Wallis, Wilcoxon; power debate. |
How to use this table: state the logic in one line, give the formula in words, add one number, and end with a limitation.
Quick revision
- Error = measurement error + statistics error (sampling error, standard error).
- Standard error of the mean = SD / root N; N - 1 for small samples; falls as N rises.
- t ratio: Gosset 1908 as 'Student'; t curve leptokurtic in small samples; 1.96 and 2.58 in large ones.
- df: N - 1 mean; N - 2 correlation; N1 + N2 - 2 independent; N - 1 correlated.
- H0: no true difference; innocent until proved guilty; CR = difference / SE of difference.
- Two-tailed vs one-tailed; independent vs correlated; four cases.
- ANOVA: Fisher, 1923, agriculture; F = between / within variance; eight groups need 28 t-tests.
- Assumptions: normality, equal variances, random samples; F = t squared for two groups; post-hoc after significant F.
- Two-way ANOVA: factorial 2 x 2 or 3 x 2; main effects A and B; interaction A x B; three F ratios.
- Interaction: parallel lines none, crossing lines present; read it first.
- Non-parametric: Mann-Whitney, Kruskal-Wallis, Wilcoxon, Spearman.