Lecture 11
Chisquare
Chisquare (or X^{2} after
the Greek letter for c) is a widely used statistical test which is officially
known as the Pearson chisquare in homage to its inventor, Karl Pearson.
One reason it is widely used is that it can help answer a number of different
types of analytic questions. Daniel discusses a several of these different
uses. Despite all of these potential uses, probably 90% of all uses of
chisquare involve analysis of contingency tables covered on pp. 595598. A 2 X
2 contingency table is a table that presents counts of participants in each of
four cells. The four cells are formed by two dichotomous variables. The
contingency table analysis is the only chisquare test that we will calculate
in this class, but it is important for you to understand the other uses of
chisquare. So, I'll devote this lecture to contingency table analysis and then
mention some of the other chisquare uses.
Chisquare can be thought of in
several ways. The first way we can think of the chisquare test is as an
analogy to the ttest in which we are interested in comparing two groups. Only
chisquare is used instead, because the dependent variable is dichotomous. So,
a 2 X 2 ("twobytwo") chisquare is used when there are two levels
of the independent variable and two levels of the dependent variable. This
might be called a test of homegeneity because we are testing whether two
groups are the same. Homegeneous means "same type."
Another way to think of the same
test is as a goodnessoffit test. The goodnessoffit test concerns
frequencies of participants in a sample, and whether or not those frequencies
are the frequency we would expect due to chance. For instance, the frequencies
might involve how many participants said "no" and "yes" in
response to a survey question. Imagine a survey question in English that was
posed to an immigrant population that did not understand English well. If the
respondents to the survey did not understand the question asked, frequency of
no and yes responses might be a matter of chance. The goodnessoffit analytic
question then concerns whether or not the survey respondents said yes or no
with a frequency that we would expect due to chance or not. If the respondents
did not understand the question, we would expect about 50% to answer yes and
50% to answer no. The goodnessoffit, then concerns whether the actual
frequency of yes/no responses matches the frequency we would expect due to
chance.
Now, it turns out that the question
of homogeneity (group differences) and question of goodnessoffit are really
the same question. If we ask whether two groups (say males and females) are
equal in their tendency to say yes to a survey question, we are also asking
whether the rate at which each group responds yes and no is the rate we would
expect from chance. Thus, the computation of chisquare concerns the match
between the expected frequencies, based on the overall number of people in each
group, and the obtained frequencies.
Chisquare can also be thought of as
a test of whether two variables are independent or not, and, thus, it is
considered a test of independence. An independence question might
concern whether gender (male vs. female) is related to responses to a yes/no
question of a survey. If gender is related to saying yes to the question, the
two variables are not independent of one anotherthey are dependent or
related.
So, researchers use chisquare to
answer questions about homogeneity, goodnessoffit, or independence. If you
think hard enough about these three questions, they all turn about to be the
same question! Heavy, huh?!
Contingency tables
(2 X 2)
The contingency table is just a summary table of the data. Let's take an
example of a typical use of chisquare that compares two groups on some
dichotmous measure. Let's say we accessed some local data on voter registration
to see if males and females were equally likely to be Republican or Democrat.
We got a list of 180 voters and entered their political affiliation into a
database. To do that we just need two variables (other than an ID
variable)gender and political affiliation. We would enter that data in the
normal way (using codes 0 and 1 to indicate male and female etc.), but, for
convenience, we (or a computer) would summarize that information in a table
like this:

Females 
Males 
Total 
Democrats 
50 
70 
120 
Republicans 
19 
41 
60 
Total 
69 
111 
180 
There are 180 cases total, with 120
Democrats, 60 Republicans, 69 females, and 111 males. Overall, there are more
males than females, so to know if males or females are more likely to be
Democrat or Republican, we need to take into account the total number of each.
Because there are more males, we expect there to be a higher frequency of males
in both the Republican and Democratic groups. So, we need to take those base
rates into account to figure out the frequencies we would expect due to chance.
The formula for computing chisquare
is a matter of gauging how closely our observed frequencies in each cell of the
table are matched to the expected frequencies.
In the table O_{i} stands
for the observed frequency in one cell and E_{i} stands for the
expected frequency of that cell. As you can see in the formula, we compute
chisquare by summing up the differences between the observed and the expected
frequency for each cell.
When we do not have any information
about the expected frequency in each cell, we can compute it based on the total
number of males and females or yes and no responses. As long as we are testing
the notion that the cells are equal or not in their expected rate, we can use
the following handydandy computation formula instead of going through the
involved process of calculating the expected frequencies, computing the
differences, and summing them up. Here is the short hand method:
This is much easier than it looks,
because a, b, c, and d just refer to the frequency in each of the cells. n, as
usual, is the number of cases in the sample. The formula does not make too much
sense, because it is just a short cut for computing chisquare when we have a 2
X 2 contingency table.

Females 
Males 
Democrats 
a 
b 
Republicans 
c 
d 
We just do some muliplying, adding,
subtracting, and squaring and, presto, a chisquare. Here we go:
To see if this descrepancy between
observed and expected is likely to be due to sampling error, we test the
calculated chisquare for significance. The d.f. is equal to (r  1)(c  1) =
(2  1)(2  1) = 1, where are r is the number of rows and c is the number of
columns. We look up in Table F in the back of the book under the .95 column
(for alpha = .05). The critical value in the table is , and we conclude that there are
no significant differences between males and females in their political
affiliations.
More than 2
categories
Chisquare can also be used with more than two categories. For instance, we
might examine gender and political affiliation with 3 categories for political
affiliation (Democrat, Republican, and Independent) or 4 categories
(Democratic, Republican, Independent, and Green Party). In that case we can't
use our handydandy formula for 2 X 2 tables, but we can use a computer!
Because chisquare can be thought of as a test of goodnessoffit, it doesn't
really matter whether we think of gender or political affiliation as the
independent variable. The test will be the same either way. Chisquare then
applies to situations where we have 2 X 3 or 3 X 4 or 5 X 6 tables. When there
is more than a 2 X 2 table, we have an omnibus test, because the test just
indicates if there is any differences among the cells. To look for specific
cell differences, researchers usually analyze separate subtables of 2 X 2s or
another method called loglinear analysis (which we won't cover in the class).
Other measures of
fit
You will also see some
alternatives to Pearson chisquare. Two, in particular, are the likelihood
ratio test (G^{2}) and the Neyman weighted least squares chisquare
(Q). We will discuss the likelihood ratio test more later, and the Neyman test
is not used very often. All three are very similar, especially with a large
sample size.
Yate's Correction
and Fisher's Exact Test
You will often see two other statistics printed out by statistical packages.
Yate's continuity correction is a correction of Pearson chisquare that adjusts
the chisquare for smaller samples. The reason for the correction is that the
sample is based on dichotomous data, and critical chisquare values are based
on a continuous distribution. Incidentally,or , so chisquare is a function of the normal
distribution (remember the end of the lecture on the binomial distribution?).
Yates correction is usually a conservative estimate of chisquare, because the
value of chisquare is adjusted downward. There is considerable disagreement
about whether or not Yate's correction is too conservative or not, and judging
from most stats texts I've seen, I think most statisticians prefer not to use
it.
The Fisher's exact test is used when
there are unequal numbers in the groups, and the accuracy of the test is a
concern, because there are very low expected frequencies in the cells. Fisher's
exact test adjusts chisquare for this problem. Usually, Pearson chisquare is
ok if there is an expected frequency of 5 or more in 80% of the cells, and an
expected frequency of 1 or more in the remaining 20% of cells. Computer
packages usually print a warning when these expected frequencies are low. When
this warning occurs, many researchers like to examine the Fisher's exact test.
Noncontingency
Analysis with Chisquare
Above I mentioned that the
chisquare calculations I used were based on the assumption that by chance, we
expect that there is an equal probability of occurrence in each group. For
instance, chance of responding yes or no is 50% for each. Usually the expected
frequency is not known and must be computed from the data, and the assumption
is that there will be equal proportions (e.g., 50% for 2 groups, 33% for three
groups, and so on). Sometimes, however, the proportion expected from chance is
known by the researcher or there is some reason to expect what the distribution
will be like. In this case, the Poisson distribution or another distribution
can be used to compute the expected frequencies. These other situations are
discussed more completely by Daniel. I think you should review them and
understand when they are used, but, because they are seen relatively
infrequently, I do not want you to spend a lot of time on them. When you run
into these situations, the Daniel text will provide a nice reference book if
you need to figure out how to calculate these or whether your situation is
relevant.
For an example SPSS output, click here.