Chi-Square Test of a Frequency Distribution

Tests the null hypothesis that the observed values of a categorical variable diff from the expected values. The test statistic is

$X^2 = \sum^s_{k=1} \frac{(o_{kj} - e_{kj})^2}{e_{kj}}$

where:

$o_{k}$ are the observed values,
$e_{k} =$ are the expected values,
$p \approx \Pr(\chi^2_{(s-1)} \ge X^2)$