The CHISQ.TEST function returns the test for independence. CHISQ.TEST returns the value from the chi-squared (χ2) distribution for the statistic and the appropriate degrees of freedom. You can use χ2 tests to determine whether hypothesized results are verified by an experiment.
The CHISQ.TEST function syntax has the following arguments:
- Actual_range (required argument) – This is the range of data containing observations that are to be tested against expected values. It is an array of observed frequencies.
- Expected_range (required argument) – This is the range of data that contains the ratio of the product of row totals and column totals to the grand total. It is an array of expected frequencies.
Example: Let’s look at some Excel CHISQ.TEST function examples and explore how to use the CHISQ.TEST function as a worksheet function in Microsoft Excel:
The formula for calculating the chi-square test for the independence of the datasets above is:
Generally, a probability of 0.05 or less is considered to be significant. Therefore, the returned value above, 0.0000217, indicates a significant difference between the observed and the expected frequencies, which is unlikely to be due to sampling error.
- #DIV/0! error – Occurs when any of the values provided in expected_range is zero.
- #N/A error – Occurs when either:
- The data arrays provided are of different dimensions; or
- The data arrays provided contain only one value. That is, the length and width are equal to 1.
- #NUM! error – Occurs when any of the values in the expected range is negative.
- The CHISQ.TEST function was introduced in Excel 2010 and hence is unavailable in earlier versions. It is an updated version of the CHITEST function.
- The χ2 test first calculates a χ2 statistic using the formula:
Aij = actual frequency in the i-th row, j-th column
Eij = expected frequency in the i-th row, j-th column
r = number or rows
c = number of columns