χ2\chi^2 Test

Source: https://www.scribbr.com/statistics/chi-square-goodness-of-fit/

χ2=∑(O−E)2E\chi^2=\sum{\frac{(O-E)^2}{E}}

Where:

  • χ2\chi^2 is the chi-square test statistic
  • O is the observed frequency
  • E is the expected frequency

Goodness of Fit Test

You want to know if a sample of data which is a histogram of counts (independent variable is categorical, dependent variable is quantitative) conforms to an expected distribution of counts.

H0H_0: The counts conform to the expectation

H1H_1: The counts are statistically different

  1. Calculate the χ2\chi^2 value as above
  2. Determine the degrees of freedom: number of groups/bins - 1
  3. Check the table below to see the probability that H0H_0 must be rejected

Table of Significant values

Degrees of
freeddom
.99.9750.95.9.1.05.025.01
1---0.0010.0040.0162.7063.8415.0246.635
20.0200.0510.1030.2114.6055.9917.3789.210
30.1150.2160.3520.5846.2517.8159.34811.345
40.2970.4840.7111.0647.7799.48811.14313.277
50.5540.8311.1451.6109.23611.07012.83315.086
60.8721.2371.6352.20410.64512.59214.44916.812
71.2391.6902.1672.83312.01714.06716.01318.475
81.6462.1802.7333.49013.36215.50717.53520.090
92.0882.7003.3254.16814.68416.91919.02321.666
102.5583.2473.9404.86515.98718.30720.48323.209