- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试执行 Kolmogorov-Smirnov 检验来比较经验分布和 F 分布(我知道这些不能直接比较,但我会使用 Bootstrap )。我在使用 scipy KS 测试时遇到问题:
readLengths = [list,of,int,values,...]
x = stats.f.fit(readLengths)
dfn=x[0]
dfd=x[1]
stats.kstest(readLengths,stats.f.rvs(dfn,dfd,size=100))
我遇到了错误
TypeError: 'numpy.ndarray' object is not callable
它指向 stats.kstest 行。我认为这是 readLengths 数组的问题,但文档说它可以采用一维数组,所以不确定为什么我会遇到这个问题。此外,有趣的是,在此函数中,您可以使用“norm”命名正态分布,但“f”似乎无效,尽管它是 F 分布的 scipy 名称。
最佳答案
来自 the docs :
cdf : str or callable
If a string, it should be the name of a distribution in scipy.stats. If rvs is a string then cdf can be False or the same as rvs. If a callable, that callable is used to calculate the cdf.
kstest
的第二个参数应该是字符串 或接受分位数作为输入并返回 CDF 的可调用对象。相反,你正在传递它
stats.f.rvs(dfn,dfd,size=100)
计算结果为 np.ndarray
。
一个选项是使用您想要的参数构建一个卡住的 PDF,然后将其 .cdf
方法作为第二个参数传递给 kstest
:
fdist = stats.f(dfn, dfd)
d, p = stats.kstest(readLengths, fdist.cdf)
关于python - 类型错误 :ndarray not callable in scipy. stats.kstest(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37424877/
好的,所以我尝试使用 kstest 的 scipys 实现作为评估哪种分布最适合数据的方法。我对 kstest 工作原理的理解是,统计数据代表零假设的概率(即返回的概率是所讨论的模型对数据错误的概率)
我在 scipy (scipy.stats.kstest) 中使用 Kolmogorov-Smirnov 测试时遇到问题。在线文档(http://docs.scipy.org/doc/scipy/re
在Python 3.6.5和scipy 1.1.0中,当我运行Kolmogorov-Smirnov测试来检查均匀分布时,如果我向kstest函数提供一行,我会得到两个相反的结果(从p值的角度来看)或列
帮助链接是http://docs.scipy.org/doc/scipy-0.7.x/reference/generated/scipy.stats.kstest.html我现在可以计算 ks-tes
我正在尝试执行 Kolmogorov-Smirnov 检验来比较经验分布和 F 分布(我知道这些不能直接比较,但我会使用 Bootstrap )。我在使用 scipy KS 测试时遇到问题: read
这个问题我已经困惑了一段时间,希望得到一些帮助。 我正在尝试使用scipy.stats.kstest来针对另一个简单的x=y分布来测试我的分布,以便我可以获得p值。在在线示例中,它给出了类似的内容:
我已经通读了有关此模块(和 Scipy 文档)的现有帖子,但我仍然不清楚如何使用 Scipy 的 kstest 模块在您拥有数据集和可调用函数。 我要测试我的数据的 PDF 不是标准的 scipy.s
这个问题已经有答案了: Two-sample Kolmogorov-Smirnov Test in Python Scipy (3 个回答) 已关闭 7 年前。 我想使用 scipy.stats.ks
我有一个具有频率的独特系列,想知道它们是否来自正态分布,所以我使用 scipy.stats.kstest 进行了 Kolmogorov–Smirnov 测试。因为,据我所知,该函数只接受一个列表,所以
我正在尝试评估/测试我的数据对特定分布的拟合程度。 关于它有几个问题,有人告诉我使用 scipy.stats.kstest 或 scipy.stats.ks_2samp。看起来很简单,给它:(A)数据
我有兴趣检查样本 A (n=25) 是否均匀分布。这是我在 Python 中检查它的方法: import scipy.stats as ss A=[9,9,9,4,9,6,7,8,9,4,5,2,4,
我是一名优秀的程序员,十分优秀!