SlideShare a Scribd company logo
1 of 25
Section 9
Chi Square and ANOVA Tests
Rhonda Knehans Drake
Associate Professor, New York University
Data Analytics, Interpretation and Reporting
Copyright © 2013
2
• Sometimes we want to evaluate the equality of more than 2
categories or groups.
• For example is the average weight loss among three diet plans
the
same or are they different.
• We cannot do this using the methods taught in Section 7.
• In Section 7 we only learned how to evaluate one or two
groups for
significance.
• To compare more than two groups we use the following tests:
1. Chi Square Tests
2. ANOVA Tests
Introduction
3
• In Section 7 we learned how to compare the percentages of
two
groups for similarity.
• When you wish to assess or compare the percentages of more
than 2 groups for similarity you will employ the Chi-Square
test.
There are two types of Chi-Square tests:
1. Goodness of Fit – does the distribution of the data fit a
specific pattern?
2. Test of Independence – is there any difference in the
distribution of data for two or more groups?
Chi Square Tests
4
Example:
You sample 100 people in NY arrested for drunk driving last
year and
note their age.
Based on this data can you conclude the proportion of people
arrested
is different or the same for each age group?
Our formal hypothesis we are testing is:
• H0: Drunk drivers are distributed equally across all age
categories
• H1: Drunk drivers are not distributed equally across all age
categories
• To decide whether to accept H0 or reject H0 in favor of H1,
we
calculate the good of fit “Test Statistic” as shown on the next
slide.
Age 16 - 25 26 - 35 36 - 45 46 - 55 56+
Arrested 32 25 19 16 8
Goodness of Fit I
5
Goodness of Fit II
6
Goodness of Fit III
1.
2.
3.
4.
5.
7
• Note that our goodness of fit test does not always have to be
a test for an equal distribution across categories.
• For example reconsidering our drunk driving example we
could have also tested that the distribution is the same as last
years or is the same as in another state.
• Let’s consider another example here.
Goodness of Fit IV
8
Example:
In 2000, American Express asked a sample of 400 women over
45
who made financial decisions in the household.
In 2010, they asked 400 women again.
Are the distribution of responses in 2010 the same as in 2000 or
have they shifted?
Goodness of Fit V
9
Goodness of Fit VI
10
• If you are instead interested in determining if there is a
difference in data distributions for different groups, then we
conduct a test of independence
• This is the second type of Chi-Square test
Test of Independence I
11
Example:
A sample of 300 adults were asked if they favor giving high
school
teachers more freedom to punish students for acting violent.
Results are shown by gender:
Do the opinions differ by gender is a natural question here.
Our formal hypothesis we are testing is:
• H0: Opinions do not differ by gender – gender and opinion are
independent of each other
• H1: Opinions do differ by gender – gender and opinion are
dependent on one another
To decide whether to accept H0 or reject H0 in favor of H1, we
calculate the
“Test Statistic” associated with the test of independence.
Favor Against No Opinion Total
Men 93 70 12 175
Women 87 32 6 125
Toal 180 102 18 300
Test of Independence II
12
To calculate our test statistics we follow the steps outlined
below
Step 1/2:
– First determine the numbers we would expect in each cell if
they
were independent.
– If they were independent we would expect to see the same
percent of men answering in favor as women, the same percent
against, and so on.
– We calculate this as shown below:
Favor Against No Opinion Total
Male
If opinion is independent of
gender then we would expect
60% of the males to be in
favor or .60 x 175 = 105
If opinion is independent
of gender then we would
expect 34% of the males
to be against or .34 x 175
= 59.5
If opinion is
independent of gender
then we would expect
6% of the males to
have no opinion or .06
x 175 = 10.5
175
Female
If opinion is independent of
gender then we would expect
60% of the females to be in
favor or .60 x 125 = 75
If opinion is independent
of gender then we would
expect 34% of the
females to be against or
.34 x 125 = 42.5
If opinion is
independent of gender
then we would expect
6% of the females to
have no opinion or .06
x 125 = 7.5
125
Total 180/300 = 60.0% 102/300 = 34.0% 18/300 = 6.0% 300
Test of Independence III
13
Step 2/2: We then calculate our test statistic as follows:
Test of Independence IV
14
Test of Independence V
15
Let’s consider another example:
A sample of students across the US were asked their GPA and if
they
binge drink regularly (defined as 5+ drinks at one time more
than
three times per week).
Results are shown below by GPA.
Binge Do Not Binge Total
High GPA 1,260 3,588 4,848
Average GPA 2,157 4,186 6,343
Low GPA 441 497 938
Total 3,858 8,271 12,129
Test of Independence VI
16
Let’s consider another example (continue….):
• Do the percent that binge differ by quality of student?
Our formal hypothesis we are testing is:
– H0: Percent that binge or do not binge are the same by quality
of student –
showing independence
– H1: Percent that binge or do not binge are not the same by
quality of
student – showing dependence
To decide whether to accept H0 or reject H0 in favor of H1, we
calculate the “Test Statistic” associated with the test of
independence.
Test of Independence VII
17
• To calculate our test statistics we first calculate the number
of students that fall into each cell if there is no relationship
between binge drinking and quality of student as shown
below:
Binge Do Not Binge Total
High GPA
If binge is independent of
student quality then we
would expect 31.81% of
the best students to binge
or .3181 x 4,848 =
1,542.05
Expected = 3,305.95 4,848
Average GPA Expected = 2,017.59 Expected = 4325.41 6,343
Low GPA Expected = 298.36 Expected = 639.64 938
Total 3,858/12129 = 31.81%
8,271/12,129 =
68.19%
12,129
Test of Independence VIII
18
Next we calculate our test statistic as follows:
• We reject H0 and conclude H1 is true if the value of the excel
function 1 – CHISDIST(TS Value, (R-1)(C-1)) is greater than
90%.
• In this example 1-CHIDIST(189.78, 2) = 1-0 = 1 or 100%
• Hence we reject H0 and conclude that the binge drinking is
dependent on quality of student.
Test of Independence IX
19
• In Section 7 we learned how to compare the averages or means
of two groups for similarity.
• When you wish to assess or compare the averages or means
of more than 2 groups for similarity you will conduct an
Analysis of Variance or ANOVA test.
Analysis of Variance (ANOVA) I
20
Example:
Fifteen fourth graders were selected and assigned to 3 groups in
order
to assess 3 different math teaching methods. At the end of the
semester, each student was given a common math test.
Results of the tests by group follow.
Based on this data can you conclude any difference in the three
teaching methods based on these test scores?
Method 1 Method 2 Method 3
48
73
51
61
87
55
85
70
69
90
84
68
95
74
67
Analysis of Variance (ANOVA) II
21
Our formal hypothesis we are testing is:
– H0: Teaching methods do not differ
– H1: There is a difference in teaching methods
To decide whether to accept H0 or reject H0 in favor of H1, we
calculate the “Test Statistic” associated with the ANOVA test.
This entails six steps.
Analysis of Variance (ANOVA) III
22
• Step 1:
– Calculate the following for each teaching method:
Analysis of Variance (ANOVA) IV
23
Analysis of Variance (ANOVA) V
• Step 2:
–
24
Analysis of Variance (ANOVA) VI
• Step 2 (continue...)
25
Analysis of Variance (ANOVA) VII
• Step 3:
–
26
• Step 4:
• Calculate MSB = SSB / (k – 1)
where k = # of categories
• Step 5:
• Calculate MSW = SSW / (n – k)
where n = total number of observations in study
Analysis of Variance (ANOVA) VIII
MSB = 492/2
MSB = 246
MSW = 2,384/12
MSW = 198.7
27
• Step 5:
• Calculate the Test Statistics TS = MSB / MSW
• Step 6:
• Reject H0 and accept H1 that there is a difference between
groups if 1 – FDIST (TS value, k – 1, n – k) is greater than
90%.
Analysis of Variance (ANOVA) IX
TS = 246/198.7
TS = 1.24
1 – FDIST (1.24 , 2 , 12) = 0.324
1 – 0.324 = 0.676 or 67.6%
We don’t have any statistical prove to say they are different
28
First you input the data in excel
Analysis of Variance (ANOVA) I
• We can also do ANOVA in Excel:
(Excel)
29
You then choose the ANOVA Single
Factor feature within the data analysis
area.
Analysis of Variance (ANOVA) II
(Excel)
30
You then highlight your data, check off
the labels option and input where you
wish to anchor the output.
Analysis of Variance (ANOVA) III
(Excel)
31
Your test statistic value
One minus this value
gives you your
probability of 68%
Analysis of Variance (ANOVA) IV
(Excel)
32
9.1 Home Mail Corporation sells products by mail. The
company’s
management wants to find out if the number of orders received
on each of
the five days of the week is the same. The company took a
sample of 400
orders received during a four-week period. The following table
lists the
frequency distribution for these orders by the day of the week.
Conduct a
goodness of fit test to determine if the distribution of orders is
equally
distributed by day of the week.
9.2 One hundred auto drivers, who were stopped by police for
some violation,
were also checked to see if they were wearing their seat belts.
The
following table shows the results of this survey. Conduct a test
of
independence to determine if seat belt usage differs by gender.
Day of Week Mon Tue Wed Thur Fri
Number of Orders 92 68 65 86 89
Wearing
Seatbelt
Not Wearing
Seatbelt
Male 34 21
Female 30 15
Section 9 Exercises I
33
9.3 Two drugs were administered to two groups of patients to
cure the same
disease. One group of 60 patients and another group of 40
patients were
selected. The following table gives information about the
number of
patents who were cured and not cured by drug. Conduct a test of
independence to determine if each drug is as equally effective
in curing the
patients.
Cured Not Cured
Drug I 46 14
Drug II 18 22
Section 9 Exercises II
34
9.4 A large company buys thousands of light bulbs every year.
The company
is currently considering four brands of light bulbs to choose
from. Before
the company decides which light bulbs to buy, it wants to
investigate if the
mean life of the four types of light bulbs is the same. The
company’s
facilities department randomly selected a few bulbs of each type
and
tested them. The following table lists the number of hours (in
thousands)
that each of the bulbs by brand survived before burning out.
Conduct an
ANOVA in EXCEL to determine if mean life of these four
brands are the
same or different. If you have time also try to do by hand.
Brand 1 Brand 2 Brand 3 Brand 4
23 19 23 26
24 23 27 24
19 18 25 21
26 24 26 29
22 20 23 28
23 22 21 24
25 19 27 28
Section 9 Exercises III

More Related Content

Similar to Section 9 Chi Square and ANOVA Tests Rhonda Knehans Dr.docx

WEEK 6 – EXERCISES Enter your answers in the spaces pr.docx
WEEK 6 – EXERCISES Enter your answers in the spaces pr.docxWEEK 6 – EXERCISES Enter your answers in the spaces pr.docx
WEEK 6 – EXERCISES Enter your answers in the spaces pr.docx
wendolynhalbert
 
Data File 5Chapter NineShow all workProblem 1)A skeptica.docx
Data File 5Chapter NineShow all workProblem 1)A skeptica.docxData File 5Chapter NineShow all workProblem 1)A skeptica.docx
Data File 5Chapter NineShow all workProblem 1)A skeptica.docx
theodorelove43763
 
Assignment 2 Tests of SignificanceThroughout this assignment yo.docx
Assignment 2 Tests of SignificanceThroughout this assignment yo.docxAssignment 2 Tests of SignificanceThroughout this assignment yo.docx
Assignment 2 Tests of SignificanceThroughout this assignment yo.docx
rock73
 
The role of statistics and the data analysis process.ppt
The role of statistics and the data analysis process.pptThe role of statistics and the data analysis process.ppt
The role of statistics and the data analysis process.ppt
JakeCuenca10
 
statisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docx
statisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docxstatisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docx
statisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docx
rafaelaj1
 
Using the data in the file named Ch. 11 Data Set 2, test the resea.docx
Using the data in the file named Ch. 11 Data Set 2, test the resea.docxUsing the data in the file named Ch. 11 Data Set 2, test the resea.docx
Using the data in the file named Ch. 11 Data Set 2, test the resea.docx
daniahendric
 

Similar to Section 9 Chi Square and ANOVA Tests Rhonda Knehans Dr.docx (20)

Chi-square test.pptx
Chi-square test.pptxChi-square test.pptx
Chi-square test.pptx
 
WEEK 6 – EXERCISES Enter your answers in the spaces pr.docx
WEEK 6 – EXERCISES Enter your answers in the spaces pr.docxWEEK 6 – EXERCISES Enter your answers in the spaces pr.docx
WEEK 6 – EXERCISES Enter your answers in the spaces pr.docx
 
Non-parametric-tests.pptx
Non-parametric-tests.pptxNon-parametric-tests.pptx
Non-parametric-tests.pptx
 
INDEPENDENT SAMPLE T TEST.pptx
INDEPENDENT SAMPLE T TEST.pptxINDEPENDENT SAMPLE T TEST.pptx
INDEPENDENT SAMPLE T TEST.pptx
 
5. testing differences
5. testing differences5. testing differences
5. testing differences
 
Statr session 21 and 22
Statr session 21 and 22Statr session 21 and 22
Statr session 21 and 22
 
6.hypothesistesting.06
6.hypothesistesting.066.hypothesistesting.06
6.hypothesistesting.06
 
Statistical-Tests-and-Hypothesis-Testing.pptx
Statistical-Tests-and-Hypothesis-Testing.pptxStatistical-Tests-and-Hypothesis-Testing.pptx
Statistical-Tests-and-Hypothesis-Testing.pptx
 
Data File 5Chapter NineShow all workProblem 1)A skeptica.docx
Data File 5Chapter NineShow all workProblem 1)A skeptica.docxData File 5Chapter NineShow all workProblem 1)A skeptica.docx
Data File 5Chapter NineShow all workProblem 1)A skeptica.docx
 
non parametric statistics
non parametric statisticsnon parametric statistics
non parametric statistics
 
Assignment 2 Tests of SignificanceThroughout this assignment yo.docx
Assignment 2 Tests of SignificanceThroughout this assignment yo.docxAssignment 2 Tests of SignificanceThroughout this assignment yo.docx
Assignment 2 Tests of SignificanceThroughout this assignment yo.docx
 
Hypothesis Testing
Hypothesis TestingHypothesis Testing
Hypothesis Testing
 
statistical test.pptx
statistical test.pptxstatistical test.pptx
statistical test.pptx
 
NON-PARAMETRIC TESTS by Prajakta Sawant
NON-PARAMETRIC TESTS by Prajakta SawantNON-PARAMETRIC TESTS by Prajakta Sawant
NON-PARAMETRIC TESTS by Prajakta Sawant
 
The role of statistics and the data analysis process.ppt
The role of statistics and the data analysis process.pptThe role of statistics and the data analysis process.ppt
The role of statistics and the data analysis process.ppt
 
statisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docx
statisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docxstatisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docx
statisticscf_choose_a_statistical_test (1) (1).pptxIndependen.docx
 
Statistics using SPSS
Statistics using SPSSStatistics using SPSS
Statistics using SPSS
 
ritika saini.pptx
ritika saini.pptxritika saini.pptx
ritika saini.pptx
 
Using the data in the file named Ch. 11 Data Set 2, test the resea.docx
Using the data in the file named Ch. 11 Data Set 2, test the resea.docxUsing the data in the file named Ch. 11 Data Set 2, test the resea.docx
Using the data in the file named Ch. 11 Data Set 2, test the resea.docx
 
Topic 10 DATA ANALYSIS TECHNIQUES.pptx
Topic 10 DATA ANALYSIS TECHNIQUES.pptxTopic 10 DATA ANALYSIS TECHNIQUES.pptx
Topic 10 DATA ANALYSIS TECHNIQUES.pptx
 

More from kenjordan97598

You are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docxYou are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docx
kenjordan97598
 
You are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docxYou are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docx
kenjordan97598
 
You are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docxYou are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docx
kenjordan97598
 
You are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docxYou are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docx
kenjordan97598
 
You are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docxYou are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docx
kenjordan97598
 
You are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docxYou are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docx
kenjordan97598
 
You are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docxYou are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docx
kenjordan97598
 
You are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docxYou are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docx
kenjordan97598
 

More from kenjordan97598 (20)

You are the Nursing Director for the medical-surgical area of a .docx
You are the Nursing Director for the medical-surgical area of a .docxYou are the Nursing Director for the medical-surgical area of a .docx
You are the Nursing Director for the medical-surgical area of a .docx
 
You are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docxYou are the newly appointed director of the Agile County Airport.docx
You are the newly appointed director of the Agile County Airport.docx
 
You are working on an address book database with a table called Cont.docx
You are working on an address book database with a table called Cont.docxYou are working on an address book database with a table called Cont.docx
You are working on an address book database with a table called Cont.docx
 
You are the new Security Manager for a small bank in Iowa. They are .docx
You are the new Security Manager for a small bank in Iowa. They are .docxYou are the new Security Manager for a small bank in Iowa. They are .docx
You are the new Security Manager for a small bank in Iowa. They are .docx
 
You are working in a rural Family Planning Health clinic and a 16 y.docx
You are working in a rural Family Planning Health clinic and a 16 y.docxYou are working in a rural Family Planning Health clinic and a 16 y.docx
You are working in a rural Family Planning Health clinic and a 16 y.docx
 
You are working in a family practice when your newly diagnosed T.docx
You are working in a family practice when your newly diagnosed T.docxYou are working in a family practice when your newly diagnosed T.docx
You are working in a family practice when your newly diagnosed T.docx
 
You are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docxYou are working for the Chief of Staff (CoS) for a newly elected Gov.docx
You are working for the Chief of Staff (CoS) for a newly elected Gov.docx
 
You are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docxYou are working at Johnson and Cohen law firm and have recently .docx
You are working at Johnson and Cohen law firm and have recently .docx
 
You are working for a community counseling agency, and you are taske.docx
You are working for a community counseling agency, and you are taske.docxYou are working for a community counseling agency, and you are taske.docx
You are working for a community counseling agency, and you are taske.docx
 
You are working as the software tester for a big enterprise comp.docx
You are working as the software tester for a big enterprise comp.docxYou are working as the software tester for a big enterprise comp.docx
You are working as the software tester for a big enterprise comp.docx
 
You are working as HelpDesk Support for an organization where your u.docx
You are working as HelpDesk Support for an organization where your u.docxYou are working as HelpDesk Support for an organization where your u.docx
You are working as HelpDesk Support for an organization where your u.docx
 
You are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docxYou are working as an APRN in your local primary care office. Th.docx
You are working as an APRN in your local primary care office. Th.docx
 
You are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docxYou are the new Public Information Officer (PIO) assigned by the.docx
You are the new Public Information Officer (PIO) assigned by the.docx
 
You are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docxYou are welcome to go to the San Diego Zoo any time you would li.docx
You are welcome to go to the San Diego Zoo any time you would li.docx
 
You are visiting one of your organization’s plants in a poor nation..docx
You are visiting one of your organization’s plants in a poor nation..docxYou are visiting one of your organization’s plants in a poor nation..docx
You are visiting one of your organization’s plants in a poor nation..docx
 
You are to write a four-page (typed, double-spaced) essay addressing.docx
You are to write a four-page (typed, double-spaced) essay addressing.docxYou are to write a four-page (typed, double-spaced) essay addressing.docx
You are to write a four-page (typed, double-spaced) essay addressing.docx
 
You are to write a 7-page Biographical Research Paper of St Franci.docx
You are to write a 7-page Biographical Research Paper of St Franci.docxYou are to write a 7-page Biographical Research Paper of St Franci.docx
You are to write a 7-page Biographical Research Paper of St Franci.docx
 
You are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docxYou are to write a 1050 to 1750 word literature review (in a.docx
You are to write a 1050 to 1750 word literature review (in a.docx
 
You are to take the uploaded assignment and edit it. The title shoul.docx
You are to take the uploaded assignment and edit it. The title shoul.docxYou are to take the uploaded assignment and edit it. The title shoul.docx
You are to take the uploaded assignment and edit it. The title shoul.docx
 
You are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docxYou are to use a topic for the question you chose.WORD REQUIRE.docx
You are to use a topic for the question you chose.WORD REQUIRE.docx
 

Recently uploaded

Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Recently uploaded (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

Section 9 Chi Square and ANOVA Tests Rhonda Knehans Dr.docx

  • 1. Section 9 Chi Square and ANOVA Tests Rhonda Knehans Drake Associate Professor, New York University Data Analytics, Interpretation and Reporting Copyright © 2013 2 • Sometimes we want to evaluate the equality of more than 2 categories or groups. • For example is the average weight loss among three diet plans the same or are they different. • We cannot do this using the methods taught in Section 7. • In Section 7 we only learned how to evaluate one or two groups for significance.
  • 2. • To compare more than two groups we use the following tests: 1. Chi Square Tests 2. ANOVA Tests Introduction 3 • In Section 7 we learned how to compare the percentages of two groups for similarity. • When you wish to assess or compare the percentages of more than 2 groups for similarity you will employ the Chi-Square test. There are two types of Chi-Square tests: 1. Goodness of Fit – does the distribution of the data fit a specific pattern? 2. Test of Independence – is there any difference in the distribution of data for two or more groups? Chi Square Tests
  • 3. 4 Example: You sample 100 people in NY arrested for drunk driving last year and note their age. Based on this data can you conclude the proportion of people arrested is different or the same for each age group? Our formal hypothesis we are testing is: • H0: Drunk drivers are distributed equally across all age categories • H1: Drunk drivers are not distributed equally across all age categories • To decide whether to accept H0 or reject H0 in favor of H1, we calculate the good of fit “Test Statistic” as shown on the next slide. Age 16 - 25 26 - 35 36 - 45 46 - 55 56+ Arrested 32 25 19 16 8 Goodness of Fit I
  • 4. 5 Goodness of Fit II 6 Goodness of Fit III 1. 2. 3. 4. 5. 7 • Note that our goodness of fit test does not always have to be a test for an equal distribution across categories. • For example reconsidering our drunk driving example we could have also tested that the distribution is the same as last years or is the same as in another state. • Let’s consider another example here.
  • 5. Goodness of Fit IV 8 Example: In 2000, American Express asked a sample of 400 women over 45 who made financial decisions in the household. In 2010, they asked 400 women again. Are the distribution of responses in 2010 the same as in 2000 or have they shifted? Goodness of Fit V 9 Goodness of Fit VI
  • 6. 10 • If you are instead interested in determining if there is a difference in data distributions for different groups, then we conduct a test of independence • This is the second type of Chi-Square test Test of Independence I 11 Example: A sample of 300 adults were asked if they favor giving high school teachers more freedom to punish students for acting violent. Results are shown by gender: Do the opinions differ by gender is a natural question here. Our formal hypothesis we are testing is: • H0: Opinions do not differ by gender – gender and opinion are independent of each other • H1: Opinions do differ by gender – gender and opinion are dependent on one another
  • 7. To decide whether to accept H0 or reject H0 in favor of H1, we calculate the “Test Statistic” associated with the test of independence. Favor Against No Opinion Total Men 93 70 12 175 Women 87 32 6 125 Toal 180 102 18 300 Test of Independence II 12 To calculate our test statistics we follow the steps outlined below Step 1/2: – First determine the numbers we would expect in each cell if they were independent. – If they were independent we would expect to see the same percent of men answering in favor as women, the same percent against, and so on.
  • 8. – We calculate this as shown below: Favor Against No Opinion Total Male If opinion is independent of gender then we would expect 60% of the males to be in favor or .60 x 175 = 105 If opinion is independent of gender then we would expect 34% of the males to be against or .34 x 175 = 59.5 If opinion is independent of gender then we would expect 6% of the males to have no opinion or .06 x 175 = 10.5
  • 9. 175 Female If opinion is independent of gender then we would expect 60% of the females to be in favor or .60 x 125 = 75 If opinion is independent of gender then we would expect 34% of the females to be against or .34 x 125 = 42.5 If opinion is independent of gender then we would expect 6% of the females to have no opinion or .06 x 125 = 7.5 125
  • 10. Total 180/300 = 60.0% 102/300 = 34.0% 18/300 = 6.0% 300 Test of Independence III 13 Step 2/2: We then calculate our test statistic as follows: Test of Independence IV 14 Test of Independence V 15 Let’s consider another example: A sample of students across the US were asked their GPA and if they binge drink regularly (defined as 5+ drinks at one time more than three times per week).
  • 11. Results are shown below by GPA. Binge Do Not Binge Total High GPA 1,260 3,588 4,848 Average GPA 2,157 4,186 6,343 Low GPA 441 497 938 Total 3,858 8,271 12,129 Test of Independence VI 16 Let’s consider another example (continue….): • Do the percent that binge differ by quality of student? Our formal hypothesis we are testing is: – H0: Percent that binge or do not binge are the same by quality of student –
  • 12. showing independence – H1: Percent that binge or do not binge are not the same by quality of student – showing dependence To decide whether to accept H0 or reject H0 in favor of H1, we calculate the “Test Statistic” associated with the test of independence. Test of Independence VII 17 • To calculate our test statistics we first calculate the number of students that fall into each cell if there is no relationship between binge drinking and quality of student as shown below: Binge Do Not Binge Total High GPA If binge is independent of student quality then we would expect 31.81% of the best students to binge
  • 13. or .3181 x 4,848 = 1,542.05 Expected = 3,305.95 4,848 Average GPA Expected = 2,017.59 Expected = 4325.41 6,343 Low GPA Expected = 298.36 Expected = 639.64 938 Total 3,858/12129 = 31.81% 8,271/12,129 = 68.19% 12,129 Test of Independence VIII 18 Next we calculate our test statistic as follows: • We reject H0 and conclude H1 is true if the value of the excel function 1 – CHISDIST(TS Value, (R-1)(C-1)) is greater than 90%. • In this example 1-CHIDIST(189.78, 2) = 1-0 = 1 or 100%
  • 14. • Hence we reject H0 and conclude that the binge drinking is dependent on quality of student. Test of Independence IX 19 • In Section 7 we learned how to compare the averages or means of two groups for similarity. • When you wish to assess or compare the averages or means of more than 2 groups for similarity you will conduct an Analysis of Variance or ANOVA test. Analysis of Variance (ANOVA) I 20 Example: Fifteen fourth graders were selected and assigned to 3 groups in order to assess 3 different math teaching methods. At the end of the semester, each student was given a common math test.
  • 15. Results of the tests by group follow. Based on this data can you conclude any difference in the three teaching methods based on these test scores? Method 1 Method 2 Method 3 48 73 51 61 87 55 85 70 69 90 84
  • 16. 68 95 74 67 Analysis of Variance (ANOVA) II 21 Our formal hypothesis we are testing is: – H0: Teaching methods do not differ – H1: There is a difference in teaching methods To decide whether to accept H0 or reject H0 in favor of H1, we calculate the “Test Statistic” associated with the ANOVA test. This entails six steps. Analysis of Variance (ANOVA) III 22
  • 17. • Step 1: – Calculate the following for each teaching method: Analysis of Variance (ANOVA) IV 23 Analysis of Variance (ANOVA) V • Step 2: – 24 Analysis of Variance (ANOVA) VI • Step 2 (continue...)
  • 18. 25 Analysis of Variance (ANOVA) VII • Step 3: – 26 • Step 4: • Calculate MSB = SSB / (k – 1) where k = # of categories
  • 19. • Step 5: • Calculate MSW = SSW / (n – k) where n = total number of observations in study Analysis of Variance (ANOVA) VIII MSB = 492/2 MSB = 246 MSW = 2,384/12 MSW = 198.7 27 • Step 5: • Calculate the Test Statistics TS = MSB / MSW • Step 6: • Reject H0 and accept H1 that there is a difference between groups if 1 – FDIST (TS value, k – 1, n – k) is greater than
  • 20. 90%. Analysis of Variance (ANOVA) IX TS = 246/198.7 TS = 1.24 1 – FDIST (1.24 , 2 , 12) = 0.324 1 – 0.324 = 0.676 or 67.6% We don’t have any statistical prove to say they are different 28 First you input the data in excel Analysis of Variance (ANOVA) I • We can also do ANOVA in Excel: (Excel) 29 You then choose the ANOVA Single Factor feature within the data analysis area.
  • 21. Analysis of Variance (ANOVA) II (Excel) 30 You then highlight your data, check off the labels option and input where you wish to anchor the output. Analysis of Variance (ANOVA) III (Excel) 31 Your test statistic value One minus this value gives you your probability of 68% Analysis of Variance (ANOVA) IV (Excel)
  • 22. 32 9.1 Home Mail Corporation sells products by mail. The company’s management wants to find out if the number of orders received on each of the five days of the week is the same. The company took a sample of 400 orders received during a four-week period. The following table lists the frequency distribution for these orders by the day of the week. Conduct a goodness of fit test to determine if the distribution of orders is equally distributed by day of the week. 9.2 One hundred auto drivers, who were stopped by police for some violation, were also checked to see if they were wearing their seat belts. The following table shows the results of this survey. Conduct a test of independence to determine if seat belt usage differs by gender.
  • 23. Day of Week Mon Tue Wed Thur Fri Number of Orders 92 68 65 86 89 Wearing Seatbelt Not Wearing Seatbelt Male 34 21 Female 30 15 Section 9 Exercises I 33 9.3 Two drugs were administered to two groups of patients to cure the same disease. One group of 60 patients and another group of 40 patients were selected. The following table gives information about the number of patents who were cured and not cured by drug. Conduct a test of
  • 24. independence to determine if each drug is as equally effective in curing the patients. Cured Not Cured Drug I 46 14 Drug II 18 22 Section 9 Exercises II 34 9.4 A large company buys thousands of light bulbs every year. The company is currently considering four brands of light bulbs to choose from. Before the company decides which light bulbs to buy, it wants to investigate if the mean life of the four types of light bulbs is the same. The company’s facilities department randomly selected a few bulbs of each type and tested them. The following table lists the number of hours (in thousands) that each of the bulbs by brand survived before burning out. Conduct an
  • 25. ANOVA in EXCEL to determine if mean life of these four brands are the same or different. If you have time also try to do by hand. Brand 1 Brand 2 Brand 3 Brand 4 23 19 23 26 24 23 27 24 19 18 25 21 26 24 26 29 22 20 23 28 23 22 21 24 25 19 27 28 Section 9 Exercises III