All revision notes topics

4.11 Hypothesis testing: chi-squared and t-testsIB Maths: Applications and Interpretation SL: Revision notes

Section 1

Hypotheses, significance levels and p-values

A hypothesis test decides whether sample data give enough evidence against a claim.

  • The null hypothesis H0H_0 is the claim being tested, written as an equation, such as μA=μB\mu_A=\mu_B, or in words (for example 'the variables are independent').
  • The alternative hypothesis H1H_1 is what we accept if there is enough evidence against H0H_0. For a mean it may be ≠\neq (two-tailed) or >> or << (one-tailed).
  • The significance level is the probability of rejecting H0H_0 when it is true. Common levels are 1%1\%, 5%5\% and 10%10\%.
  • The pp-value is the probability of getting a result at least as extreme as the one observed, if H0H_0 is true. Decision rule: if p<p< significance level, reject H0H_0; if p>p> significance level, do not reject H0H_0. State the conclusion in context. Say 'there is evidence that…' or 'there is not enough evidence that…'. Never say that H0H_0 has been proved.
Key termsnull hypothesisalternative hypothesissignificance levelp-valueone-tailedtwo-tailed
Common mistake

Writing 'accept H0H_0' or 'H0 is true'. Say you do not reject H0H_0 and that there is not enough evidence.

Section 2

The chi-squared test for independence

The χ2\chi^2 test for independence tests whether two categorical variables are associated. H0H_0: the variables are independent. H1H_1: they are not independent (associated). Data are in a contingency table of observed frequencies OO. The expected frequency in each cell, if H0H_0 is true, is E=row total×column totalgrand total.E=\frac{\text{row total}\times\text{column total}}{\text{grand total}}. The statistic is χ2=∑(O−E)2E\chi^2=\sum\frac{(O-E)^2}{E} and the degrees of freedom are ν=(rows−1)(columns−1)\nu=(\text{rows}-1)(\text{columns}-1). In examinations tables have at most 44 rows or columns, ν>1\nu>1, and you use your GDC for χ2\chi^2 and the pp-value. Only upper-tail tests are used: reject H0H_0 if χ2\chi^2 is greater than the critical value (given), or if p<p< the significance level. Example: Year 1010 travel 20,30,2520,30,25 and Year 1111 travel 30,25,2030,25,20 (walk, bus, car). The expected values are 25,27.5,22.525,27.5,22.5 in both rows, ν=2\nu=2, χ2=3.01\chi^2=3.01 and p=0.222>0.05p=0.222>0.05, so there is no evidence of an association.

Key termscontingency tableobserved frequencyexpected frequencydegrees of freedomcritical value
Exam tip

Check that every expected frequency is greater than 55 before using the test.

Section 3

The chi-squared goodness of fit test

The χ2\chi^2 goodness of fit test tests whether data fit a stated distribution. H0H_0: the data fit the distribution (for example, equally likely categories). H1H_1: they do not. Find expected frequencies from the distribution: total ×\times probability of each category. For nn categories, at SL the degrees of freedom are ν=n−1\nu=n-1. Then χ2=∑(O−E)2E\chi^2=\sum\frac{(O-E)^2}{E} and compare with the critical value, or compare pp with the significance level. Example: 200200 customers choose among 44 desserts: 68,52,44,3668,52,44,36. If the choices are equally likely, each expected frequency is 2004=50\frac{200}{4}=50. χ2=182+22+(−6)2+(−14)250=11.2\chi^2=\frac{18^2+2^2+(-6)^2+(-14)^2}{50}=11.2 and ν=3\nu=3. At 5%5\% the critical value is 7.817.81. Since 11.2>7.8111.2>7.81 (and p=0.0107<0.05p=0.0107<0.05), reject H0H_0: there is evidence that the desserts are not chosen equally often.

Key termsgoodness of fitexpected frequencies
Common mistake

Using ν=(rows−1)(columns−1)\nu=(\text{rows}-1)(\text{columns}-1) for goodness of fit. At SL it is the number of categories minus 11.

Section 4

The t-test for comparing two means

The tt-test uses the sample means to test whether the means of two populations 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. The test needs the data in both populations to be normally distributed. Hypotheses: H0:μA=μBH_0:\mu_A=\mu_B and H1:μA≠μBH_1:\mu_A\neq\mu_B (two-tailed), or H1:μA>μBH_1:\mu_A>\mu_B (one-tailed). Enter the sample means, sample standard deviations and sample sizes (or the raw data) into the GDC and choose the correct alternative. The GDC returns tt and the pp-value for the alternative chosen. Compare pp with the significance level. 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). One-tailed test, H1:μA>μBH_1:\mu_A>\mu_B: p=0.0339<0.05p=0.0339<0.05, reject H0H_0. Two-tailed: p=0.0677>0.05p=0.0677>0.05, do not reject H0H_0. The one-tailed pp-value is half the two-tailed value when the sample difference is in the direction of H1H_1.

Key termst-testpooledunpaired
Exam tip

Choose one-tailed or two-tailed from the wording: 'greater than' is one-tailed, 'different from' is two-tailed.

Section 5

Interpreting results and limitations

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

  • A significant result is evidence of an effect, not proof, and it does not say how large or important the effect is.
  • For χ2\chi^2 tests, expected frequencies of 55 or less make the test unreliable, so categories may need combining.
  • The tt-test needs the populations to be normal with equal variances; if not, the conclusion may be unreliable.
  • 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 significance level after seeing the result.
Key termssignificantlimitation
Common mistake

Choosing the significance level to get the conclusion you want. Use the level given in the question.

That's the notes covered.

Carry on to the next subtopic.

Exam questions on 4.11 Hypothesis testing: chi-squared and t-tests

  1. One hundred and fifty students in Year 1010 and Year 1111 were each asked how they usually travel to school. Year 1010 (75 students): walk 2020, bus 3030, car 2525. Year 1111 (75 students): walk 3030, bus 2525, car 2020. A χ2\chi^2 test for independence is to be carried out between year group and method of travel.
    Use your GDC to find the pp-value of the test, and state your conclusion at the 5%5\% significance level.2 marks
  2. A café sells four desserts. The manager claims that customers choose the four desserts equally often. In one week, 200200 customers chose cheesecake 6868, brownie 5252, sorbet 4444 and tart 3636 times. A χ2\chi^2 goodness of fit test is used to test the claim.
    Write down the null and alternative hypotheses, and the number of degrees of freedom.2 marks
  3. A teacher compares the scores of two classes in the same test. Class A has 1212 students with mean score 68.468.4 and sample standard deviation 7.27.2. Class B has 1010 students with mean score 62.162.1 and sample standard deviation 8.18.1. The scores in both classes are normally distributed with equal variances. Use a pooled two-sample tt-test on your GDC.
    Test, at the 5%5\% significance level, whether the mean score of class A is greater than that of class B. State the hypotheses, the pp-value and your conclusion.3 marks
See the full worksheet

Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).