Statistical Inference

Chi-square Test

A chi-square (χ²) test works with counts in categories rather than numeric averages — most commonly testing whether two categorical variables are associated, like “does device type relate to whether a user subscribes?” It compares the counts you observed against the counts you’d expect if there were no association.

The statistic adds up the squared gaps between observed and expected counts, scaled by the expected counts; a big total signals the categories aren’t independent. A practical caution: it gets unreliable when expected counts in cells are very small (a common rule of thumb is at least 5), where an exact test like Fisher’s is safer.