Chi-square goodness of fit
Hypothesis tests · Method and input reference
Expected counts must be positive and totals must match. No parameters estimated from data (df = categories−1). Synthetic example: Observed and expected counts across four recruitment strata, each totaling 320.
Open calculator · Compare methods in the decision matrix
When to consider it
- Single categorical variable compared to an expected distribution.
Assumptions and scope
- Observed counts and prespecified expected counts must have equal totals.
- The approximation may fail with sparse expected counts; do not use arbitrary probabilities estimated from these data without adjusting degrees of freedom.
Required inputs
- Observed counts — Numeric observations; preserve the row and column structure described above.
- Expected counts — Numeric observations; preserve the row and column structure described above.
Review missing values and data coding before running. Sample inputs are synthetic teaching examples.
Implementation
Lifescio validates inputs and formats results; listed functions are the principal calculation routines, not an exhaustive transitive dependency list.
- scipy 1.15.3: scipy.stats.chisquare
These are pinned library versions; saved results record the versions actually used at runtime.