chi_square_goodness_of_fit
Test if observed category counts match an expected distribution. Returns chi-square statistic, p-value, and warnings when expected counts are low.
Instructions
Test whether observed category counts match an expected distribution -- e.g. "are these six days-of-week signup counts evenly distributed, or skewed towards weekends?" Returns the chi-squared statistic, degrees of freedom (len-1), p-value, a citation, and a warning if any expected count is below 5 (the usual threshold below which this approximation gets unreliable).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alpha | No | significance level for the test (and any confidence interval); default 0.05 | |
| expected | Yes | expected count per category, same length and category order as observed; does not need to sum to the same total | |
| observed | Yes | observed count per category |