4.11 Hypothesis testing: chi-squared and t-tests

4.11 Hypothesis testing: chi-squared and t-tests

IB Maths: Applications and Interpretation SL: Revision notes

Studying this course? Keep your progress in one place.

Key facts

  • Reject H0H_0 if the pp-value is less than the significance level; otherwise do not reject.
  • Never say H0H_0 is proved or accepted: say there is, or is not, enough evidence.
  • χ2\chi^2 independence: E=row total×column totalgrand totalE=\frac{\text{row total}\times\text{column total}}{\text{grand total}} and ν=(rows−1)(columns−1)\nu=(\text{rows}-1)(\text{columns}-1).
  • Goodness of fit: E=total×probabilityE=\text{total}\times\text{probability} and ν=n−1\nu=n-1.
  • The pooled two-sample tt-test compares two means, assuming normal populations with equal variances.

Hypotheses and p-values

A test asks whether sample data give enough evidence against the null hypothesis, judged by the pp-value.

The null hypothesis H0H_0 is the claim being tested; the alternative hypothesis H1H_1 is accepted if there is enough evidence against H0H_0 (two-tailed with ≠\ne, one-tailed with >> or <<).

The significance level is the probability of rejecting H0H_0 when it is true (1%, 5% or 10%). The pp-value is the probability of a result at least as extreme as observed, if H0H_0 is true.

If p<p< significance level, reject H0H_0; otherwise do not reject H0H_0. Conclude in context.

  1. 1

    State H0 and H1

    in context

  2. 2

    Choose the significance level

    as given in the question

  3. 3

    Use the GDC

    to find the test statistic and p-value

  4. 4

    Compare

    p with the significance level

  5. 5

    Conclude in context

    reject or do not reject H0

Steps of any hypothesis test

p=0.03p=0.03 at the 5% level. The decision is...

Chi-squared test for independence

Compare observed with expected frequencies in a contingency table.

The χ2\chi^2 test for independence tests whether two categorical variables are associated. H0H_0: independent. H1H_1: associated.

Data are a contingency table of observed frequencies OO. The expected frequency is E=row total×column totalgrand totalE=\frac{\text{row total}\times\text{column total}}{\text{grand total}}, and χ2=∑(O−E)2E\chi^2=\sum\frac{(O-E)^2}{E} with degrees of freedom ν=(rows−1)(columns−1)\nu=(\text{rows}-1)(\text{columns}-1).

Tables have at most 4 rows or columns and ν>1\nu>1. Use the GDC. Only upper-tail tests are used: reject H0H_0 if χ2\chi^2 exceeds the critical value, or p<p< the level.

246810120.10.20.30.40.5xycritical value 5.991χ² density, ν = 2
Chi-squared distribution with 2 degrees of freedom: the shaded upper tail is the 5% rejection region, beyond the critical value 5.991.
  • ExpectedE=row total×column totalgrand totalE=\dfrac{\text{row total}\times\text{column total}}{\text{grand total}}
  • Degrees of freedomν=(rows−1)(columns−1)\nu=(\text{rows}-1)(\text{columns}-1)

Worked example

Year 1010 travel (walk, bus, car): 20,30,2520,30,25. Year 1111 travel: 30,25,2030,25,20. Test for an association at the 5%5\% level.

A 3 by 4 contingency table has how many degrees of freedom?

Chi-squared goodness of fit

Compare observed frequencies with those expected if the data followed the stated distribution.

The χ2\chi^2 goodness of fit test tests whether data fit a stated distribution. H0H_0: the data fit (for example, equally likely categories). H1H_1: they do not.

Find expected frequencies as total ×\times probability of each category. At SL the degrees of freedom for nn categories are ν=n−1\nu=n-1. Then χ2=∑(O−E)2E\chi^2=\sum\frac{(O-E)^2}{E}; compare with the critical value, or pp with the level.

02468101214123456FaceFrequency
  • Observed
  • Expected
Illustrative values: 60 rolls of a die, observed against the 10 expected for each face if it is fair.
  • Expectedtotal ×\times probability
  • Degrees of freedomν=n−1\nu=n-1

Worked example

200200 customers choose among 44 desserts: 68,52,44,3668,52,44,36. Test at 5%5\% whether the desserts are equally likely to be chosen.

5 categories in a goodness of fit test. ν=\nu=

The t-test for two means

The pooled two-sample tt-test checks whether two population means differ.

The tt-test uses sample means to test whether two population means differ. In examinations the samples are unpaired, the population variance is unknown and you assume equal variances, so the pooled two-sample tt-test is used on your GDC. Both populations must be normally distributed.

H0:μA=μBH_0:\mu_A=\mu_B, with H1:μA≠μBH_1:\mu_A\ne\mu_B (two-tailed) or H1:μA>μBH_1:\mu_A>\mu_B (one-tailed). Enter the means, standard deviations and sizes and choose the correct alternative; the GDC returns tt and pp.

303540455055606570750.020.040.060.08xyPopulation APopulation B
Illustrative values: two normal populations with equal spread (σ = 5) and means 50 and 56. The t-test asks whether the means really differ.

Two-tailed

H1H_1:
μA≠μB\mu_A\neq\mu_B
Wording:
"different from"

One-tailed

H1H_1:
μA>μB\mu_A>\mu_B or μA<μB\mu_A<\mu_B
Wording:
"greater than"

Worked example

Class A (1212 students, mean 68.468.4, standard deviation 7.27.2) and class B (1010 students, mean 62.162.1, standard deviation 8.18.1). Test at 5%5\% whether class A has a higher mean.

"Is the mean different from 50?" calls for a...

Interpreting results

A significant result is evidence, not proof; the assumptions of each test must hold.

Write conclusions in context and compare pp with the given significance level: the same pp can be significant at 10% but not at 5% (for example p=0.0677p=0.0677).

  • A significant result is evidence of an effect, not proof, and says nothing about its size or importance.
  • For χ2\chi^2 tests, expected frequencies of 5 or less make the test unreliable; categories may need combining.
  • The tt-test needs normal populations with equal variances.
  • A larger sample makes it easier to detect a real difference.

Do not use a two-tailed test when only one direction was predicted in advance, and do not change the level after seeing the result.

00.020.040.060.080.10.120.145%p = 0.067710%
A p-value of 0.0677 is below the 10% level but above the 5% level, so the conclusion depends on the level given. Shaded: significant at 5%.

Chi-squared

Needs:
Expected frequencies all above 5
Data:
Categorical data

t-test

Needs:
Normal populations, equal variances
Data:
Numerical data

A significant result shows...

Try an exam question

A die is rolled 120120 times with results for 11 to 66 of 25,17,15,23,24,1625,17,15,23,24,16. Test at the 5%5\% level whether the die is fair. The critical value for ν=5\nu=5 is 11.0711.07.

[4 marks]

That's the notes covered.

Carry on to the next subtopic.

Try a question

Write down the number of degrees of freedom for the test.

1 mark, marked against the mark scheme

Revision notes