The Chi Square Test
Muhammad Shahid
Sr. lecturer IIN
Introduction
We often have occasions to make
comparisons between two characteristics
of something to see if they are linked or
related to each other.
One way to do this is to work out what we
would expect to find if there was no
relationship between them (the usual null
hypothesis) and what we actually observe.
Introduction
The test we use to measure the
differences between what is observed
and what is expected according to an
assumed hypothesis is called the chi-
square test.
For Example
Some null hypotheses may be:
– ‘there is no relationship between the height
of the post RN and Generic BSN students ’.
– ‘there is no connection between the size of
farm and the type of farm’
Important
The chi square test can only be used on
data that has the following
characteristics:
The frequency data must have a
The data must be in the form precise numerical value and must be
of frequencies organised into categories or groups.
The expected frequency in any one cell
of the table must be greater than 5.
The total number of observations must be
greater than 20.
Formula
χ 2 = ∑ (O – E)2
E
χ2 = The value of chi square
O = The observed value
E = The expected value
∑ (O – E)2 = all the values of (O – E) squared then added
together
Step 01
Write down the NULL HYPOTHESIS
and ALTERNATIVE HYPOTHESIS
and set the LEVEL OF
SIGNIFICANCE.
NH ‘ there is no association between gender and
hypertensive status
AH ‘there is association between gender and
hypertensive status
We will set the level of significance at 0.05.
Construct a table with the information you have observed
or obtained.
Observed Frequencies (O)
HTN Males Females
Status
N 50 50
PH 20 40
H 10 30
Step 02 & 03 significance level
Look up the significance tables. These will
tell you whether to accept the null
hypothesis or reject it.
The number of degrees of freedom to use is: the
number of rows in the table minus 1, multiplied by the
number of columns minus 1. This is (2-1) x (3-1) = 1 x 2 =
2 degrees of freedom.
Critical value X2=5.991
Step 04 calculation of calculated value
Expected frequency = row total x column total
Grand total
Eg: expected frequency for Normal male E1 = (100 x 80) / 200 = 40
HTN MALES FEMALES
Status
N E1=40 E2=60
PH E3=24 E4=36
H E5=16 E5=24
HTN Males Females
Status Row Total
N 50 50 100
PH 20 40 60
H 10 30 40
Column 80 120 200
total
O E O-E (O-E)2 (O-E)2
E
50 40 10 100 100/40 =2.5
50 60 -10 100 100/60 =1.66
20 24 -4 16 16/24 =0.66
40 36 4 16 16/36 =0.44
10 16 -6 36 36/16 =2.25
30 24 6 36 36/24 =1.5
(X2)=9.01
Add up all of the above numbers to obtain
the value for chi square: χ2 = 9.01
Comparison of critical and calculated
value
We find that our answer of 9.01 is greater than the
critical value of 5.991 (for 2 degrees of freedom and a
significance level of 0.05) and so we reject the null
hypothesis.
Step Decision
We reject the null hypotheses because
the calculated value fall into rejection
area
Step 06 conclusion
There is an association between gender
and hypertensive status at alpha 0.05