Chi-Square - Test for Homogeneity
A chi-square test for homogeneity is a test to see if different distributions are similar to each other.
Steps:
1. Define your hypotheses
Ho: The distributions are the same among all the given populations.
Ha: The distributions differ among all the given populations.
2. Find the expected counts:
-
For each cell, multiply the sum of the column it is in and the sum of the row it is in, and then divide by the total in all cells, or the sample size (row total)(column total)sample size
Example Problem:
A company wants to examine the homogeneity of auto types purchased among three states. Is there sufficient evidence that the auto types purchased among the three states is different? The data is below.
California |
Massachusetts |
Georgia |
|
Car |
90 |
97 |
61 |
SUV |
81 |
92 |
54 |
-
Define your hypotheses
-
Ho: The distributions of auto types purchased is the same for all three states.
-
HA:The distributions of auto types purchased differs among all three states.
-
-
Find expected counts
For each cell, multiply the sum of the column it is in and the sum of the row it is in, and then divide by the total in all cells (row total)(column total)sample size
Sample Calculations:
California column subtotal: 90+81=171
Car row subtotal: 90+97+61=248
Total: 90+97+61+81+92+54=475
First cell’s expected count: (171)(248)/475=89.28 (repeat for all other columns)
Key:
OBSERVED / EXPECTED
California |
Massachusetts |
Georgia |
Row Total |
|
Car |
90 / 89.28 |
97 / 98.67 |
61 / 60.04 |
248 |
SUV |
81 / 81.72 |
92 / 91.32 |
54 / 54.96 |
227 |
Column Total |
171 |
189 |
115 |
Total: 475 |
*Note: do not round the number of expected counts
-
Check conditions
-
Data are counts ✓
-
SRS ✓
-
assumed
-
-
N10n (the population size is at least 10x greater than the sample size) ✓
-
N10(475) → assumed
-
-
All of the expected counts are at least 5 ✓
-
-
Find the chi-square statistic
-
Use 2=(observed-expected)2expected
2=(90-89.28)289.28+(97-98.67)298.67+(61-60.04)260.04+(81-81.72)281.72+(92-91.32)291.32+(54-54.96)254.96= 0.078
-
-
Find the degrees of freedom
-
Degrees of freedom (df) = (# of rows - 1)(# of columns - 1)
(2-1)(3-1) = 2
-
-
Find the p-value
> # ENTER THE DATA BY ROW > car = c(90, 97, 61) > suv = c(81, 92, 54) > > # USE THE rbind FUNCTION TO BIND THE ROWS > data.table = rbind(car, suv) > > data.table [,1] [,2] [,3] car 90 97 61 suv 81 92 54 > > # RUN CHI-SQUARE TEST > chisq.test(data.table) Pearson's Chi-squared test data: data.table X-squared = 0.1038, df = 2, p-value = 0.9494
tTAB 2 CONTENT HERE
-
Use your calculator DISTR [8]2cdf(
-
TI-83: 2cdf (chi-square value, any large number, df)
2cdf (0.078, e^99, 2) → p-value=0.95
-
-
-
TI-84:
lower: 0.078
upper: 9999
df: 2
p-value=0.95
-
-
Generate your conclusion
-
I calculated a p-value of 0.95, which is greater than the assumed significance level of 0.05. Therefore, I fail to reject the null hypothesis, and the data does not support the claim that the distribution of auto types purchased differs among all three states.
-
Chi Squared Test of Homogeneity
Introduction
The Chi Squared Test of Homogeneity is very similar to the Chi Squared Test of Association except that the data comes from simple random samples taken from multiple separate populations.
Example
You want to determine if there is any difference in distributions among political affiliation as it applies to gun control. You take separate samples of the Democrat population, Independent population, and Republican population. The data is shown below.
Democrat | Independent | Republican | |
Yes | 20 | 20 | 5 |
No | 10 | 18 | 30 |
Step 1: Name Test: Chi-Squared Test of Homogeneity
Step 2: Define Test:
Ho: There is no difference in distributions among political affiliation as it applies to gun control.
HA: There is a difference in distributions among political affiliation as it applies to gun control.
Step 3: Assume is true and define its normal distribution. Then check for specific conditions which vary depending on the type of hypothesis test.
1. Data from multiple independent random samples
2. N1 > 10n1 .... Nk > 10nk (k = # of populations)
3. All expected counts greater than 5
Step 4: Using the normal distribution, calculate the test statistics and p-value.
To solve for X2 use the EXACT SAME process used to solve for the test of association!
Don't forget to state your conclusion afterward.