【发布时间】:2015-10-12 13:09:50
【问题描述】:
我确信答案很简单,但我不知道我做错了什么。
我想测试我拥有的一些样本数据是否可以来自广义极值或 pearson 3 型分布。
由于某种原因,我无法让kstest(t1, 'genextreme') 合作。但是,当我将其更改为 norm 时,它可以工作。
查看下面的部分代码和错误:
from scipy.stats import kstest
from scipy.stats import ks_2samp
import numpy as np
import csv
In [7]: from scipy.stats import genextreme
In [8]: t1 = TP['flow']
...: test_GEV = kstest(t1, 'genextreme')
...:
Traceback (most recent call last):
File "<ipython-input-8-ebc8faf10381>", line 2, in <module>
test_GEV = kstest(t1, 'genextreme')
File "/Applications/anaconda/lib/python2.7/site- packages/scipy/stats/stats.py", line 3585, in kstest
cdfvals = cdf(vals, *args)
File "/Applications/anaconda/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py", line 1642, in cdf
args, loc, scale = self._parse_args(*args, **kwds)
TypeError: _parse_args() takes at least 2 arguments (1 given)
In [9]: t1 = TP['flow']
...: test_GEV = kstest(t1, 'norm')
...:
In [10]: test_GEV
Out[10]: (0.99999925980208981, 0.0
看来它适用于norm,但不适用于genextreme
...我如何让kstest() 为除norm 之外的其他发行版工作?
谢谢
【问题讨论】:
标签: python statistics scipy