Português

Chi-square goodness-of-fit test

Goodness of fit and normality · reference distribution: χ²(k−1)

When to use it

Check whether the observed frequencies in categories match the ones a theory expects, such as a fair die.

Null hypothesis

The category proportions are the specified ones.

Assumptions

Test statistic

\chi^2 = \sum_i \dfrac{(O_i - E_i)^2}{E_i}

How to report it

χ²(5, N = 120) = 4.8, p = .44

In R and Python

R
chisq.test(observed, p = expected_proportions)
Python
stats.chisquare(observed, f_exp=expected)

In Python, stats is scipy.stats and np is numpy.

Where it sits in the catalog

Goodness of fit and normality. Goodness of fit: do the data follow the expected distribution? Normality tests are the most common case and check an assumption of parametric tests.

In the decision tree

  1. What do you want to do? Compare groups, or one group with a reference value
  2. What kind of response did you measure? Categorical: yes or no, or categories
  3. How many groups or measurements? One group, with several categories against expected frequencies
  1. What do you want to do? Check an assumption or the distribution of the data
  2. What do you want to check? Whether the category frequencies are the expected ones

Open the decision tree