SlideShare a Scribd company logo
Lecture 12 - The χ2
-test
C2 Foundation Mathematics (Standard Track)
Dr Linda Stringer Dr Simon Craik
l.stringer@uea.ac.uk s.craik@uea.ac.uk
INTO City/UEA London
Pearson’s χ2
-test
Pearson’s χ2-test is another kind of hypothesis test, we use
it to investigate whether two variables are independent, or
related to each other.
For example to investigate whether people’s voting
intention and social class are related.
In a χ2-test the variables are categorical - for example the
categories of voting intention are Labour, Conservative and
Liberal Democrat, and the categories of social class are A,
B and C.
To investigate whether men get paid more than women, the
variables are gender and salary. The categories of gender
are male and female, and the categories of salary could be
low, medium and high.
The structure of a χ2
-test
The χ2-test has the same structure as a Z-test and a T-test
Hypotheses (state H0 and H1)
Critical value (look it up in a table)
Test statistic (this is the long part - there are 5 steps)
Decision (Reject/accept H0, with justification)
Conclusion (in words)
Are students’ grades dependent on attendance?
Some students think that turning up to lectures and seminars
doesn’t make a difference to what grade they get at the end of
the module. We surveyed a sample of 100 students. Based on
the data below do you think that attendance and grades are
independent variables?
Often attends Sometimes Rarely attends
Distinction 36 7 4
Merit 12 10 7
Pass 2 6 16
You see that about half of the students (47 out of 100) got a
Distinction. However is this true for each individual category of
attendance?
We will perform a χ2-test on this data later (see Example 1
below)
Hypotheses
The null hypothesis (H0) is always that the variables are
independent.
The alternative hypothesis (H1) is always that the variables
are related (dependent on each other).
Write the hypotheses as sentences, for example
H0: Voting intention and social class are independent
H1; Voting intention depends on social class
χ2
-test statistic step 1: calculate the totals
Data is presented in a table, called a contingency table.
The values in the contingency table are called the
observed values (O).
( The contingency table is often referred to as the
’observed’ values table.)
We first calculate the row totals, the column totals and the
grand total.
χ2
-test statistic step 2: the expected table
We then construct the expected table.
This is the table of expected values (E). For each cell,
expected value (E) =
row total × column total
grand total
NOTE: For a χ2-test to be viable the expected values must
all be greater than 5 in a 2 × 2 table and greater than 5 in
80% of the cells in larger tables.
Handy hint: The totals are the same for the expected table
as for the observed table.
χ2
-test statistic step 3: the residual table
We then construct the residual table.
This is the table of residual values. For each cell,
residual value (R) = observed value(O)−expected value(E)
Handy hint: The row and column totals in the residual table
are always 0.
χ2
-test statistic step 4: the χ2
-table
We then construct the χ2-table.
Construct the χ2 table. For each cell,
value =
R2
E
=
(O − E)2
E
Handy hint: The values in the χ2 table are always positive.
χ2
-test statistic step 5: the test statistic
The test statistic is the sum of all the values in the χ2 table
χ2
-test statistic =
R2
E
=
(O − E)2
E
Handy hint: The test statistic is always positive.
The critical value
We also need to find our critical value.
To do this we calculate the degree of freedom of our table.
This will be the degrese of freedom of the rows multiplied
by the degrees of freedom of the columns.
d.o.f. = (n − 1) × (m − 1), where n is the number of rows
and m is the number of columns.
Get the critical value by reading off the degree of freedom
and required significance level from the table. If the test
statistic is greater than the critical value we reject the null
hypothesis.
The χ2
-test critical value table
5% Significance 1% Significance
d.o.f. Probability 0.05 Probability 0.01
1 3.84 6.63
2 5.99 9.21
3 7.81 11.34
4 9.49 13.28
5 11.07 15.09
6 12.59 16.81
7 14.07 18.48
8 15.51 20.09
9 16.92 21.67
10 18.31 23.21
11 19.68 24.72
12 21.03 26.22
Example 1
Some students think that turning up to lectures doesn’t
make a difference to what grade they get. We consider a
sample of 100 students, and test at 5% level of
significance.
Often attends Sometimes Rarely
Distinction 36 7 4
Merit 12 10 7
Pass 2 6 16
First state the hypotheses.
H0: the students’ attendance and grades are independent.
H1: the grade depends on attendence.
Example 1
Step 1: Calculate the column totals, the row totals and the
grand total.
Often Sometimes Rarely Row total
Distinction 36 7 4 47
Merit 12 10 7 29
Pass 2 6 16 24
Column total 50 23 27 100
Step 2: Calculate the expected table.
expected value (E) =
row total × column total
grand total
23.5 10.81 12.69
14.5 6.67 7.83
12 5.52 6.48
Example 1
Step 3: Calculate the residual table
residual value (R) = observed value(O) − expected value(E)
12.5 -3.81 -8.69
-2.5 3.33 -0.83
-10 0.48 9.52
Step 4: Calculate the χ2-table. As we want a final value to 2 dp
calculate to 3 dp.
value =
R2
E
=
(O − E)2
E
6.649 1.343 5.951
0.431 1.663 0.088
8.333 0.042 13.986
Step 5: The test statistic is the sum of all the values in the table
χ2
-test statistic =
R2
=
(O − E)2
= 38.49 to 2 d.p.
Example 1
We now find our critical value.
The degree of freedom will be (3 − 1) × (3 − 1) = 4.
We consult our table and get a critical value of 9.49.
As our test statistic is greater than the critical value,
38.49>9.49, we decide to reject the null hypothesis.
We conclude that your grade depends on your attendance.
Example 2
In his sketch the Vitruvian man Leonardo da Vinci
displayed the “perfect" proportions of man.
We aren’t so sure there is a correlation between height and
nose size so we gather some data and test at a 1% level of
significance.
≤ 1.5 cm 1.5-2.5 cm ≥ 2.5 cm
≤ 165cm 9 3 6
166-175 cm 15 18 18
176-185 cm 12 21 24
≥ 186 cm 9 6 9
First we state our hypotheses.
H0: height and nose size are independent variables.
H1: height and nose size are dependent variables.
Example 2
Calculate the column and row totals.
≤ 1.5 cm 1.5-2.5 cm ≥ 2.5 cm Row total
≤ 165cm 9 3 6
166-175 cm 15 18 18
176-185 cm 12 21 24
≥ 186 cm 9 6 9
Column total 45 48 57 150
Calculate the expected table. Multiply the column sum and row
sum and divide by total.
5.4 5.76 6.84
15.3 16.32 19.38
17.1 18.24 21.66
7.2 7.68 9.12
Example 2
Calculate the residual table. Subtract the expected value from
the original value.
3.6 -2.76 -0.84
-0.3 1.68 -1.38
-5.1 2.76 2.34
1.8 -1.68 -0.12
Calculate the χ2-table. Square the residual value and divide by
the expected. As we want a final value to 2 d.p., calculate to 3
d.p.
2.4 1.323 0.103
0.006 0.173 0.098
1.521 0.418 0.253
0.45 0.368 0.002
χ2
-test statistic =
R2
E
=
(O − E)2
E
= 7.11 to 2 d.p.
Example 2
We now find our critical value.
The degree of freedom will be (3 − 1) × (4 − 1) = 6.
We consult our table and get a critical value of 16.81.
Our test statistic is closer to 0 than our critical value,
7.11<16.81, so we decide to accept our null hypothesis.
We conclude that height and nose size are independent.
Example 3
A cynical Englishman says that it rains all year round in
Britain. To see if this is the case we keep a log of the
weather in each season. We test at a 1% level of
significance.
Overcast Sunny Rainy Snowy
Spring 5 53 28 4
Summer 31 37 22 0
Autumn 32 25 30 3
Winter 22 15 29 24
First we state our hypotheses.
H0: the weather and season are independent.
H1: the weather depends on the season.
Example 3
Calculate the column and row totals.
Overcast Sunny Rainy Snowy Row total
Spring 5 53 28 4 90
Summer 31 37 22 0 90
Autumn 32 25 30 3 90
Winter 22 15 29 24 90
Column total 90 130 109 31 360
Calculate the expected table. Multiply the column sum and row
sum and divide by total.
22.5 32.5 27.25 7.75
22.5 32.5 27.25 7.75
22.5 32.5 27.25 7.75
22.5 32.5 27.25 7.75
Example 3
Calculate the residual table. Subtract the expected value from
the original value.
-17.5 20.5 0.75 -3.75
8.5 4.5 -5.25 -7.75
9.5 -7.5 2.75 -4.75
-0.5 -17.5 1.75 16.25
Calculate the χ2-table. Square the residual value and divide by
the expected. As we want a final value to 2 d.p., calculate to 3
d.p.
13.611 12.931 0.021 1.815
3.211 0.623 1.011 7.75
4.011 1.731 0.278 2.911
0.011 9.423 0.112 34.073
The test statistic is the sum of all the values in the table 93.52
to 2 d.p.
Example 3
We now find our critical value.
The degree of freedom will be (4 − 1) × (4 − 1) = 9.
We consult our table and get a critical value of 21.67.
Our test statistic larger than our critical value so we decide
to reject our null hypothesis.
We conclude that the weather depends on the season.

More Related Content

What's hot

Advance algebra
Advance algebraAdvance algebra
Advance algebra
lyra matalubos
 
C2 st lecture 6 handout
C2 st lecture 6 handoutC2 st lecture 6 handout
C2 st lecture 6 handout
fatima d
 
Advance algebra
Advance algebraAdvance algebra
Advance algebra
lyra matalubos
 
NUMERICAL METHODS
NUMERICAL METHODSNUMERICAL METHODS
NUMERICAL METHODS
PRABHAHARAN429
 
5.4 write linear equations in standard form day 1
5.4 write linear equations in standard form   day 15.4 write linear equations in standard form   day 1
5.4 write linear equations in standard form day 1
bweldon
 
Es272 ch7
Es272 ch7Es272 ch7
Slope intercept
Slope interceptSlope intercept
Slope intercept
coolhanddav
 
Maths Revision - GCSE And Additional Notes
Maths Revision - GCSE And Additional NotesMaths Revision - GCSE And Additional Notes
Maths Revision - GCSE And Additional Notes
Katie B
 
Additional Mathematics Revision
Additional Mathematics RevisionAdditional Mathematics Revision
Additional Mathematics Revision
Katie B
 
Graphs linear equations and functions
Graphs linear equations and functionsGraphs linear equations and functions
Graphs linear equations and functions
anwarsalamappt
 
NUMERICA METHODS 1 final touch summary for test 1
NUMERICA METHODS 1 final touch summary for test 1NUMERICA METHODS 1 final touch summary for test 1
NUMERICA METHODS 1 final touch summary for test 1
musadoto
 
Gcse revision cards checked 190415
Gcse revision cards checked 190415Gcse revision cards checked 190415
Gcse revision cards checked 190415
claire meadows-smith
 
Linear Rules
Linear RulesLinear Rules
Linear Rules
Passy World
 
1539 graphs linear equations and functions
1539 graphs linear equations and functions1539 graphs linear equations and functions
1539 graphs linear equations and functions
Dr Fereidoun Dejahang
 
10.4
10.410.4
10.4
nglaze10
 
Introduction to Functions
Introduction to FunctionsIntroduction to Functions
Introduction to Functions
Melanie Loslo
 
Advanced algebra
Advanced algebraAdvanced algebra
Advanced algebra
spark21
 
Chapter 5 Slope-Intercept Form
Chapter 5 Slope-Intercept FormChapter 5 Slope-Intercept Form
Chapter 5 Slope-Intercept Form
Iinternational Program School
 
Solving linear equation
Solving linear equationSolving linear equation
Solving linear equation
sidrabasharat28
 
Linear equations inequalities and applications
Linear equations inequalities and applicationsLinear equations inequalities and applications
Linear equations inequalities and applications
vineeta yadav
 

What's hot (20)

Advance algebra
Advance algebraAdvance algebra
Advance algebra
 
C2 st lecture 6 handout
C2 st lecture 6 handoutC2 st lecture 6 handout
C2 st lecture 6 handout
 
Advance algebra
Advance algebraAdvance algebra
Advance algebra
 
NUMERICAL METHODS
NUMERICAL METHODSNUMERICAL METHODS
NUMERICAL METHODS
 
5.4 write linear equations in standard form day 1
5.4 write linear equations in standard form   day 15.4 write linear equations in standard form   day 1
5.4 write linear equations in standard form day 1
 
Es272 ch7
Es272 ch7Es272 ch7
Es272 ch7
 
Slope intercept
Slope interceptSlope intercept
Slope intercept
 
Maths Revision - GCSE And Additional Notes
Maths Revision - GCSE And Additional NotesMaths Revision - GCSE And Additional Notes
Maths Revision - GCSE And Additional Notes
 
Additional Mathematics Revision
Additional Mathematics RevisionAdditional Mathematics Revision
Additional Mathematics Revision
 
Graphs linear equations and functions
Graphs linear equations and functionsGraphs linear equations and functions
Graphs linear equations and functions
 
NUMERICA METHODS 1 final touch summary for test 1
NUMERICA METHODS 1 final touch summary for test 1NUMERICA METHODS 1 final touch summary for test 1
NUMERICA METHODS 1 final touch summary for test 1
 
Gcse revision cards checked 190415
Gcse revision cards checked 190415Gcse revision cards checked 190415
Gcse revision cards checked 190415
 
Linear Rules
Linear RulesLinear Rules
Linear Rules
 
1539 graphs linear equations and functions
1539 graphs linear equations and functions1539 graphs linear equations and functions
1539 graphs linear equations and functions
 
10.4
10.410.4
10.4
 
Introduction to Functions
Introduction to FunctionsIntroduction to Functions
Introduction to Functions
 
Advanced algebra
Advanced algebraAdvanced algebra
Advanced algebra
 
Chapter 5 Slope-Intercept Form
Chapter 5 Slope-Intercept FormChapter 5 Slope-Intercept Form
Chapter 5 Slope-Intercept Form
 
Solving linear equation
Solving linear equationSolving linear equation
Solving linear equation
 
Linear equations inequalities and applications
Linear equations inequalities and applicationsLinear equations inequalities and applications
Linear equations inequalities and applications
 

Similar to C2 st lecture 12 the chi squared-test handout

Regression
RegressionRegression
Lect w7 t_test_amp_chi_test
Lect w7 t_test_amp_chi_testLect w7 t_test_amp_chi_test
Lect w7 t_test_amp_chi_test
Rione Drevale
 
Hypothesis testing
Hypothesis testingHypothesis testing
Hypothesis testing
ShaikhSaifullahKhali
 
Chapter12
Chapter12Chapter12
Chapter12
Richard Ferreria
 
Statistics assignment
Statistics assignmentStatistics assignment
Statistics assignment
Brian Miles
 
Chi square tests
Chi square testsChi square tests
Chi square tests
waqole
 
Regression
Regression  Regression
Factorial Experiments
Factorial ExperimentsFactorial Experiments
Factorial Experiments
HelpWithAssignment.com
 
Linear regression
Linear regressionLinear regression
Linear regression
Karishma Chaudhary
 
Ejercicio resuelto-de-estadc3adstica-descriptiva1
Ejercicio resuelto-de-estadc3adstica-descriptiva1Ejercicio resuelto-de-estadc3adstica-descriptiva1
Ejercicio resuelto-de-estadc3adstica-descriptiva1
Sandra Hernández Cely
 
t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750
richardchandler
 
Week 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docxWeek 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docx
cockekeshia
 
Workshop 4
Workshop 4Workshop 4
Workshop 4
eeetq
 
qm2CHAP12.ppt
qm2CHAP12.pptqm2CHAP12.ppt
qm2CHAP12.ppt
HieuNguyen477759
 
Lesson06_new
Lesson06_newLesson06_new
Lesson06_new
shengvn
 
Simple lin regress_inference
Simple lin regress_inferenceSimple lin regress_inference
Simple lin regress_inference
Kemal İnciroğlu
 
Descriptive Statistics Formula Sheet Sample Populatio.docx
Descriptive Statistics Formula Sheet    Sample Populatio.docxDescriptive Statistics Formula Sheet    Sample Populatio.docx
Descriptive Statistics Formula Sheet Sample Populatio.docx
simonithomas47935
 
Contingency Tables
Contingency TablesContingency Tables
Contingency Tables
Long Beach City College
 
Project2
Project2Project2
Project2
Linjun Li
 
Admission in India
Admission in IndiaAdmission in India
Admission in India
Edhole.com
 

Similar to C2 st lecture 12 the chi squared-test handout (20)

Regression
RegressionRegression
Regression
 
Lect w7 t_test_amp_chi_test
Lect w7 t_test_amp_chi_testLect w7 t_test_amp_chi_test
Lect w7 t_test_amp_chi_test
 
Hypothesis testing
Hypothesis testingHypothesis testing
Hypothesis testing
 
Chapter12
Chapter12Chapter12
Chapter12
 
Statistics assignment
Statistics assignmentStatistics assignment
Statistics assignment
 
Chi square tests
Chi square testsChi square tests
Chi square tests
 
Regression
Regression  Regression
Regression
 
Factorial Experiments
Factorial ExperimentsFactorial Experiments
Factorial Experiments
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Ejercicio resuelto-de-estadc3adstica-descriptiva1
Ejercicio resuelto-de-estadc3adstica-descriptiva1Ejercicio resuelto-de-estadc3adstica-descriptiva1
Ejercicio resuelto-de-estadc3adstica-descriptiva1
 
t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750
 
Week 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docxWeek 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docx
 
Workshop 4
Workshop 4Workshop 4
Workshop 4
 
qm2CHAP12.ppt
qm2CHAP12.pptqm2CHAP12.ppt
qm2CHAP12.ppt
 
Lesson06_new
Lesson06_newLesson06_new
Lesson06_new
 
Simple lin regress_inference
Simple lin regress_inferenceSimple lin regress_inference
Simple lin regress_inference
 
Descriptive Statistics Formula Sheet Sample Populatio.docx
Descriptive Statistics Formula Sheet    Sample Populatio.docxDescriptive Statistics Formula Sheet    Sample Populatio.docx
Descriptive Statistics Formula Sheet Sample Populatio.docx
 
Contingency Tables
Contingency TablesContingency Tables
Contingency Tables
 
Project2
Project2Project2
Project2
 
Admission in India
Admission in IndiaAdmission in India
Admission in India
 

More from fatima d

10 terrorism
10 terrorism10 terrorism
10 terrorism
fatima d
 
09 non governmental organisations
09  non governmental organisations09  non governmental organisations
09 non governmental organisations
fatima d
 
17 china and the developing world
17 china and the developing world17 china and the developing world
17 china and the developing world
fatima d
 
16 development assistance
16 development assistance16 development assistance
16 development assistance
fatima d
 
15 development issues
15 development issues15 development issues
15 development issues
fatima d
 
12b beyond unipolarity
12b beyond unipolarity12b beyond unipolarity
12b beyond unipolarity
fatima d
 
12a beyond bipolarity fukuyama and huntington
12a  beyond bipolarity   fukuyama and huntington12a  beyond bipolarity   fukuyama and huntington
12a beyond bipolarity fukuyama and huntington
fatima d
 
Un covenant economioc social cultural
Un covenant economioc social culturalUn covenant economioc social cultural
Un covenant economioc social cultural
fatima d
 
Un covenant civil political rights
Un covenant civil political rightsUn covenant civil political rights
Un covenant civil political rights
fatima d
 
Cairo declaration 1990
Cairo declaration 1990Cairo declaration 1990
Cairo declaration 1990
fatima d
 
Un declaration of human rights
Un declaration of human rightsUn declaration of human rights
Un declaration of human rights
fatima d
 
C2 st lecture 11 the t-test handout
C2 st lecture 11   the t-test handoutC2 st lecture 11   the t-test handout
C2 st lecture 11 the t-test handout
fatima d
 
Foundation c2 exam june 2013 resit 2 sols
Foundation c2 exam june 2013 resit 2 solsFoundation c2 exam june 2013 resit 2 sols
Foundation c2 exam june 2013 resit 2 sols
fatima d
 
Foundation c2 exam may 2013 sols
Foundation c2 exam may 2013 solsFoundation c2 exam may 2013 sols
Foundation c2 exam may 2013 sols
fatima d
 
Foundation c2 exam june 2013 resit sols
Foundation c2 exam june 2013 resit solsFoundation c2 exam june 2013 resit sols
Foundation c2 exam june 2013 resit sols
fatima d
 
Ft test b jan 2012 sols
Ft test b jan 2012 solsFt test b jan 2012 sols
Ft test b jan 2012 sols
fatima d
 
Foundation c2 exam august 2012 sols
Foundation c2 exam august 2012 solsFoundation c2 exam august 2012 sols
Foundation c2 exam august 2012 sols
fatima d
 
Seminar activity 3 the search for intimacy
Seminar activity 3 the search for intimacySeminar activity 3 the search for intimacy
Seminar activity 3 the search for intimacy
fatima d
 
Religion seminar activity_group_1_religion_oppression_and_transformation
Religion seminar activity_group_1_religion_oppression_and_transformationReligion seminar activity_group_1_religion_oppression_and_transformation
Religion seminar activity_group_1_religion_oppression_and_transformation
fatima d
 
Homework reading task government and politics
Homework reading task government and politicsHomework reading task government and politics
Homework reading task government and politics
fatima d
 

More from fatima d (20)

10 terrorism
10 terrorism10 terrorism
10 terrorism
 
09 non governmental organisations
09  non governmental organisations09  non governmental organisations
09 non governmental organisations
 
17 china and the developing world
17 china and the developing world17 china and the developing world
17 china and the developing world
 
16 development assistance
16 development assistance16 development assistance
16 development assistance
 
15 development issues
15 development issues15 development issues
15 development issues
 
12b beyond unipolarity
12b beyond unipolarity12b beyond unipolarity
12b beyond unipolarity
 
12a beyond bipolarity fukuyama and huntington
12a  beyond bipolarity   fukuyama and huntington12a  beyond bipolarity   fukuyama and huntington
12a beyond bipolarity fukuyama and huntington
 
Un covenant economioc social cultural
Un covenant economioc social culturalUn covenant economioc social cultural
Un covenant economioc social cultural
 
Un covenant civil political rights
Un covenant civil political rightsUn covenant civil political rights
Un covenant civil political rights
 
Cairo declaration 1990
Cairo declaration 1990Cairo declaration 1990
Cairo declaration 1990
 
Un declaration of human rights
Un declaration of human rightsUn declaration of human rights
Un declaration of human rights
 
C2 st lecture 11 the t-test handout
C2 st lecture 11   the t-test handoutC2 st lecture 11   the t-test handout
C2 st lecture 11 the t-test handout
 
Foundation c2 exam june 2013 resit 2 sols
Foundation c2 exam june 2013 resit 2 solsFoundation c2 exam june 2013 resit 2 sols
Foundation c2 exam june 2013 resit 2 sols
 
Foundation c2 exam may 2013 sols
Foundation c2 exam may 2013 solsFoundation c2 exam may 2013 sols
Foundation c2 exam may 2013 sols
 
Foundation c2 exam june 2013 resit sols
Foundation c2 exam june 2013 resit solsFoundation c2 exam june 2013 resit sols
Foundation c2 exam june 2013 resit sols
 
Ft test b jan 2012 sols
Ft test b jan 2012 solsFt test b jan 2012 sols
Ft test b jan 2012 sols
 
Foundation c2 exam august 2012 sols
Foundation c2 exam august 2012 solsFoundation c2 exam august 2012 sols
Foundation c2 exam august 2012 sols
 
Seminar activity 3 the search for intimacy
Seminar activity 3 the search for intimacySeminar activity 3 the search for intimacy
Seminar activity 3 the search for intimacy
 
Religion seminar activity_group_1_religion_oppression_and_transformation
Religion seminar activity_group_1_religion_oppression_and_transformationReligion seminar activity_group_1_religion_oppression_and_transformation
Religion seminar activity_group_1_religion_oppression_and_transformation
 
Homework reading task government and politics
Homework reading task government and politicsHomework reading task government and politics
Homework reading task government and politics
 

Recently uploaded

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 

Recently uploaded (20)

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 

C2 st lecture 12 the chi squared-test handout

  • 1. Lecture 12 - The χ2 -test C2 Foundation Mathematics (Standard Track) Dr Linda Stringer Dr Simon Craik l.stringer@uea.ac.uk s.craik@uea.ac.uk INTO City/UEA London
  • 2. Pearson’s χ2 -test Pearson’s χ2-test is another kind of hypothesis test, we use it to investigate whether two variables are independent, or related to each other. For example to investigate whether people’s voting intention and social class are related. In a χ2-test the variables are categorical - for example the categories of voting intention are Labour, Conservative and Liberal Democrat, and the categories of social class are A, B and C. To investigate whether men get paid more than women, the variables are gender and salary. The categories of gender are male and female, and the categories of salary could be low, medium and high.
  • 3. The structure of a χ2 -test The χ2-test has the same structure as a Z-test and a T-test Hypotheses (state H0 and H1) Critical value (look it up in a table) Test statistic (this is the long part - there are 5 steps) Decision (Reject/accept H0, with justification) Conclusion (in words)
  • 4. Are students’ grades dependent on attendance? Some students think that turning up to lectures and seminars doesn’t make a difference to what grade they get at the end of the module. We surveyed a sample of 100 students. Based on the data below do you think that attendance and grades are independent variables? Often attends Sometimes Rarely attends Distinction 36 7 4 Merit 12 10 7 Pass 2 6 16 You see that about half of the students (47 out of 100) got a Distinction. However is this true for each individual category of attendance? We will perform a χ2-test on this data later (see Example 1 below)
  • 5. Hypotheses The null hypothesis (H0) is always that the variables are independent. The alternative hypothesis (H1) is always that the variables are related (dependent on each other). Write the hypotheses as sentences, for example H0: Voting intention and social class are independent H1; Voting intention depends on social class
  • 6. χ2 -test statistic step 1: calculate the totals Data is presented in a table, called a contingency table. The values in the contingency table are called the observed values (O). ( The contingency table is often referred to as the ’observed’ values table.) We first calculate the row totals, the column totals and the grand total.
  • 7. χ2 -test statistic step 2: the expected table We then construct the expected table. This is the table of expected values (E). For each cell, expected value (E) = row total × column total grand total NOTE: For a χ2-test to be viable the expected values must all be greater than 5 in a 2 × 2 table and greater than 5 in 80% of the cells in larger tables. Handy hint: The totals are the same for the expected table as for the observed table.
  • 8. χ2 -test statistic step 3: the residual table We then construct the residual table. This is the table of residual values. For each cell, residual value (R) = observed value(O)−expected value(E) Handy hint: The row and column totals in the residual table are always 0.
  • 9. χ2 -test statistic step 4: the χ2 -table We then construct the χ2-table. Construct the χ2 table. For each cell, value = R2 E = (O − E)2 E Handy hint: The values in the χ2 table are always positive.
  • 10. χ2 -test statistic step 5: the test statistic The test statistic is the sum of all the values in the χ2 table χ2 -test statistic = R2 E = (O − E)2 E Handy hint: The test statistic is always positive.
  • 11. The critical value We also need to find our critical value. To do this we calculate the degree of freedom of our table. This will be the degrese of freedom of the rows multiplied by the degrees of freedom of the columns. d.o.f. = (n − 1) × (m − 1), where n is the number of rows and m is the number of columns. Get the critical value by reading off the degree of freedom and required significance level from the table. If the test statistic is greater than the critical value we reject the null hypothesis.
  • 12. The χ2 -test critical value table 5% Significance 1% Significance d.o.f. Probability 0.05 Probability 0.01 1 3.84 6.63 2 5.99 9.21 3 7.81 11.34 4 9.49 13.28 5 11.07 15.09 6 12.59 16.81 7 14.07 18.48 8 15.51 20.09 9 16.92 21.67 10 18.31 23.21 11 19.68 24.72 12 21.03 26.22
  • 13. Example 1 Some students think that turning up to lectures doesn’t make a difference to what grade they get. We consider a sample of 100 students, and test at 5% level of significance. Often attends Sometimes Rarely Distinction 36 7 4 Merit 12 10 7 Pass 2 6 16 First state the hypotheses. H0: the students’ attendance and grades are independent. H1: the grade depends on attendence.
  • 14. Example 1 Step 1: Calculate the column totals, the row totals and the grand total. Often Sometimes Rarely Row total Distinction 36 7 4 47 Merit 12 10 7 29 Pass 2 6 16 24 Column total 50 23 27 100 Step 2: Calculate the expected table. expected value (E) = row total × column total grand total 23.5 10.81 12.69 14.5 6.67 7.83 12 5.52 6.48
  • 15. Example 1 Step 3: Calculate the residual table residual value (R) = observed value(O) − expected value(E) 12.5 -3.81 -8.69 -2.5 3.33 -0.83 -10 0.48 9.52 Step 4: Calculate the χ2-table. As we want a final value to 2 dp calculate to 3 dp. value = R2 E = (O − E)2 E 6.649 1.343 5.951 0.431 1.663 0.088 8.333 0.042 13.986 Step 5: The test statistic is the sum of all the values in the table χ2 -test statistic = R2 = (O − E)2 = 38.49 to 2 d.p.
  • 16. Example 1 We now find our critical value. The degree of freedom will be (3 − 1) × (3 − 1) = 4. We consult our table and get a critical value of 9.49. As our test statistic is greater than the critical value, 38.49>9.49, we decide to reject the null hypothesis. We conclude that your grade depends on your attendance.
  • 17. Example 2 In his sketch the Vitruvian man Leonardo da Vinci displayed the “perfect" proportions of man. We aren’t so sure there is a correlation between height and nose size so we gather some data and test at a 1% level of significance. ≤ 1.5 cm 1.5-2.5 cm ≥ 2.5 cm ≤ 165cm 9 3 6 166-175 cm 15 18 18 176-185 cm 12 21 24 ≥ 186 cm 9 6 9 First we state our hypotheses. H0: height and nose size are independent variables. H1: height and nose size are dependent variables.
  • 18. Example 2 Calculate the column and row totals. ≤ 1.5 cm 1.5-2.5 cm ≥ 2.5 cm Row total ≤ 165cm 9 3 6 166-175 cm 15 18 18 176-185 cm 12 21 24 ≥ 186 cm 9 6 9 Column total 45 48 57 150 Calculate the expected table. Multiply the column sum and row sum and divide by total. 5.4 5.76 6.84 15.3 16.32 19.38 17.1 18.24 21.66 7.2 7.68 9.12
  • 19. Example 2 Calculate the residual table. Subtract the expected value from the original value. 3.6 -2.76 -0.84 -0.3 1.68 -1.38 -5.1 2.76 2.34 1.8 -1.68 -0.12 Calculate the χ2-table. Square the residual value and divide by the expected. As we want a final value to 2 d.p., calculate to 3 d.p. 2.4 1.323 0.103 0.006 0.173 0.098 1.521 0.418 0.253 0.45 0.368 0.002 χ2 -test statistic = R2 E = (O − E)2 E = 7.11 to 2 d.p.
  • 20. Example 2 We now find our critical value. The degree of freedom will be (3 − 1) × (4 − 1) = 6. We consult our table and get a critical value of 16.81. Our test statistic is closer to 0 than our critical value, 7.11<16.81, so we decide to accept our null hypothesis. We conclude that height and nose size are independent.
  • 21. Example 3 A cynical Englishman says that it rains all year round in Britain. To see if this is the case we keep a log of the weather in each season. We test at a 1% level of significance. Overcast Sunny Rainy Snowy Spring 5 53 28 4 Summer 31 37 22 0 Autumn 32 25 30 3 Winter 22 15 29 24 First we state our hypotheses. H0: the weather and season are independent. H1: the weather depends on the season.
  • 22. Example 3 Calculate the column and row totals. Overcast Sunny Rainy Snowy Row total Spring 5 53 28 4 90 Summer 31 37 22 0 90 Autumn 32 25 30 3 90 Winter 22 15 29 24 90 Column total 90 130 109 31 360 Calculate the expected table. Multiply the column sum and row sum and divide by total. 22.5 32.5 27.25 7.75 22.5 32.5 27.25 7.75 22.5 32.5 27.25 7.75 22.5 32.5 27.25 7.75
  • 23. Example 3 Calculate the residual table. Subtract the expected value from the original value. -17.5 20.5 0.75 -3.75 8.5 4.5 -5.25 -7.75 9.5 -7.5 2.75 -4.75 -0.5 -17.5 1.75 16.25 Calculate the χ2-table. Square the residual value and divide by the expected. As we want a final value to 2 d.p., calculate to 3 d.p. 13.611 12.931 0.021 1.815 3.211 0.623 1.011 7.75 4.011 1.731 0.278 2.911 0.011 9.423 0.112 34.073 The test statistic is the sum of all the values in the table 93.52 to 2 d.p.
  • 24. Example 3 We now find our critical value. The degree of freedom will be (4 − 1) × (4 − 1) = 9. We consult our table and get a critical value of 21.67. Our test statistic larger than our critical value so we decide to reject our null hypothesis. We conclude that the weather depends on the season.