chisquare

numeric.stats.chisquare(f_obs, f_exp=None)

Calculates a one-way chi square test.

The chi square test tests the null hypothesis that the categorical data has the given frequencies.

Parameters:
  • f_obs – (array_like) Observed frequencies in each category.
  • f_exp – (array_like) Expected frequencies in each category. By default the categories are assumed to be equally likely.
Returns:

Chi-square statistic and p-value

Examples:

from mipylib.numeric import stats

r = stats.chisquare([16, 18, 16, 14, 12, 12], [16, 16, 16, 16, 16, 8])
print r

Result:

>>> run script...
(3.5, 0.623387627749582)