SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
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.

Weitere ähnliche Inhalte

Was ist angesagt?

C2 st lecture 6 handout
C2 st lecture 6 handoutC2 st lecture 6 handout
C2 st lecture 6 handoutfatima d
 
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 1bweldon
 
Maths Revision - GCSE And Additional Notes
Maths Revision - GCSE And Additional NotesMaths Revision - GCSE And Additional Notes
Maths Revision - GCSE And Additional NotesKatie B
 
Additional Mathematics Revision
Additional Mathematics RevisionAdditional Mathematics Revision
Additional Mathematics RevisionKatie B
 
Graphs linear equations and functions
Graphs linear equations and functionsGraphs linear equations and functions
Graphs linear equations and functionsanwarsalamappt
 
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 1musadoto
 
Gcse revision cards checked 190415
Gcse revision cards checked 190415Gcse revision cards checked 190415
Gcse revision cards checked 190415claire meadows-smith
 
1539 graphs linear equations and functions
1539 graphs linear equations and functions1539 graphs linear equations and functions
1539 graphs linear equations and functionsDr Fereidoun Dejahang
 
Introduction to Functions
Introduction to FunctionsIntroduction to Functions
Introduction to FunctionsMelanie Loslo
 
Advanced algebra
Advanced algebraAdvanced algebra
Advanced algebraspark21
 
Linear equations inequalities and applications
Linear equations inequalities and applicationsLinear equations inequalities and applications
Linear equations inequalities and applicationsvineeta yadav
 

Was ist angesagt? (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
 

Ähnlich wie χ2-test Lecture

Ähnlich wie χ2-test Lecture (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
 

Mehr von fatima d

10 terrorism
10 terrorism10 terrorism
10 terrorismfatima d
 
09 non governmental organisations
09  non governmental organisations09  non governmental organisations
09 non governmental organisationsfatima d
 
17 china and the developing world
17 china and the developing world17 china and the developing world
17 china and the developing worldfatima d
 
16 development assistance
16 development assistance16 development assistance
16 development assistancefatima d
 
15 development issues
15 development issues15 development issues
15 development issuesfatima d
 
12b beyond unipolarity
12b beyond unipolarity12b beyond unipolarity
12b beyond unipolarityfatima d
 
12a beyond bipolarity fukuyama and huntington
12a  beyond bipolarity   fukuyama and huntington12a  beyond bipolarity   fukuyama and huntington
12a beyond bipolarity fukuyama and huntingtonfatima d
 
Un covenant economioc social cultural
Un covenant economioc social culturalUn covenant economioc social cultural
Un covenant economioc social culturalfatima d
 
Un covenant civil political rights
Un covenant civil political rightsUn covenant civil political rights
Un covenant civil political rightsfatima d
 
Cairo declaration 1990
Cairo declaration 1990Cairo declaration 1990
Cairo declaration 1990fatima d
 
Un declaration of human rights
Un declaration of human rightsUn declaration of human rights
Un declaration of human rightsfatima 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 handoutfatima 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 solsfatima d
 
Foundation c2 exam may 2013 sols
Foundation c2 exam may 2013 solsFoundation c2 exam may 2013 sols
Foundation c2 exam may 2013 solsfatima 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 solsfatima d
 
Ft test b jan 2012 sols
Ft test b jan 2012 solsFt test b jan 2012 sols
Ft test b jan 2012 solsfatima d
 
Foundation c2 exam august 2012 sols
Foundation c2 exam august 2012 solsFoundation c2 exam august 2012 sols
Foundation c2 exam august 2012 solsfatima 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 intimacyfatima 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_transformationfatima d
 
Homework reading task government and politics
Homework reading task government and politicsHomework reading task government and politics
Homework reading task government and politicsfatima d
 

Mehr von 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
 

Kürzlich hochgeladen

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 

Kürzlich hochgeladen (20)

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 

χ2-test Lecture

  • 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.