Testing
Testing
Interpretation (AI): HL
Hypothesis Testing using the Chi-squared
Distribution
Contents
Hypothesis Testing
Chi-squared Test for Independence
Goodness of Fit Test
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 1
Hypothesis Testing
Your notes
Language of Hypothesis Testing
What is a hypothesis test?
A hypothesis test uses a sample of data in an experiment to test a statement made
about the population
The statement is either about a population parameter or the distribution of the
population
The hypothesis test will look at the probability of observed outcomes happening under
set conditions
The probability found will be compared against a given significance level to determine
whether there is evidence to support the statement being made
The null hypothesis is denoted H and sets out the assumed population parameter
0
or distribution given that no change has happened
The alternative hypothesis is denoted H and sets out how we think the population
1
parameter or distribution could have changed
When a hypothesis test is carried out, the null hypothesis is assumed to be true and
this assumption will either be accepted or rejected
When a null hypothesis is accepted or rejected a statistical inference is made
A hypothesis test will always be carried out at an appropriate significance level
The significance level sets the smallest probability that an event could have
occurred by chance
Any probability smaller than the significance level would suggest that the event
is unlikely to have happened by chance
The significance level must be set before the hypothesis test is carried out
The significance level will usually be 1%, 5% or 10%, however it may vary
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 2
One-tailed Tests
What are one-tailed tests? Your notes
Two-tailed Tests
What are two-tailed tests?
A two-tailed test is used for testing:
Whether the population parameter has changed
Two-tailed tests can be used with:
Test for population mean of a normal distribution
Test to compare population means of two distributions
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 3
If the p-value is less than the significance level then the null hypothesis would be
rejected
The critical region is the range of values of the test statistic which will lead to the null Your notes
hypothesis being rejected
If the test statistic falls within the critical region then the null hypothesis would be
rejected
The critical value is the boundary of the critical region
It is the least extreme value that would lead to the rejection of the null hypothesis
The critical value is determined by the significance level
How should a conclusion be written for a hypothesis test?
Your conclusion must be written in the context of the question
Use the wording in the question to help you write your conclusion
If rejecting the null hypothesis your conclusion should state that there is sufficient
evidence to suggest that the null hypothesis is unlikely to be true
If accepting the null hypothesis your conclusion should state that there is not
enough evidence to suggest that the null hypothesis is unlikely to be true
Your conclusion must not be definitive
There is a chance that the test has led to an incorrect conclusion
The outcome is dependent on the sample
a different sample might lead to a different outcome
The conclusion of a two-tailed test can state if there is evidence of a change
You should not state whether this change is an increase or decrease
If you are testing the difference between the means of two populations then you
can only conclude that the means are not equal
You can not say which population mean is bigger
You’d need to use a one-tailed test for this
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 4
Chi-squared Test for Independence
Your notes
Chi-Squared Test for Independence
What is a chi-squared test for independence?
A chi-squared ( χ 2 ) test for independence is a hypothesis test used to test whether two
variables are independent of each other
This minimum number is called the degrees of freedom and is often denoted by ν
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 5
ν= m−1
( ) × n −1
( )
For example: If there are 5 rows and 3 columns then you only need to know 2 of the Your notes
values in 4 of the rows as the rest can be calculated using the totals
What are the steps for a chi-squared test for independence?
STEP 1: Write the hypotheses
H0 : Variable X is independent of variable Y
H1 : Variable X is not independent of variable Y
Make sure you clearly write what the variables are and don’t just call them X and
Y
STEP 2: Calculate the degrees of freedom for the test
For an m × n contingency table
STEP 3: Enter your observed frequencies into your GDC using the option for a 2-way
test
Enter these as a matrix
Your GDC will give you a matrix of the expected values (assuming the variables are
independent)
If any values are 5 or less then combine rows/columns and repeat step 2
Your GDC will also give you the χ² statistic and its p-value
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 6
There is insufficient evidence to suggest that variable X is not independent of
variable Y
Your notes
Therefore this suggests they are independent
How do I calculate the chi-squared statistic?
You are expected to be able to use your GDC to calculate the χ² statistic by inputting the
matrix of the observed frequencies
Seeing how it is done by hand might deepen your understanding but you are not
expected to use this method
STEP 1: For each observed frequency Oi calculate its expected frequency Ei
Assuming the variables are independent
Ei = P(X = x) × P(Y = y) × Total
Row Total× Column Total
Which simplifies to E
i
= Overall Total
Oi −Ei 2
χ 2calc = ∑
( )
Ei
You do not need to learn this formula as your GDC calculates it for you
To calculate the p-value you would find the probability of a value being bigger than your
χ² statistic using a χ² distribution with ν degrees of freedom
Worked Example
At a school in Paris, it is believed that favourite film genre is related to favourite
subject. 500 students were asked to indicate their favourite film genre and favourite
subject from a selection and the results are indicated in the table below.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 7
Maths 51 52 37 55
Geography 35 31 28 15
d) Write down the conclusion to the test. Give a reason for your answer.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 8
Your notes
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 9
Goodness of Fit Test
Your notes
Chi-Squared GOF: Uniform
What is a chi-squared goodness of fit test for a given
distribution?
A chi-squared ( χ 2 ) goodness of fit test is used to test data from a sample which
suggests that the population has a given distribution
This could be that:
the proportions of the population for different categories follows a given ratio
the population follows a uniform distribution
This means all outcomes are equally likely
What are the steps for a chi-squared goodness of fit test for a
given distribution?
STEP 1: Write the hypotheses
H0 : Variable X can be modelled by the given distribution
H1 : Variable X cannot be modelled by the given distribution
Make sure you clearly write what the variable is and don’t just call it X
STEP 2: Calculate the expected frequencies
Split the total frequency using the given ratio
For a uniform distribution: divide the total frequency N by the number of possible
outcomes k
STEP 3: Calculate the degrees of freedom for the test
For k possible outcomes
Degrees of freedom is ν =k −1
STEP 4: Enter the frequencies and the degrees of freedom into your GDC
Enter the observed and expected frequencies as two separate lists
Your GDC will then give you the χ² statistic and its p-value
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 10
If χ² statistic < critical value then accept H0
OR compare the p-value with the given significance level
Your notes
If p-value < significance level then reject H0
If p-value > significance level then accept H0
STEP 6: Write your conclusion
If you reject H0
There is sufficient evidence to suggest that variable X does not follow the given
distribution
Therefore this suggests that the data is not distributed as claimed
If you accept H0
There is insufficient evidence to suggest that variable X does not follow the
given distribution
Therefore this suggests that the data is distributed as claimed
Worked Example
A car salesman is interested in how his sales are distributed and records his sales
results over a period of six weeks. The data is shown in the table.
Week 1 2 3 4 5 6
Number of sales 15 17 11 21 14 12
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 11
Your notes
e) State the conclusion of the test. Give a reason for your answer.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 12
A chi-squared ( χ 2 ) goodness of fit test is used to test data from a sample suggesting
that the population has a binomial distribution
Your notes
You will either be given a precise binomial distribution to test B ( n , p with an
)
=n×∑
x⎯⎯ 1 fx
p=
n ∑f
What are the steps for a chi-squared goodness of fit test for a
binomial distribution?
STEP 1: Write the hypotheses
H0 : Variable X can be modelled by a binomial distribution
H1 : Variable X cannot be modelled by a binomial distribution
Make sure you clearly write what the variable is and don’t just call it X
If you are given the assumed value of p then state the precise distribution
B n, p
( )
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 13
Your GDC will then give you the χ² statistic and its p-value
If you accept H0
There is insufficient evidence to suggest that variable X does not follow the
binomial distribution B n p
( , )
Worked Example
A stage in a video game has three boss battles. 1000 people try this stage of the
video game and the number of bosses defeated by each player is recorded.
A χ 2 goodness of fit test at the 5% significance level is used to decide whether the
number of bosses defeated can be modelled by a binomial distribution with a 20%
probability of success.
a) State the null and alternative hypotheses.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 14
Your notes
b) Assuming the binomial distribution holds, find the expected number of people that
would defeat exactly one boss.
d) State the conclusion of the test. Give a reason for your answer.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 15
Your notes
x⎯⎯ =
∑fx n
= n − 1 s 2n
∑f and s 2
n −1
What are the steps for a chi-squared goodness of fit test for a
normal distribution?
· STEP 1: Write the hypotheses
H0 : Variable X can be modelled by a normal distribution
H1 : Variable X cannot be modelled by a normal distribution
Make sure you clearly write what the variable is and don’t just call it X
If you are given the assumed values of μ and σ then state the precise distribution
N μ, σ2
( )
Find the probability of the outcome using the normal distribution P ( a <X <b )
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 16
( <
Beware of unbounded inequalities P X b or P X a for the class
) ( > )
You will have to combine rows/columns if any expected values are 5 or less
STEP 3: Calculate the degrees of freedom for the test
For k class intervals (after combining expected values if needed)
Degrees of freedom is
If you accept H0
There is insufficient evidence to suggest that variable X does not follow the
normal distribution N μ σ 2
( , )
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 17
Worked Example
300 marbled ducks in Quacktown are weighed and the results are shown in the table Your notes
below.
m < 450 1
m ≥ 570 9
A χ 2 goodness of fit test at the 10% significance level is used to decide whether the
mass of a marbled duck can be modelled by a normal distribution with mean 520 g
and standard deviation 30 g.
a) Explain why it is necessary to combine the groups m < 450 and 450 ≤ m < 470
<
to create the group m 470 with frequency 10.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 18
Your notes
e) Given that the critical value is 6.251, state the conclusion of the test. Give a reason
for your answer.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 19
m=
∑fx
∑f Your notes
What are the steps for a chi-squared goodness of fit test for a
Poisson distribution?
STEP 1: Write the hypotheses
H0 : Variable X can be modelled by a Poisson distribution
H1 : Variable X cannot be modelled by a Poisson distribution
Make sure you clearly write what the variable is and don’t just call it X
If you are given the assumed value of m then state the precise distribution
Po m( )
You will have to combine rows/columns if any expected values are 5 or less
STEP 3: Calculate the degrees of freedom for the test
For k outcomes (after combining expected values if needed)
Degree of freedom is
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 20
OR compare the p-value with the given significance level
If p-value < significance level then reject H0 Your notes
If p-value > significance level then accept H0
STEP 6: Write your conclusion
If you reject H0
There is sufficient evidence to suggest that variable X does not follow the
Poisson distribution Po m ( )
If you accept H0
There is insufficient evidence to suggest that variable X does not follow the
Poisson distribution Po m ( )
Worked Example
A parent claims the number of messages they receive from their teenage child within
an hour can be modelled by a Poisson distribution. The parent collects data from 100
one hour periods and records the observed frequencies of the messages received
from the child. The parent calculates the mean number of messages received from
the sample and uses this to calculate the expected frequencies if a Poisson model is
used.
0 9 7.28
1 16 a
2 23 24.99
3 22 21.82
4 16 14.29
5 14 7.49
6 or more 0 b
A χ² goodness of fit test at the 10% significance level is used to test the parent’s
claim.
a) Write down null and alternative hypotheses to test the parent’s claim.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 21
Your notes
b) Show that the mean number of messages received per hour for the sample is 2.62.
© 2025 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 22