swdata/break_tie_chi2.py
2018-03-20 20:35:36 +08:00

6 lines
172 B
Python

from scipy.stats import chi2_contingency as chi2
import numpy as np
obs = np.array([[219,113],[661,25]])
chi,p,dof,expected = chi2(obs)
print("%f, %f, %f" % (chi, p, dof))