python 使用卡方的假设检验器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 使用卡方的假设检验器相关的知识,希望对你有一定的参考价值。

"""
scipy manual: http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chisquare.html
"""

from scipy.stats import chisquare
# calculate frequencies
freq_data = np.histogram(data,normed=True,bins=range(0,30,1))[0] 
chisquare(freq_data)
# Power_divergenceResult(statistic=1.7350936497601266, pvalue=0.99999999999930067)

以上是关于python 使用卡方的假设检验器的主要内容,如果未能解决你的问题,请参考以下文章