See on GitHub

chi-squared-c

Equation

Χ^2 = ((O - E)^2) / E