15 lines
274 B
Python
15 lines
274 B
Python
from scipy.stats import chi2_contingency as chi2
|
|
import numpy as np
|
|
|
|
obs = np.array([[290.0, 1023.0], [30.0, 321.0]])
|
|
chi,p,dof,expected = chi2(obs)
|
|
print("%f, %e, %f" % (chi, p, dof))
|
|
|
|
'''
|
|
classic
|
|
chi = 0.381964, p = 0.536554
|
|
|
|
survive
|
|
chi = 23.490576, p = 1.255272e-06
|
|
'''
|