Topics / Chapter 6
Is the difference real?
To decide whether an observed difference is real or due to chance, knowing how likely you are to be wrong.
Think like a court
A new wheat variety yielded 35 kg/da more than the old one in a trial. Does the difference come from the new variety really being better, or from natural differences between plots, in other words from chance?
A hypothesis test approaches this question like a court. The accused is innocent until proven guilty. In a test, likewise, the claim “there is no difference” is accepted until shown otherwise:
- Null hypothesis (): there is no difference. The true means of the varieties are equal; the difference you see is due to chance.
- Alternative hypothesis (): there is a difference.
If the data show a difference too large to be consistent with “no difference”, is rejected. If the evidence is insufficient, cannot be rejected. That does not mean is true. Just as an acquittal doesn’t mean “definitely innocent”, it only means “not enough evidence to show a difference”.
A test takes five steps
- State the hypotheses. , .
- Choose the significance level (). Usually 5%. This means keeping the risk of “declaring a difference when there is none” at 5% at most.
- Calculate the test statistic. A number measuring how large the observed difference is compared with the variability expected by chance: t, χ² or F.
- Compare it with the table value. If the calculated value exceeds the critical value, you are in the rejection region.
- Make the decision and state what it means in practice. “H₀ was rejected” is not enough: write something like “the new variety yielded significantly more than the old one at the 5% level”.
A decision can go wrong in two ways
| Really no difference ( true) | Really a difference ( false) | |
|---|---|---|
| H₀ rejected | Type I error (probability ). You think an ineffective fertilizer works and recommend it to farmers. | Correct decision |
| H₀ not rejected | Correct decision | Type II error. You miss a genuinely better variety. |
Making smaller (choosing 1%) reduces Type I errors but raises the risk of missing real differences. The way to reduce both is to collect more data with more replicates.
What a p-value does and doesn’t tell you
p-value: the probability of seeing a difference at least this large by chance alone, if there were really no difference. If p = 0.02, in a world with no difference you would see this result in only 1 trial out of 50. A result that rare is good reason to doubt the claim of “no difference”.
If the p-value is below α, is rejected. This gives the same decision as comparing with the table value; it just carries more information.
What a p-value doesn’t say: it does not mean “the probability that H₀ is true is 2%”. Nor does it show how large or important the difference is. In a trial with thousands of plots even a 2 kg/da difference can be “statistically significant”, yet it means nothing to a farmer. Always report statistical significance together with the size of the difference.
Two-tailed or one-tailed?
If you are only asking “is there a difference?”, you use a two-tailed test: the difference could go either way. If the question had a direction before the trial was set up (“does this fertilizer increase yield?”), a one-tailed test can be used. Choosing the direction after looking at the data is cheating, because it artificially halves the p-value.
Which test?
| Question | Data | Test |
|---|---|---|
| Does a group’s mean differ from a given value? | Measurements | One-sample t test |
| Do the means of two independent groups differ? | Measurements | Independent two-sample t test |
| Do two measurements on the same units differ? | Paired measurements | Paired t test |
| Do the means of three or more groups differ? | Measurements | Analysis of variance |
| Do counts fit the expected ratios? | Counts | Chi-square goodness-of-fit test |
| Are two classification traits related? | Counts | Chi-square test of independence |
| Do two measurements change together? | Pairs of measurements | Correlation |
t tests
The logic of a t test is always the same: observed difference ÷ variability expected by chance. As the numerator grows or the denominator shrinks, t grows and the difference becomes harder to explain by chance. The denominator (the standard error) shrinks in two ways: with less variable data or with more observations.
Why is the paired test more powerful? When you compare two halves of the same plot, differences in soil, slope and moisture between plots affect both measurements the same way. Taking differences removes that variability from the calculation, and the fertilizer’s effect shows more clearly. In the “Paired” example below the differences are only 2–5 cm, but all in the same direction, so t comes out very large.
Question: Do the means of two independent groups (two varieties, two regions) differ?
Example: Two wheat varieties were each tested in eight plots (kg/da). Do their yields differ?
n = 8, mean 532.13
n = 8, mean 494.88
The red area is the rejection region (α = 0.05). The green line is the value calculated from your data.
H₀ rejected: the difference is significant
The difference between the two group means (37.25) is statistically significant. It cannot be explained by chance.
p-value = 0.0021 (significant at 1%, **)
How was it calculated?
= 3.768
Compute the mean and variance of each group.
Since the variances are assumed equal, the two variances are pooled.
Standard error of the difference:
How many standard errors is the difference between the two means?
Degrees of freedom n₁ + n₂ − 2 = 14.
Compare the calculated value with the table (critical) value.
The calculated value is in the rejection region: H₀ is rejected. The p-value (0.0021) is smaller than α = 0.05.
Confidence interval
A hypothesis test answers “is there a difference?” with yes or no. A confidence interval answers “in what range does the true value most probably lie?”, which is usually more informative. In a one-sample test, if the 95% confidence interval does not contain the tested value (), a two-tailed test at the 5% level also rejects . The two methods reach the same conclusion by different routes.
Chi-square tests
When the data are counts rather than measurements (how many plants got sick, how many seeds were yellow), means can’t be compared. Instead, the observed counts are compared with the expected counts:
The larger the gap between observed (O) and expected (E) in each class, the larger . Because the difference is squared, its direction doesn’t matter; that is why the chi-square test is always right-tailed.
- Goodness-of-fit test: do the counts fit the ratios a theory predicts? Mendel’s 9:3:3:1 ratio is the classic example, and plant breeders still use it to check segregation ratios.
- Test of independence: do two classification traits affect each other? Does the disease rate vary by variety?
Question: Do the observed counts fit the ratios the theory expects?
Example: Mendel’s pea experiment: counts of round-yellow, round-green, wrinkled-yellow and wrinkled-green seeds. Inheritance theory predicts a 9:3:3:1 ratio. Do the data fit?
| Class | Observed (O) | Expected ratio | Expected (E) | Delete |
|---|---|---|---|---|
| 312.75 | ||||
| 104.25 | ||||
| 104.25 | ||||
| 34.75 |
The red area is the rejection region (α = 0.05). The green line is the value calculated from your data.
H₀ not rejected: the difference is not significant
The gap between observed and expected counts can be explained by chance; the data fit the ratios.
p-value = 0.9254
How was it calculated?
= 0.47
Expected frequencies: the total count (556) is shared out according to the ratios.
In each class, square the gap between observed and expected, divide by expected and add up.
Degrees of freedom = number of classes − 1 = 3. The chi-square test is always right-tailed: only large deviations indicate a poor fit.
Compare the calculated value with the table (critical) value.
The calculated value is in the acceptance region: H₀ cannot be rejected. The p-value (0.9254) is not smaller than α = 0.05.
Watch out: the chi-square test uses raw counts, not percentages. If many cells have an expected frequency below 5, the result is unreliable; similar classes need to be merged.