Chi-Square Distributions
description
Transcript of Chi-Square Distributions
![Page 1: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/1.jpg)
Chi-Square Distributions
![Page 2: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/2.jpg)
Recap• Analyze data and test hypothesis• Type of test depends on:• Data available• Question we need to answer
• What do we use to examine patterns between categorical variables?• Gender• Location• Preferences
![Page 3: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/3.jpg)
t-distribution
5.02.50.0-2.5-5.0
0.4
0.3
0.2
0.1
0.0
X
Dens
ity
Distribution PlotT
df = 4df = 100
![Page 4: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/4.jpg)
F-distribution
6543210
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
X
Dens
ity
Distribution PlotF, df1=6, df2=10
![Page 5: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/5.jpg)
χ-square distribution
302520151050
0.5
0.4
0.3
0.2
0.1
0.0
X
Dens
ity
Distribution PlotChi-Square
df = 4
df = 2
df = 10
![Page 6: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/6.jpg)
Cumulative Probability
![Page 7: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/7.jpg)
distribution• Goodness of fit• Test for homogeneity• Test for independence
![Page 8: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/8.jpg)
Goodness of Fit• Testing one categorical value from a single population• Example:• A manufacturer of baseball cards claims
• 30% of all cards feature rookies• 60% feature veterans• 10% feature all-stars
Refe
renc
e: h
ttp:/
/sta
ttrek
.com
/Les
son3
/Chi
Squa
re.a
spx
![Page 9: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/9.jpg)
Assumptions• Data is collected from a simple random sample (SRS)• Population is at least 10 times larger than sample• Variable is categorical• Expected value for each level of the variable is at least 5
![Page 10: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/10.jpg)
Steps in the Process• State the hypothesis• Form an analysis plan• Analyze sample data • Interpret results
![Page 11: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/11.jpg)
Goodness of Fit• State the hypothesis• Null: The data are consistent with a specified distribution• Alternative: The data are not consistent with a specified
distribution• At least one of the expected values is not accurate
• Baseball card example• 1
![Page 12: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/12.jpg)
Goodness of Fit• Analysis Plan• Specify the significance level
• Determine the test method• Goodness of fit• Independence• Homogeneity
![Page 13: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/13.jpg)
Goodness of Fit• Analyze the sample data• Find the degrees of freedom
• d.f.= k-1, where k=the number of levels for the distribution• Determine the expected frequency counts
• Expected frequency (E) = sample size x hypothesized proportion
• Determine the test statistic
• Interpret the results
![Page 14: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/14.jpg)
Goodness of fit example
Problem• Acme Toy Company prints baseball cards. The company claims
that 30% of the cards are rookies, 60% veterans, and 10% are All-Stars. The cards are sold in packages of 100.
• Suppose a randomly-selected package of cards has 50 rookies, 45 veterans, and 5 All-Stars. Is this consistent with Acme's claim? Use a 0.05 level of significance.
![Page 15: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/15.jpg)
Using Excel to find • Determine • Create 2 columns: n and p, and enter appropriate values• In the 3rd column:
n p E sub i100 0.6 60100 0.3 30100 0.1 10
![Page 16: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/16.jpg)
Another G of F problem• Poisson Distribution• Automobiles leaving the paint department of an assembly
plant are subjected to a detailed examination of all exterior painted surfaces.
• For the most recent 380 automobiles produced, the number of blemishes per car is summarized below.
• Level of significance:
Blemishes 0 1 2 3 4
# of cars 242 94 38 4 2
![Page 17: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/17.jpg)
Using Excel to find • Determine• Add a 4th column to the spreadsheet: • In the 5th column, calculate each element of the statistic
• =(D2-C2)^2/C2• Sum the values of the 5th column
• This is the value, the test statistic
• Use the calculator to find the value of p, and interpret the test results.
n p E sub i O sub i100 0.6 60 45 3.75100 0.3 30 50 13.333100 0.1 10 5 2.50
19.583
![Page 18: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/18.jpg)
Test for homogeneity• Single categorical variable from 2 populations• Test if frequency counts are distributed identically across both
populations• Example: Survey of TV viewing audiences. Do viewing
preferences of men and women differ significantly?• We make the same assumptions we did for the goodness of fit
test• Data is collected from a simple random sample (SRS)• Population is at least 10 times larger than sample• Variable is categorical• Expected value for each level of the variable is at least 5
• We use the same approach to testing
![Page 19: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/19.jpg)
State the hypothesis• Data collected from r populations• Categorical variable has c levels• Null hypothesis is that each population has the same
proportion of observations, i.e.:H0: Plevel 1, pop 1 = Plevel 1, pop 2 =… = Plevel 1. pop r
H0; Plevel 2, pop 1 = Plevel 2, pop 2 - … = Plevel 2, pop r
…H0: Plevel c, pop 1 = Plevel c, pop 2=…=Plevel c, pop r
• Alternative hypothesis: at least one of the null statements if false
![Page 20: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/20.jpg)
Analyze the sample data• Find• Degrees of freedom• Expected frequency counts• Test statistic ()• p-value or critical value
![Page 21: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/21.jpg)
Analyze the sample data• Degrees of freedom• d.f.=(r-1) x (c-1)• Where
• r= number of populations• c= number of categorical values
![Page 22: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/22.jpg)
Analyze the sample data• Expected frequency counts• Computed separately for each population at each categorical
variable
• Where:• = expected frequency count of each population• = number of observations from each population• = number of observations from each category/treatment level
![Page 23: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/23.jpg)
Analyze the sample data• Determine the test statistic
• Determine the p-value or critical value
![Page 24: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/24.jpg)
Test for homogeneity
Problem• In a study of the television viewing habits of children, a
developmental psychologist selects a random sample of 300 fifth graders - 100 boys and 200 girls. Each child is asked which of the following TV programs they like best.
Family Guy South Park The Simpsons Total
Boys 50 30 20 100
Girls 50 80 70 200
Total 100 110 90 300
![Page 25: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/25.jpg)
State the hypotheses• Null hypothesis: The proportion of boys who prefer Family Guy is
identical to the proportion of girls. Similarly, for the other programs. Thus:H0: Pboys who like Family Guy = Pgirls who like Family Guy
H0: Pboys who like South Park = Pgirls who like South Park
H0: Pboys who like The Simpsons = Pgirls who like The Simpsons
• Alternative hypothesis: At least one of the null hypothesis statements is false.
![Page 26: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/26.jpg)
Analysis plan• Compute • Degrees of freedom• Expected frequency counts• Chi-square test statistic
• Degrees of freedom
• Where:• = number of population elements• = number of categories/treatment levels
• In this case
![Page 27: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/27.jpg)
Analysis plan
Compute the expected frequency countsEr,c = (nr * nc) / nE1,1 = (100 * 100) / 300 = 10000/300 = 33.3E1,2 = (100 * 110) / 300 = 11000/300 = 36.7E1,3 = (100 * 90) / 300 = 9000/300 = 30.0E2,1 = (200 * 100) / 300 = 20000/300 = 66.7E2,2 = (200 * 110) / 300 = 22000/300 = 73.3E2,3 = (200 * 90) / 300 = 18000/300 = 60.0
Family Guy South Park The Simpsons Total
Boys 50 30 20 100
Girls 50 80 70 200
Total 100 110 90 300
![Page 28: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/28.jpg)
Analysis plan• Determine the test statistic
Family Guy South Park The Simpsons Total
Boys 50 (33.3) 30 (36.7) 20 (30.0) 100
Girls 50 (66.7) 80 (73.3) 70 (60.0) 200
Total 100 110 90 300
![Page 29: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/29.jpg)
Analysis plan• p-value• use the Chi-Square Distribution Calculator to find
P(Χ2 > 19.91) = 1.0000• Interpret the results
![Page 30: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/30.jpg)
Test for independence• Almost identical to test for homogeneity• Test for homogeneity: Single categorical variable from 2
populations• Test for independence: 2 categorical variables from a single
population• Determine if there is a significant association between the 2
variables
• Example• Voters are classified by gender and by party affiliation (D,R,I). • Use X2 test to determine if gender is related to voting preference
(are the variables independent?)
![Page 31: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/31.jpg)
Test for independence• Same assumptions• Same approach to testing• Hypotheses• Suppose variable A has r levels and variable B has c levels. The
null hypothesis states that knowing the level of A does not help you predict the level of B. The variables are independent.
• H0: Variables A and B are independent• Ha: Variables A and B are not independent
• Knowing A will help you predict B• Note: Relationship does not have to be causal to show
dependence
![Page 32: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/32.jpg)
Test for independence
Problem• A public opinion poll surveyed a simple random sample of
1000 voters. Respondents were classified by gender (male or female) and by voting preference (Republican, Democrat, or Independent). Do men’s preferences differ significantly from women’s?
Republican Democrat Independent Total
Men 200 150 50 400
Women 250 300 50 600
Total 450 450 100 1000
![Page 33: Chi-Square Distributions](https://reader033.fdocuments.us/reader033/viewer/2022061520/568161d7550346895dd1ddf9/html5/thumbnails/33.jpg)
Test for independence• Hypotheses• H0: Gender and voting preferences are independent. • Ha: Gender and voting preferences are not independent.
• Analyze sample data• Degrees of freedom• Expected frequency counts• Chi-square statistic• p-value or critical value
• Interpret the results