182. Chi-Square Goodness of Fit

182.0.1. Goodness of Fit Test

Compares an observed categorical distribution to a theoretical categorical distribution.

Χ2=𝑖=1𝑘(𝑜𝑖𝑒𝑖)2𝑒𝑖
chi2_got.py
from scipy import stats
f_obs = np.array([43, 52, 54, 40])
f_exp = np.array([47, 47, 47, 47])
stats.chisquare(f_obs=f_obs, f_exp=f_exp)