CHI-SQUARED
TEST
Dr Lipilekha Patnaik
Professor, Community Medicine
Institute of Medical Sciences & SUM Hospital
Siksha ‘O’Anusandhan deemed to be University
Bhubaneswar, Odisha, India
Email: drlipilekha@yahoo.co.in
Pearson’s chi-squared test
• Chi- Square test is method of testing the significance of difference
between two proportions.
• It has the advantage that at can also be used when more than two
groups are to be compared.
• Commonly applied in biomedical research
2
• Used to test categorical Data
Especially when the outcomes are in counts or frequency
• Nominal variables
Sex, Blood group
• Ordinal Variables
Birth order
Severity of disease (absent, mild, moderate, severe)
3
Applications of chi-squared test
• This test is used as
• for finding difference in proportions
• for finding association between variables
4
Example
• In a prevalence study of Hypertension, we found that
Hypertension No Hypertension
Non smokers 10 (10%) 90
Smokers 26 (26%) 74
• It is visible from the table that the proportion of HTN was higher
among smokers . The question that arises is whether HTN was really
higher among smokers or the difference was merely due to chance.
5
Group
Result
Total
Hypertension No HTN
Non smokers 10 (a) 90 (b) 100
(a+b)
Smokers 26 (c) 74 (d) 100
(c+d)
Total 36 (a+c) 164 (b+d) 200 (N)
6
Steps
• Null hypothesis
• Calculation of expected values
• Calculation of Chi-square value
• Calculation of degrees of freedom
• Conclusion
7
Null hypothesis
• No significant difference in the proportions
• Alternate- significant difference in the proportions
8
Calculation of expected values
• Expected	value	in	any	cell	=
totalGrand
totalRowXtotalColumn
9
Expected	value	of	each	cell	should	be	more	than	5	in	
each	cell.
Expected values in cells
Thus expected value in each cell is
• First cell: 36 X 100 / 200 = 18
• Second cell: 164 X 100 / 200 = 82
• Third cell: 36 X 100 / 200 = 18
• Fourth cell: 164 X 100 / 200 = 82
10
Chi squared value
∑
−
=
E
EO 2
2 )(
χ
11
df =		(c	-1)	(r-1)	
where	c	and	r	stand	for	number	of	columns	and	
number	of	rows	respectively.
P	<	0.05	– Significant	difference	between	2	proportions
P	>	0.05	– No	significant	difference	between	2	
proportions
Calculation of Chi-squared value
12
82
)8274(
18
)1826(
82
)8290(
18
)1810( 2222
−
+
−
+
−
+
−
82
)8(
18
)8(
82
)8(
18
)8( 2222
+
−
++
−
=
78.056.378.056.3 +++=
82
64
18
64
82
64
18
64
+++=
68.8=
Calculation of degrees of freedom
df = (c -1) (r-1)
where c and r stand for number of columns and number of rows
respectively.
Thus df = (2 -1) X (2 – 1) = (1) X (1) = 1.
13
14
Conclusion
• As the Chi-square value is more than the table value for 5%
level of significance at 1 df (3.84), we reject the null hypothesis
and state that there is a statistically significant difference of
proportions of hypertension between smokers and nonsmokers
(P < 0.05).
• Smoking is associated with hypertension.
15
16

Chi squared test

  • 1.
    CHI-SQUARED TEST Dr Lipilekha Patnaik Professor,Community Medicine Institute of Medical Sciences & SUM Hospital Siksha ‘O’Anusandhan deemed to be University Bhubaneswar, Odisha, India Email: drlipilekha@yahoo.co.in
  • 2.
    Pearson’s chi-squared test •Chi- Square test is method of testing the significance of difference between two proportions. • It has the advantage that at can also be used when more than two groups are to be compared. • Commonly applied in biomedical research 2
  • 3.
    • Used totest categorical Data Especially when the outcomes are in counts or frequency • Nominal variables Sex, Blood group • Ordinal Variables Birth order Severity of disease (absent, mild, moderate, severe) 3
  • 4.
    Applications of chi-squaredtest • This test is used as • for finding difference in proportions • for finding association between variables 4
  • 5.
    Example • In aprevalence study of Hypertension, we found that Hypertension No Hypertension Non smokers 10 (10%) 90 Smokers 26 (26%) 74 • It is visible from the table that the proportion of HTN was higher among smokers . The question that arises is whether HTN was really higher among smokers or the difference was merely due to chance. 5
  • 6.
    Group Result Total Hypertension No HTN Nonsmokers 10 (a) 90 (b) 100 (a+b) Smokers 26 (c) 74 (d) 100 (c+d) Total 36 (a+c) 164 (b+d) 200 (N) 6
  • 7.
    Steps • Null hypothesis •Calculation of expected values • Calculation of Chi-square value • Calculation of degrees of freedom • Conclusion 7
  • 8.
    Null hypothesis • Nosignificant difference in the proportions • Alternate- significant difference in the proportions 8
  • 9.
    Calculation of expectedvalues • Expected value in any cell = totalGrand totalRowXtotalColumn 9 Expected value of each cell should be more than 5 in each cell.
  • 10.
    Expected values incells Thus expected value in each cell is • First cell: 36 X 100 / 200 = 18 • Second cell: 164 X 100 / 200 = 82 • Third cell: 36 X 100 / 200 = 18 • Fourth cell: 164 X 100 / 200 = 82 10
  • 11.
    Chi squared value ∑ − = E EO2 2 )( χ 11 df = (c -1) (r-1) where c and r stand for number of columns and number of rows respectively. P < 0.05 – Significant difference between 2 proportions P > 0.05 – No significant difference between 2 proportions
  • 12.
    Calculation of Chi-squaredvalue 12 82 )8274( 18 )1826( 82 )8290( 18 )1810( 2222 − + − + − + − 82 )8( 18 )8( 82 )8( 18 )8( 2222 + − ++ − = 78.056.378.056.3 +++= 82 64 18 64 82 64 18 64 +++= 68.8=
  • 13.
    Calculation of degreesof freedom df = (c -1) (r-1) where c and r stand for number of columns and number of rows respectively. Thus df = (2 -1) X (2 – 1) = (1) X (1) = 1. 13
  • 14.
  • 15.
    Conclusion • As theChi-square value is more than the table value for 5% level of significance at 1 df (3.84), we reject the null hypothesis and state that there is a statistically significant difference of proportions of hypertension between smokers and nonsmokers (P < 0.05). • Smoking is associated with hypertension. 15
  • 16.