Docsity

Two Categorical Variables Chi-Square | STAT 1000, Study notes of Data Analysis & Statistical Methods

Toggle sidebar
bg1
(C) 2007 Nancy Pfenning
Elementary Statistics: Looking at the Big Picture 1
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture
Lecture 32
Two Categorical Variables
Chi-Square
Formulating Hypotheses to Test Relationship
Test based on Proportions or on Counts
Chi-square Test
Confidence Intervals
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32.2
Looking Back: Review
4 Stages of Statistics
Data Production (discuss ed in Lectures 1-4)
Displaying and Summari zing (Lectures 5-12)
Probability (discussed in Lectures 13-20)
Statistical Inference
1 categorical (discussed in Le ctures 21-23)
1 quantitative (discussed in Le ctures 24-27)
cat and quan: paired, 2-samp le, several-sample (Lectures 28-31)
2 categorical
2 quantitative
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32.3
Inference for Relationship (Review)
and about variables: not related or related
Applies to all three CQ , CC, QQ
and about parameters: equality or not
CQ: pop means e qual?
CC: pop proportions equal?
QQ: pop slope equa ls zero?
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32.4
Example: 2 Categorical Variables: Hypotheses
Background: We are interested in whether or not
smoking plays a role in alcoholism.
Question: How would and be written
in terms of variables?
in terms of parameters?
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Two Categorical Variables Chi-Square | STAT 1000 and more Study notes Data Analysis & Statistical Methods in PDF only on Docsity!

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture

Lecture 32

Two Categorical Variables

Chi-Square

Formulating Hypotheses to Test Relationship Test based on Proportions or on Counts Chi-square Test Confidence Intervals (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 2

Looking Back: Review

4 Stages of Statistics  Data Production (discussed in Lectures 1-4)  Displaying and Summarizing (Lectures 5-12)  Probability (discussed in Lectures 13-20)  Statistical Inference  1 categorical (discussed in Lectures 21-23)  1 quantitative (discussed in Lectures 24-27)  cat and quan: paired, 2-sample, several-sample (Lectures 28-31)  2 categorical  2 quantitative (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 3

Inference for Relationship (Review)

 and about variables: not related or related  Applies to all three CQ, CC, QQ  and about parameters: equality or not  CQ: pop means equal?  CC: pop proportions equal?  QQ: pop slope equals zero? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 4

Example: 2 Categorical Variables: Hypotheses

Background : We are interested in whether or not smoking plays a role in alcoholism.  Question: How would and be written  in terms of variables?  in terms of parameters?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 6

Example: 2 Categorical Variables: Hypotheses

Background : We are interested in whether or not smoking plays a role in alcoholism.  Response:  in terms of variables  : smoking and alcoholism ________ related  : smoking and alcoholism ________ related  in terms of parameters  : Pop. proportions alcoholic _________for smokers, non-smokers  : Pop. proportions alcoholic _________for smokers, non-smokers The word “not” appears in Ho about variables, in Ha about parameters. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 7 Example: Summarizing with ProportionsBackground : Research Question: Does smoking play a role in alcoholism?  Question: What statistics from this table should we examine to answer the research question? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 9 Example: Summarizing with ProportionsBackground : Research Question: Does smoking play a role in alcoholism?  Response: Compare proportions _________ (response) for _____________________________ (explanatory). (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 10 Example: Test Statistic for ProportionsBackground : One approach to the question of whether smoking and alcoholism are related is to compare proportions.  Question: What would be the next step, if we’ve summarized the situation with the difference between sample proportions 0.130-0.013?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 16 Inference Based on Counts

To test hypotheses about relationship in

r -by- c table, compare counts observed to

counts expected if (equal proportions in

response of interest) were true.

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 17 Example: Table of Expected CountsBackground : Data on smoking and alcoholism:  Question: What counts are expected if is true? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 19 Example: Table of Expected CountsBackground : Data on smoking and alcoholism:  Response: Overall proportion alcoholic is_______ If proportions alcoholic were same for S and NS, expect  (40/1000)(230)= _____ smokers to be alcoholic  (40/1000)(770)= _____non-smokers to be alcoholic; also  (960/1000)(230)= _____ smokers not alcoholic  (960/1000)(770)= ______non-smokers not alcoholic (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 22 Example: Table of Expected Counts Expected Counts have been filled in:  Response: Overall proportion alcoholic is If proportions alcoholic were same for S and NS, expect  (40/1000)(230)= _____ smokers to be alcoholic  (40/1000)(770)= _____ non-smokers to be alcoholic;also  (960/1000)(230)= _____smokers not alcoholic  (960/1000)(770)= _____non-smokers not alcoholic

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 24 Example: Table of Expected CountsNote: Each expected count is Expect:  (40)(230)/1000 =___ smokers to be alcoholic  (40)(770)/1000 =___non-smokers to be alcoholic; also  (960)(230)/1000 =____ smokers not alcoholic  (960)(770)/1000 =____ non-smokers not alcoholic Column total x Row total Table total (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 25 Chi-Square Statistic  Components to compare observed and expected counts, one table cell at a time: Components are individual standardized squared differences.  Chi-square test statistic combines all components by summing them up: Chi-square is sum of standardized squared differences. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 26 Example: Chi-Square StatisticBackground : Observed and Expected Tables:  Question: What is? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 28 Example: Chi-Square StatisticBackground : Observed and Expected Tables:  Response: Find

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 34

Example: Assessing Chi-Square (Continued)

Background : In testing for relationship between smoking and alcoholism in 2×2 table, found  Question: Is there evidence of a relationship in general between smoking and alcoholism (not just in the sample)? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 36

Example: Assessing Chi-Square (Continued)

Background : In testing for relationship between smoking and alcoholism in 2×2 table, found  Response: For df =(2-1)×(2-1)=1, chi-square considered “large” if greater than 3.84 chi- square=64 large? ____ P -value small? ____  evidence of a relationship between smoking and alcoholism? _____ (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 37 Inference for 2 Categorical Variables; z or

For 2×2 table,

 z statistic (comparing proportions)

combined tail probability=0.05 for z =1.

 chi-square statistic (comparing counts)

right-tail prob=0.05 for

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 38 Example: Relating Chi-Square & zBackground : We found chi-square = 64 for the 2-by-2 table relating smoking and alcoholism.  Question: What would be the z statistic for a test comparing proportions alcoholic for smokers vs. non-smokers?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 40 Example: Relating Chi-Square & zBackground : We found chi-square = 64 for the 2-by-2 table relating smoking and alcoholism.  Response: (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 41 Assessing Size of Test Statistics (Summary)

When test statistic is “large”:

 z : greater than 1.96 (about 2 )

 t : depends on df ; greater than about 2 or 3

 F : depends on DFG, DFE

 ‘ depends on df =( r -1)×( c -1);

greater than 3.84 (about 4 ) if df =

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 42

Explanatory/Response: 2 Categorical Variables

 Roles impact what summaries to report

 Roles do not impact statistic or P -value

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 43 Example: Summaries Impacted by RolesBackground : Compared proportions alcoholic (resp) for smokers and non-smokers (expl).  Question: What summaries would be appropriate if alcoholism is explanatory variable?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 50 Example: Role of Sample SizeBackground : Suppose counts in smoking and alcohol two-way table were 1/10th^ the originals:  Question: Find chi-square; what do we conclude? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 52 Example: Role of Sample SizeBackground : Suppose counts in smoking and alcohol two-way table were 1/10th^ the originals:  Response: Observed counts 1/10th^  expected counts 1/10th^ chi-square 1/10th^ =____ instead of 64. However, the statistic does not follow distribution because expected counts (0.92, 22.08, 3.08, 73.92) are not all at least 5; individual dists are not normal. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 53

Confidence Intervals for 2 Categorical Variables

Evidence of relationship to what extent does explanatory variable affect response? Focus on proportions : 2 approaches  Compare confidence intervals for population proportion in response of interest (one interval for each explanatory group)  Set up confidence interval for difference between population proportions in response of interest, 1 st^ group minus 2nd^ group (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 54

Example: Confidence Intervals for 2 Proportions

Background :  Non-smokers 95% CI for pop prop alcoholic (0.005,0.021)  Smokers 95% CI for pop prop alcoholic (0.09, 0.17)  Question: What do the intervals suggest about relationship between smoking and alcoholism?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 56

Example: Confidence Intervals for 2 Proportions

Background :  Non-smokers 95% CI for pop prop alcoholic (0.005,0.021)  Smokers 95% CI for pop prop alcoholic (0.09, 0.17)  Response: Overlap? ___  Relationship between smoking and alcoholism? ____ (_____ likely to be alcoholic if a smoker). (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 57

Example: Difference between 2 Proportions (CI)

Background : 95% CI for difference between population proportions alcoholic, smokers minus non-smokers is (0.088, 0.146)  Question: What does the interval suggest about relationship between smoking and alcoholism? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L32. 59

Example: Difference between 2 Proportions (CI)

Background : 95% CI for difference between population proportions alcoholic, smokers minus non-smokers is (0.088, 0.146)  Response: Entire interval above zero suggests smokers _______ significantly more likely to be alcoholicthere ______ a relationship. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L19. 60

Lecture Summary

(Inference for Cat  Cat; Chi-Square)

 Hypotheses in terms of variables or parameters  Inference based on proportions or counts  Chi-square test  Table of expected counts  Chi-square statistic, chi-square distribution  Relating z and chi-square for 2×2 table  Relative size of chi-square statistic  Explanatory/response roles in chi-square test  Guidelines for use of chi-square  Role of sample size  Confidence intervals for 2 categorical variables