ChiSquare (Χ²) Tests  Types, Formula & Examples
A Pearson’s chisquare test is a statistical test for categorical data. It is used to determine whether your data are significantly different from what you expected. There are two types of Pearson’s chisquare tests:
 The chisquare goodness of fit test is used to test whether the frequency distribution of a categorical variable is different from your expectations.
 The chisquare test of independence is used to test whether two categorical variables are related to each other.
Chisquare is often written as Χ^{2} and is pronounced “kaisquare” (rhymes with “eyesquare”). It is also called chisquared.
What is a chisquare test?
Pearson’s chisquare (Χ^{2}) tests, often referred to simply as chisquare tests, are among the most common nonparametric tests. Nonparametric tests are used for data that don’t follow the assumptions of parametric tests, especially the assumption of a normal distribution.
If you want to test a hypothesis about the distribution of a categorical variable you’ll need to use a chisquare test or another nonparametric test. Categorical variables can be nominal or ordinal and represent groupings such as species or nationalities. Because they can only have a few specific values, they can’t have a normal distribution.
Test hypotheses about frequency distributions
There are two types of Pearson’s chisquare tests, but they both test whether the observed frequency distribution of a categorical variable is significantly different from its expected frequency distribution. A frequency distribution describes how observations are distributed between different groups.
Frequency distributions are often displayed using frequency distribution tables. A frequency distribution table shows the number of observations in each group. When there are two categorical variables, you can use a specific type of frequency distribution table called a contingency table to show the number of observations in each combination of groups.
Bird species  Frequency 

House sparrow  15 
House finch  12 
Blackcapped chickadee  9 
Common grackle  8 
European starling  8 
Mourning dove  6 
A chisquare test (a chisquare goodness of fit test) can test whether these observed frequencies are significantly different from what was expected, such as equal frequencies.
Righthanded  Lefthanded  

American  236  19 
Canadian  157  16 
A chisquare test (a test of independence) can test whether these observed frequencies are significantly different from the frequencies expected if handedness is unrelated to nationality.
The chisquare formula
Both of Pearson’s chisquare tests use the same formula to calculate the test statistic, chisquare (Χ^{2}):
Where:
 Χ^{2} is the chisquare test statistic
 Σ is the summation operator (it means “take the sum of”)
 O is the observed frequency
 E is the expected frequency
The larger the difference between the observations and the expectations (O − E in the equation), the bigger the chisquare will be. To decide whether the difference is big enough to be statistically significant, you compare the chisquare value to a critical value.
When to use a chisquare test
A Pearson’s chisquare test may be an appropriate option for your data if all of the following are true:
 You want to test a hypothesis about one or more categorical variables. If one or more of your variables is quantitative, you should use a different statistical test. Alternatively, you could convert the quantitative variable into a categorical variable by separating the observations into intervals.
 The sample was randomly selected from the population.
 There are a minimum of five observations expected in each group or combination of groups.
Types of chisquare tests
The two types of Pearson’s chisquare tests are:
Mathematically, these are actually the same test. However, we often think of them as different tests because they’re used for different purposes.
Chisquare goodness of fit test
You can use a chisquare goodness of fit test when you have one categorical variable. It allows you to test whether the frequency distribution of the categorical variable is significantly different from your expectations. Often, but not always, the expectation is that the categories will have equal proportions.
Chisquare test of independence
You can use a chisquare test of independence when you have two categorical variables. It allows you to test whether the two variables are related to each other. If two variables are independent (unrelated), the probability of belonging to a certain group of one variable isn’t affected by the other variable.
Other types of chisquare tests
Some consider the chisquare test of homogeneity to be another variety of Pearson’s chisquare test. It tests whether two populations come from the same distribution by determining whether the two populations have the same proportions as each other. You can consider it simply a different way of thinking about the chisquare test of independence.
McNemar’s test is a test that uses the chisquare test statistic. It isn’t a variety of Pearson’s chisquare test, but it’s closely related. You can conduct this test when you have a related pair of categorical variables that each have two groups. It allows you to determine whether the proportions of the variables are equal.
Like chocolate  Dislike chocolate  

Like vanilla  47  32 
Dislike vanilla  8  13 
 Null hypothesis (H_{0}): The proportion of people who like chocolate is the same as the proportion of people who like vanilla.
 Alternative hypothesis (H_{A}): The proportion of people who like chocolate is different from the proportion of people who like vanilla.
There are several other types of chisquare tests that are not Pearson’s chisquare tests, including the test of a single variance and the likelihood ratio chisquare test.
How to perform a chisquare test
The exact procedure for performing a Pearson’s chisquare test depends on which test you’re using, but it generally follows these steps:
 Create a table of the observed and expected frequencies. This can sometimes be the most difficult step because you will need to carefully consider which expected values are most appropriate for your null hypothesis.
 Calculate the chisquare value from your observed and expected frequencies using the chisquare formula.
 Find the critical chisquare value in a chisquare critical value table or using statistical software.
 Compare the chisquare value to the critical value to determine which is larger.
 Decide whether to reject the null hypothesis. You should reject the null hypothesis if the chisquare value is greater than the critical value. If you reject the null hypothesis, you can conclude that your data are significantly different from what you expected.
How to report a chisquare test
If you decide to include a Pearson’s chisquare test in your research paper, dissertation or thesis, you should report it in your results section. You can follow these rules if you want to report statistics in APA Style:
 You don’t need to provide a reference or formula since the chisquare test is a commonly used statistic.
 Refer to chisquare using its Greek symbol, Χ^{2}. Although the symbol looks very similar to an “X” from the Latin alphabet, it’s actually a different symbol. Greek symbols should not be italicized.
 Include a space on either side of the equal sign.
 If your chisquare is less than zero, you should include a leading zero (a zero before the decimal point) since the chisquare can be greater than zero.
 Provide two significant digits after the decimal point.
 Report the chisquare alongside its degrees of freedom, sample size, and p value, following this format: Χ^{2} (degrees of freedom, N = sample size) = chisquare value, p = p value).
Practice questions
Frequently asked questions about chisquare tests
 What are the two main types of chisquare tests?

The two main chisquare tests are the chisquare goodness of fit test and the chisquare test of independence.
 What is the difference between a chisquare test and a t test?

Both chisquare tests and t tests can test for differences between two groups. However, a t test is used when you have a dependent quantitative variable and an independent categorical variable (with two groups). A chisquare test of independence is used when you have two categorical variables.
 What is the difference between a chisquare test and a correlation?

Both correlations and chisquare tests can test for relationships between two variables. However, a correlation is used when you have two quantitative variables and a chisquare test of independence is used when you have two categorical variables.
 What is the difference between quantitative and categorical variables?

Quantitative variables are any variables where the data represent amounts (e.g. height, weight, or age).
Categorical variables are any variables where the data represent groups. This includes rankings (e.g. finishing places in a race), classifications (e.g. brands of cereal), and binary outcomes (e.g. coin flips).
You need to know what type of variables you are working with to choose the right statistical test for your data and interpret your results.
Cite this Scribbr article
If you want to cite this source, you can copy and paste the citation or click the “Cite this Scribbr article” button to automatically add the citation to our free Citation Generator.