*2 TEST OF INDEPENDENCE

advertisement
2
T EST OF I NDEPENDENCE
& G OODNESS OF F IT
It's All About Whether Or Not Proportions Differ.
• Chi-square compares whether one set of proportions is
different from another.
• It does this on the basis of comparing frequencies.
Let's get right to a real example.
DISCRIMINATION AT THE WORK PLACE
(GOODNESS OF FIT - REMEMBER THIS)
You are hired as a statistician by a disgruntled employee who says that the
company discriminates on the basis of gender.
The employee's evidence - there are 6 male mangers and 4 females.
This is the classic situation of comparing proportions using the frequencies.
The complainant says:
There are 10 mangers.
If there was perfect equality based on Gender, one would expect 5 males and 5
females. That would be the 50- 50 split based on equal proportions of .5 and .5.
Expected Males = 5, Expected Females = 5.
However, she observed 6 males and 4 females. This is a 60-40 split
So she said that the observed is different from the expected.
In other words.
O (observed) ≠ (E)Expected
or
O (observed) - (E)Expected ≠
0
But, you tell your client that's not good enough evidence. You make up the following
chart:
Six t y
-
Fo rt y
Fif t y
-
Fif t y
It's just chance - the office could be either 5 males versus 5 females but just the
change of one person would make it 6 to 4. It could have just as easily been 4
males or 6 females.
Intuitively, you can see that it would be hard to convince someone that this 60 40 split is discrimination. It's too easy to be just luck.
If you understand this picture - you understand Chi-Square's purpose.
Again - you have a set of proportions - you think should be true (Expected) and
you test them against a set that you have observed (Observed).
You see if the differences in O vs. E are big enough not to be pure luck!
Your client won't give up. She says:
•I will get data from all the company's offices across the
•I will measure 100 people - not just ten!
city.
Ok - If there was no discrimination, you should get the following picture with
50 men and 50 women.
THE IDEAL OR EXPECTED OFFICE DISTRIBUTION OF MANAGERS
Fif t y - Fif t y
But, our client makes up a chart after checking out all the offices and getting the data
from 100 managers.
Our client says look at this chart!
See what I am talking about now!
Six t y - Fo rt y
It's not just a matter of one person anymore.
In fact, if you just moved just one person - you can hardly see the difference!
Look!
No - You Can't!
So I conclude that there is some significant difference in gender in our new data.
The group of 100 (divided into 60 men and 40 women) is so far off from an expected 50-50 that it can't be luck
or chance.
If you understand this - then you just did an intuitive and visual Chi-square.
Here’s The Formula!
O is the observed frequency. This is from the data.
E is the expected frequency. This is based on the percentages you have hypothesized.
If you calculated this value for our 10 people example, it would .4.
(Omen-Emen)2/5 + (Owomen-Ewomen)2/5 = .4
or
(6-5)2/5 + (4-5)2/5 = .4
If you calculated it with the 100 person example, it would be 4. Try it:
(60-50)2/50 + (40-50)2/50 = 4
That's a big Chi-Square.
Nuances:
• See why we square and add to summarize the differences between 0-E. If we
didn't square, they would sum to zero.
• You divide by E to make everything relative. It's really like a Z score.
• The chi-square statistic (2) is evaluated for significance with a degrees of
freedom equal to the number of categories minus 1(k-1, if k = number of
categories).
You look up in the Chi-square table. If you exceed the tabled value, you have
significance. In our case, the value is 3.84 at the .05 level. So the first example is
not significant. What about the second with more people?
• The more categories you have, the larger the Chi-square you need for
significance. You don't always have 2 groups. If you did ethnic identity in our
example, you could have 5 or 6. You can have more than 2 categories.
•What about Goodness of Fit? Now that we explained it, this particular Chi-Square is
sometimes called the Goodness of Fit test. We tested whether our "Observed"
frequencies "fit" against our "Expected "
WAIT - HERE'S ANOTHER KIND OF
CHI -SQUARE:
THE TEST OF INDEPENDENCE
The Big Idea:
Does the breakdown of proportions of frequencies for one category differ
significantly from that of another category?
What this means is:
• You got Men - You got Women.
• They are now grown-up married yuppies.
• They came into some money on their job.
• They want to buy a new car.
• They can buy a sports car or an SUV.
• Do the proportions of men vs. women who want an SUV vs. a sports car differ?
Is car choice independent of gender?
How are you going to figure this out? You will:
• Ask men and women what kind of car they want.
• Set up a contingency table that lays out the observed choices by gender and car type
(Gender X Car).
• Figure out the preference for cars if gender didn't matter.
• Apply these preferences to men and women separately to see if the observed
frequencies for men and women for each car type differ from what would be
expected if car type didn't count.
Let's Look at Some Pictures & Do a Visual Chi-Square
50%
5 0 % o f Me n
5 0 % o f Wo m e n
50%
5 0 % o f Me n
5 0 % o f Wo m e n
20 Men (50%) like SUV
20 Women (50%) like SUVs
20 Men like (50%) Sports Cars
20 Women (50%) like Sports Cars
Men and women don't differ on car preference.
Fifty percent of people like SUVs. Fifty percent like sports cars.
Gender doesn't matter. If we computed Chi-square (discussed
later) it would not be significant.
Official Chi-square language follows!:
Car preference is Independent of Gender.
It's the Test of Independence, remember!
50%
20% of
Me n
80% of
Wo m e n
50%
20% of
Wo m e n
80% of
Me n
First, look to the extreme right side.
•If we forget about gender and lump people together, then still 50% like SUVS and 50% prefer
Sports Cars.
•Look at the Male Column:
•Only 20% like SUVs. Most like Sports Cars!
•It is reversed for the women!
•But - if we combine them it, is still a 50-50 split.
•Each column sure does differ from 50-50, doesn't it?
•They look significantly different from 50-50.
•That's a visual Chi-square.
•Car preference is Dependent on Gender.
•Gender flunked the Test of Independence
Big Idea Review!
You can see that the percentages of men in women in each cell (little box) are quite different from
50-50. Thus the O (observed) differs quite a bit from the E (expected).
Chi-Square would be significant.
Nuances of Calculating the Chi-Square!
You need to calculate the expected for each cell, separately.
Here's the formula:
Expected (E) =
Row Total x Column Total
Total
What this does is take the percentages from the combined total column on the extreme
right and generate an expected for the men and women columns separately. The idea is
that if gender doesn't matter, then these percents would apply to men and to women.
They don't! We have significance
Here's what it would look like:
Add them up and you get 27.2 for the Chi-Square
That's a Big Chi-Square.
You needed 3.84 at the .05 level.
It's Significant.
Men and Women Differ on their Preference for Car Type
The chi-square statistic (2) is evaluated for significance with a degrees of freedom
equal to the:
[NUMBER OF CATEGORIES FOR VARIABLE1 - 1] X [ NUMBER OF CATEGORIES FOR
VARIABLE2 - 1]
Bottom Line:
• Chi-Square lets you compare a set of observed frequencies versus expected
frequencies.
• You do this to see if proportions vary significantly.
• You can use this method to see if two variables depend on each other.
• The larger your sample, the easier it is to find significant differences.
Download