- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我说的是用 python 公式检索这个表媒体的值
https://www.soest.hawaii.edu/GG/FACULTY/ITO/GG413/K_S_Table_one_Sample.pdf
我已经找了一段时间了,但是 scipy 函数并没有寻找这个值,老实说,我在这里很困惑。
我一直在查看内置公式的 scipy,但没有成功。例如,在上述表格中,D[0.1, 10] == 0.36866。然而 scipy.stats.kstest 不会返回相同的值,无论我对我的数据玩了多少。
最佳答案
这可以通过 scipy
来完成,使用 ksone
分布及其 ppf
( percent point function ) 方法,而不是 kstest
:
from scipy.stats import ksone
def ks_critical_value(n_trials, alpha):
return ksone.ppf(1-alpha/2, n_trials)
打印临界值表:
from __future__ import print_function # For Python 2
trials = range(1, 41)
alphas = [0.1, 0.05, 0.02, 0.01]
# Print table headers
print('{:<6}|{:<6} Level of significance, alpha'.format(' ', ' '))
print('{:<6}|{:>8} {:>8} {:>8} {:>8}'.format(*['Trials'] + alphas))
print('-' * 42)
# Print critical values for each n_trials x alpha combination
for t in trials:
print('{:6d}|{:>8.5f} {:>8.5f} {:>8.5f} {:>8.5f}'
.format(*[t] + [ks_critical_value(t, a) for a in alphas]))
if t % 10 == 0:
print()
部分输出:
| Level of significance, alpha
Trials| 0.1 0.05 0.02 0.01
------------------------------------------
1| nan nan nan nan
2| 0.77639 0.84189 nan nan
3| 0.63604 0.70760 0.78456 0.82900
4| 0.56522 0.62394 0.68887 0.73424
5| 0.50945 0.56328 0.62718 0.66853
6| 0.46799 0.51926 0.57741 0.61661
7| 0.43607 0.48342 0.53844 0.57581
8| 0.40962 0.45427 0.50654 0.54179
9| 0.38746 0.43001 0.47960 0.51332
10| 0.36866 0.40925 0.45662 0.48893
11| 0.35242 0.39122 0.43670 0.46770
12| 0.33815 0.37543 0.41918 0.44905
13| 0.32549 0.36143 0.40362 0.43247
14| 0.31417 0.34890 0.38970 0.41762
15| 0.30397 0.33760 0.37713 0.40420
16| 0.29472 0.32733 0.36571 0.39201
17| 0.28627 0.31796 0.35528 0.38086
18| 0.27851 0.30936 0.34569 0.37062
19| 0.27136 0.30143 0.33685 0.36117
20| 0.26473 0.29408 0.32866 0.35241
我们需要统计学家就 (a) 为什么我们得到前两行的 np.nan
值的一些额外反馈(我假设是因为 n_trials< 的这些组合的临界值
和 alpha
是纯理论的,在实践中无法实现),以及(b)为什么 ksone.ppf
方法需要 alpha
来除以2?我将编辑此答案以包含该信息。
不过您可以看到,除了初始缺失值之外,此表生成的结果与 the table in your question 以及 this paper 第 16 页上的表相同。
关于python - 获得 kolmogorov-smirnov 检验所需的临界值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53509986/
给定infinite time ,我们可以接近字符串的确切 Kolmogorov complexity .如果我们没有无限时间,我们仍然可以计算字符串的 Kolmogorov 复杂度的上限: ...s
我正在寻找一种可以计算给定输入字符串的 Kolmogorov 复杂度近似值的算法。因此,如果 K 是字符串 S 的 Kolmogorov 复杂度,而 t 表示时间,则该函数的行为类似于这样......
你好 我需要在应用中使用这个 Kolmogorov 过滤器。您将一些测量数据放入其中,并使用过滤器对其进行一些平滑处理。我试着用“nchoosek”来做,但是当我尝试为 50 或更多的 I 做这件事时
我正在研究使用压缩来衡量文档与文档语料库之间的关系。在这样做的过程中,我在使用 bzip2 时发现了一个奇怪的结果; len(compress(corpus)) > len(compress(corp
据说,不可压缩性方法可以简化对一般情况的算法分析。据我了解,这是因为不需要计算该算法的所有可能输入组合,然后得出平均复杂度。相反,将单个不可压缩的字符串作为输入。由于不可压缩字符串是典型的,我们可以假
我很难让 ks.test 使用卡方分布式数据: > chi10 ks.test(chi10, dchisq, df=10) One-sample Kolmogorov-Smirnov tes
我正在寻找一个基于Python的Kolmogorov-Zurbenko过滤器,它接收时间序列输入并根据窗口大小和迭代次数对其进行过滤,但尚未找到任何似乎有效的东西。有人比我运气更好吗? 谢谢! 最佳答
我正在寻找一种为 MathCad 生成 Kolmogorov-Chapman 方程来解决马尔可夫链问题的方法。问题是找到系统处于其中一种状态的概率。系统有N个组件。我有一个包含 2^N 个节点(状态)
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
我说的是用 python 公式检索这个表媒体的值 https://www.soest.hawaii.edu/GG/FACULTY/ITO/GG413/K_S_Table_one_Sample.pdf
假设我们有两个样本 data1 和 data2 以及它们各自的权重 weight1 和 weight2 并且我们想计算两个加权样本之间的 Kolmogorov-Smirnov 统计量。 我们在 pyt
我正在尝试为我的数据获得最佳分布。试衣完成如下图所示,但我需要测量,以选择最佳型号。我将拟合优度与卡方值进行比较,并使用 Kolmogorov-Smirnov (KS) 检验检验观察分布和拟合分布之间
我使用以下Python代码向学生演示随机变量的生成: import numpy as np import scipy.stats as stats def lcg(n, x0, M=2**32, a=
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 7 年前。 Improve this qu
在进行重要性抽样实验时,我模拟了 Kolmogorov-Smirnov 距离的值 $$ D_n =\max_x |\hat{F}_n(x)-F(x)| $$ 其中 $n$ 是原始重要性样本的大小,我想
柯尔莫哥洛夫-斯米尔诺夫统计量定义为经验累积分布函数与假设累积分布函数之间的最大距离。我认为,与其看数字,不如使用图表来找出最大差异。 我知道如何绘制经验分布函数 p1<-qplot(rnorm(30
我对 R 中的 ks 函数有疑问。我有一个拉普拉斯分布: ldes <- function(y, a) { if(y < 0.5) 1/a*log(2*y, 2) else 1/a*log(
我在 Spark 中有两组数据(我们称它们为 d1、d2)。我想执行两个样本柯尔莫哥洛夫-斯米尔诺夫检验,以测试它们的底层总体分布函数是否不同。 MLLib 的 Statistics.kolmogor
我设计了 3000 个实验,因此在一个实验中有 4 组(治疗组),每组有 50 个人(受试者)。对于每个实验,我都会做一个标准的单向方差分析,并证明它们的 p.values 在零假设下是否具有单一概率
我有一组实验值和一个概率密度函数,据说可以描述它们的分布: def bekkers(x, a, m, d): p = a*np.exp((-1*(x**(1/3) - m)**2)/(2*d*
我是一名优秀的程序员,十分优秀!