更改

跳到导航 跳到搜索
添加232字节 、 2020年12月31日 (四) 09:38
无编辑摘要
第1行: 第1行: −
此词条由Jie翻译。
+
此词条由Jie翻译。由Lincent审校。
    
{{Short description|Non-parametric statistical test between two distributions}}
 
{{Short description|Non-parametric statistical test between two distributions}}
第11行: 第11行:  
In statistics, the Kolmogorov–Smirnov test (K–S test or KS test) is a nonparametric test of the equality of continuous (or discontinuous, see Section 2.2), one-dimensional probability distributions that can be used to compare a sample with a reference probability distribution (one-sample K–S test), or to compare two samples (two-sample K–S test).  It is named after  Andrey Kolmogorov and Nikolai Smirnov.
 
In statistics, the Kolmogorov–Smirnov test (K–S test or KS test) is a nonparametric test of the equality of continuous (or discontinuous, see Section 2.2), one-dimensional probability distributions that can be used to compare a sample with a reference probability distribution (one-sample K–S test), or to compare two samples (two-sample K–S test).  It is named after  Andrey Kolmogorov and Nikolai Smirnov.
   −
在统计学中,'''<font color="#ff8000"> Kolmogorov–Smirnov检验</font>'''(K-S检验或KS检验)属于非参数检验,它具有一维概率分布的连续(或不连续,请参见第2.2节)均等性,可用于比较一个样本分布与一个参考概率分布的情况(单一样本K-S检验),或比较两个样本分布的情况(两个样本的K-S检验)。它是以Andrey Kolmogorov和Nikolai Smirnov的名字命名。
+
在统计学中,'''<font color="#ff8000"> Kolmogorov–Smirnov检验</font>'''(K-S检验或KS检验)是一种连续(或不连续,请参见第2.2节)的一维概率分布均等性的非参数检验,可用于比较一个样本与一个参考概率分布(单一样本K-S检验),或比较两个样本(两个样本的K-S检验)。它是以安德雷·柯尔莫哥洛夫 Andrey Kolmogorov和尼古莱·斯米尔诺夫 Nikolai Smirnov的名字命名。
      第19行: 第19行:  
The Kolmogorov–Smirnov statistic quantifies a distance between the empirical distribution function of the sample and the cumulative distribution function of the reference distribution, or between the empirical distribution functions of two samples. The null distribution of this statistic is calculated under the null hypothesis that the sample is drawn from the reference distribution (in the one-sample case) or that the samples are drawn from the same distribution (in the two-sample case). In the one-sample case, the distribution considered under the null hypothesis may be continuous (see Section 2), purely discrete or mixed (see Section 2.2). In the two-sample case (see Section 3), the distribution considered under the null hypothesis is a continuous distribution but is otherwise unrestricted.
 
The Kolmogorov–Smirnov statistic quantifies a distance between the empirical distribution function of the sample and the cumulative distribution function of the reference distribution, or between the empirical distribution functions of two samples. The null distribution of this statistic is calculated under the null hypothesis that the sample is drawn from the reference distribution (in the one-sample case) or that the samples are drawn from the same distribution (in the two-sample case). In the one-sample case, the distribution considered under the null hypothesis may be continuous (see Section 2), purely discrete or mixed (see Section 2.2). In the two-sample case (see Section 3), the distribution considered under the null hypothesis is a continuous distribution but is otherwise unrestricted.
   −
Kolmogorov-Smirnov统计量化了一个样本分布的'''<font color="#ff8000"> 经验分布函数Empirical distribution function</font>'''与一个参考分布的'''<font color="#ff8000"> 累积分布函数Cumulative distribution function</font>'''之间的距离,或者是两个样本分布的经验分布函数之间的距离。该统计量的'''<font color="#ff8000"> 零分布Null distribution</font>'''是基于'''<font color="#ff8000"> 零假设Null hypothesis</font>'''(或称原始假设)下计算的,可以从参考分布中抽取样本(在单个样本的情况下),或者从相同分布中抽取样本组(在两个样本的情况下)。属于单样本情况的时候,零假设(原假设)考虑的分布可能是连续的(请参阅第2节),纯离散的或混合的(请参阅第2.2节)。然而在考虑两个样本情况下(请参阅第3节),原假设下的分布仅能确定为连续分布,在其他方面并不受限制。
+
Kolmogorov-Smirnov统计定量描述了一个样本分布的'''<font color="#ff8000">经验分布函数 Empirical distribution function</font>'''与一个参考分布的'''<font color="#ff8000">累积分布函数 Cumulative distribution function</font>'''之间的距离,或者是两个样本分布的经验分布函数之间的距离。该统计量的'''<font color="#ff8000">零分布 Null distribution</font>'''是基于'''<font color="#ff8000">零假设Null hypothesis</font>'''(或称原始假设)下计算的,可以从参考分布中抽取样本(在单个样本的情况下),或者从相同分布中抽取样本组(在两个样本的情况下)。在单样本情况下,零假设(原假设)考虑的分布可能是连续的(请参阅第2节),纯离散的或混合的(请参阅第2.2节)。然而在考虑两个样本情况下(请参阅第3节),零假设下的分布仅能确定为连续分布,在其他方面并不受限制。
      第35行: 第35行:  
The Kolmogorov–Smirnov test can be modified to serve as a goodness of fit test. In the special case of testing for normality of the distribution, samples are standardized and compared with a standard normal distribution. This is equivalent to setting the mean and variance of the reference distribution equal to the sample estimates, and it is known that using these to define the specific reference distribution changes the null distribution of the test statistic (see Test with estimated parameters). Various studies have found that, even in this corrected form, the test is less powerful for testing normality than the Shapiro–Wilk test or Anderson–Darling test. However, these other tests have their own disadvantages. For instance the Shapiro–Wilk test is known not to work well in samples with many identical values.
 
The Kolmogorov–Smirnov test can be modified to serve as a goodness of fit test. In the special case of testing for normality of the distribution, samples are standardized and compared with a standard normal distribution. This is equivalent to setting the mean and variance of the reference distribution equal to the sample estimates, and it is known that using these to define the specific reference distribution changes the null distribution of the test statistic (see Test with estimated parameters). Various studies have found that, even in this corrected form, the test is less powerful for testing normality than the Shapiro–Wilk test or Anderson–Darling test. However, these other tests have their own disadvantages. For instance the Shapiro–Wilk test is known not to work well in samples with many identical values.
   −
Kolmogorov–Smirnov检验经过修改以后可以作为'''<font color="#ff8000"> 拟合优度检验goodness of fit test</font>'''。在测试分布正态性的特殊情况下,将样本先标准化再与标准正态分布进行比较。这相当于将参考分布的均值和方差设置为与样本估计值相等。显然,使用这些值和方差来定义特定参考分布会更改检验统计量的零分布(请参阅使用估算参数进行检验)。各种研究发现,即使采用这种校正形式,该测试也不能像Shapiro-Wilk检验或Anderson-Darling检验那样有效地检验正态性。当然,这些其他测试也有其自身的缺点。例如,Shapiro–Wilk检验在具有许多相同值的样本中效果并不好。
+
Kolmogorov–Smirnov检验经过修改以后可以作为'''<font color="#ff8000">拟合优度检验 goodness of fit test</font>'''。在测试分布正态性的特殊情况下,将样本先标准化再与标准正态分布进行比较。这相当于将参考分布的均值和方差设置为与样本估计值相等。显然,使用这些值和方差来定义特定参考分布会更改检验统计量的零分布(请参阅使用估算参数进行检验)。各种研究发现,即使采用这种校正形式,该测试也不能像夏皮罗一威尔克 Shapiro-Wilk检验或安德森·达林 Anderson-Darling检验那样有效地检验正态性。当然,这些检验方法也有其自身的缺点。例如,Shapiro–Wilk检验在具有许多相同值的样本中效果并不好。
 
        第43行: 第42行:  
The [[empirical distribution function]] ''F''<sub>''n''</sub> for ''n'' [[Independent and identically distributed random variables|independent and identically distributed]] (i.i.d.) ordered observations ''X<sub>i</sub>'' is defined as
 
The [[empirical distribution function]] ''F''<sub>''n''</sub> for ''n'' [[Independent and identically distributed random variables|independent and identically distributed]] (i.i.d.) ordered observations ''X<sub>i</sub>'' is defined as
   −
n个独立且均匀分布(i.i.d.)的有序观测值Xi的经验分布函数Fn定义为:
+
n个独立且同分布(i.i.d.)的有序观测值Xi的经验分布函数Fn定义为:
    
<math>F_n(x)={1 \over n}\sum_{i=1}^n I_{[-\infty,x]}(X_i)</math>
 
<math>F_n(x)={1 \over n}\sum_{i=1}^n I_{[-\infty,x]}(X_i)</math>
第65行: 第64行:  
where supx is the supremum of the set of distances. By the Glivenko–Cantelli theorem, if the sample comes from distribution F(x), then Dn converges to 0 almost surely in the limit when n goes to infinity. Kolmogorov strengthened this result, by effectively providing the rate of this convergence (see Kolmogorov distribution). Donsker's theorem provides a yet stronger result.
 
where supx is the supremum of the set of distances. By the Glivenko–Cantelli theorem, if the sample comes from distribution F(x), then Dn converges to 0 almost surely in the limit when n goes to infinity. Kolmogorov strengthened this result, by effectively providing the rate of this convergence (see Kolmogorov distribution). Donsker's theorem provides a yet stronger result.
   −
其中supx是距离集的最大值。根据Glivenko-Cantelli定理,如果样本来自分布F(x),则当n变为无穷大时,Dn几乎肯定会收敛于0。Kolmogorov通过有效加入收敛速率来增强此结果(请参阅Kolmogorov分布)。另外Donsker定理提供了更强的结果。
+
其中supx是距离集的上限值。根据格利文科·坎泰利 Glivenko-Cantelli定理,如果样本来自分布F(x),则当n变为无穷大时,Dn几乎肯定会收敛于0。科尔莫戈罗夫 Kolmogorov通过有效加入收敛速率来增强此结果(请参阅Kolmogorov分布)。另外Donsker定理提供了更有力的结果。
      第71行: 第70行:  
In practice, the statistic requires a relatively large number of data points (in comparison to other goodness of fit criteria such as the Anderson–Darling test statistic) to properly reject the null hypothesis.
 
In practice, the statistic requires a relatively large number of data points (in comparison to other goodness of fit criteria such as the Anderson–Darling test statistic) to properly reject the null hypothesis.
   −
在实践中,该统计需要相对大量的数据点(与其他拟合优度标准相比,例如Anderson-Darling检验统计)才能正确地拒绝原假设。
+
在实践中,该统计需要相对大量的数据点(与其他拟合优度标准相比,例如Anderson-Darling检验统计)才能正确地拒绝零假设。
      第87行: 第86行:  
where B(t) is the Brownian bridge. The cumulative distribution function of K is given by
 
where B(t) is the Brownian bridge. The cumulative distribution function of K is given by
   −
其中B(t)是布朗桥。K的累积分布函数为
+
其中B(t)是布朗 Brownian桥。K的累积分布函数为
    
\operatorname{Pr}(K\leq x)=1-2\sum_{k=1}^\infty (-1)^{k-1} e^{-2k^2 x^2}=\frac{\sqrt{2\pi}}{x}\sum_{k=1}^\infty e^{-(2k-1)^2\pi^2/(8x^2)},
 
\operatorname{Pr}(K\leq x)=1-2\sum_{k=1}^\infty (-1)^{k-1} e^{-2k^2 x^2}=\frac{\sqrt{2\pi}}{x}\sum_{k=1}^\infty e^{-(2k-1)^2\pi^2/(8x^2)},
第95行: 第94行:  
which can also be expressed by the Jacobi theta function \vartheta_{01}(z=0;\tau=2ix^2/\pi). Both the form of the Kolmogorov–Smirnov test statistic and its asymptotic distribution under the null hypothesis were published by Andrey Kolmogorov, while a table of the distribution was published by Nikolai Smirnov. Recurrence relations for the distribution of the test statistic in finite samples are available.
 
which can also be expressed by the Jacobi theta function \vartheta_{01}(z=0;\tau=2ix^2/\pi). Both the form of the Kolmogorov–Smirnov test statistic and its asymptotic distribution under the null hypothesis were published by Andrey Kolmogorov, while a table of the distribution was published by Nikolai Smirnov. Recurrence relations for the distribution of the test statistic in finite samples are available.
   −
也可以用Jacobi theta函数A表示{\displaystyle \vartheta _{01}(z=0;\tau =2ix^{2}/\pi )}.在零假设下,Andrey Kolmogorov定义并规范了Kolmogorov–Smirnov检验统计量的形式及其渐近分布,Nikolai Smirnov则规范了分布表。这里可以运用有限样本中检验统计量分布的递归关系。
+
也可以用雅可比θ Jacobi theta函数{\displaystyle \vartheta _{01}(z=0;\tau =2ix^{2}/\pi )}表示.在零假设下,Andrey Kolmogorov定义并规范了Kolmogorov–Smirnov检验统计量的形式及其渐近分布,Nikolai Smirnov则规范了分布表。这里可以运用有限样本中检验统计量分布的递归关系。
      第117行: 第116行:  
If ''F'' is continuous then under the null hypothesis <math>\sqrt{n}D_n</math> converges to the Kolmogorov distribution, which does not depend on ''F''. This result may also be known as the Kolmogorov theorem. The accuracy of this limit as an approximation to the exact cdf of <math>K</math> when <math>n</math> is finite is not very impressive: even when <math>n=1000</math>, the corresponding maximum error is about <math>0.9\%</math>; this error increases to <math>2.6\%</math> when <math>n=100</math> and to a totally unacceptable <math>7\%</math> when <math>n=10</math>.  However, a very simple expedient of replacing <math>x</math> by  
 
If ''F'' is continuous then under the null hypothesis <math>\sqrt{n}D_n</math> converges to the Kolmogorov distribution, which does not depend on ''F''. This result may also be known as the Kolmogorov theorem. The accuracy of this limit as an approximation to the exact cdf of <math>K</math> when <math>n</math> is finite is not very impressive: even when <math>n=1000</math>, the corresponding maximum error is about <math>0.9\%</math>; this error increases to <math>2.6\%</math> when <math>n=100</math> and to a totally unacceptable <math>7\%</math> when <math>n=10</math>.  However, a very simple expedient of replacing <math>x</math> by  
   −
如果F是连续的,则在原假设{\displaystyle {\sqrt {n}}D_{n}}下收敛到不依赖于F的Kolmogorov分布。该结果也称为Kolmogorov定理。当n为有限时,此极限的精确度近似为K的确切累积分布函数,效果并不十分令人满意:即使n = 1000,相应的最大误差约为0.9%。此错误在100时增加到2.6%,在10时增加到完全不可接受的7%。但是,如果将x替换为
+
如果F是连续的,则在原假设{\displaystyle {\sqrt {n}}D_{n}}下收敛到不依赖于F的Kolmogorov分布。该结果也称为Kolmogorov定理。当n为有限时,此极限的精确度近似为K的确切累积分布函数,效果并不十分令人满意:即使n = 1000,相应的最大误差约为0.9%。在n=100时,此误差增加到2.6%,在n=10时增加到完全不可接受的7%。但是,如果简单地将x替换为
    
:<math>x+\frac{1}{6\sqrt{n}}+ \frac{x-1}{4n}</math>
 
:<math>x+\frac{1}{6\sqrt{n}}+ \frac{x-1}{4n}</math>
第131行: 第130行:  
The ''goodness-of-fit'' test or the Kolmogorov–Smirnov test can be constructed by using the critical values of the Kolmogorov distribution. This test is asymptotically valid when <math>n \to\infty</math>. It rejects the null hypothesis at level <math>\alpha</math> if
 
The ''goodness-of-fit'' test or the Kolmogorov–Smirnov test can be constructed by using the critical values of the Kolmogorov distribution. This test is asymptotically valid when <math>n \to\infty</math>. It rejects the null hypothesis at level <math>\alpha</math> if
   −
拟合优度检验或Kolmogorov–Smirnov检验可通过使用Kolmogorov分布的临界值来构建。当{\displaystyle n\to \infty }时,该检验是渐近有效的。如果条件为{\displaystyle {\sqrt {n}}D_{n}>K_{\alpha },\,},它会拒绝{\displaystyle \alpha }等级上原假设。
+
拟合优度检验或Kolmogorov–Smirnov检验可通过使用Kolmogorov分布的临界值来构建。当{\displaystyle n\to \infty }时,该检验是渐近有效的。如果条件为{\displaystyle {\sqrt {n}}D_{n}>K_{\alpha },\,},它会拒绝{\displaystyle \alpha }等级上的零假设。
      第143行: 第142行:  
The asymptotic [[statistical power|power]] of this test is 1.
 
The asymptotic [[statistical power|power]] of this test is 1.
   −
该渐进检测效能为1。
+
这个检验的渐近幂是1。
 
        第152行: 第150行:  
[8] for purely discrete, mixed or continuous null distribution implemented in the KSgeneral package [9] of the R project for statistical computing, which for a given sample also computes the KS test statistic and its p-value. Alternative C++ implementation is available from [8].
 
[8] for purely discrete, mixed or continuous null distribution implemented in the KSgeneral package [9] of the R project for statistical computing, which for a given sample also computes the KS test statistic and its p-value. Alternative C++ implementation is available from [8].
   −
用于计算任意n和x的累积分布函数<math>\operatorname{Pr}(D_n \leq x)</math>或其补数的快速准确的算法:
+
用于计算任意n和x的累积分布函数<math>\operatorname{Pr}(D_n \leq x)</math>或其补数的快速准确的算法可以从以下获取:
   −
* 统计软件期刊2011年Journal of Statistical Software刊登的Simard R, L'Ecuyer P的文章《计算双向Kolmogorov–Smirnov分布》以及统计与概率通信期刊2017年刊登的Moscovich A, Nadler B 的文章《快速计算泊松过程的边界穿越概率》。在文章《计算双向Kolmogorov–Smirnov分布》中找到具有C和Java代码的连续零分布。
+
* 统计软件期刊2011年Journal of Statistical Software刊登的Simard R, L'Ecuyer P的文章《计算双向Kolmogorov–Smirnov分布》以及统计与概率通信期刊2017年刊登的Moscovich A, Nadler B 的文章《快速计算泊松过程的边界穿越概率》。关于连续零分布的C和Java代码实现可以在文章《计算双向Kolmogorov–Smirnov分布》中找到。
* 统计软件期刊2019年Journal of Statistical Software刊登的Dimitrova DS, Kaishev VK, Tan S的文章《当潜在累积分布函数是完全离散,混合或连续时,计算Kolmogorov–Smirnov分布》和Dimitrova, Dimitrina; Kaishev, Vladimir; Tan, Senren.的文章《KSgeneral:计算(离散)连续零分布的K-S检验的P值》。对于R项目的KSgeneral软件包中实现的纯离散,混合或连续零分布,可以进行统计计算,对于给定的样本,它还可以计算KS检验统计量及其p值。或者,可以从文章《当潜在累积分布函数是完全离散,混合或连续时,计算Kolmogorov–Smirnov分布》中获得替代的C ++实现。
+
* 统计软件期刊2019年Journal of Statistical Software刊登的Dimitrova DS, Kaishev VK, Tan S的文章《当潜在累积分布函数是完全离散,混合或连续时,计算Kolmogorov–Smirnov分布》和Dimitrova, Dimitrina; Kaishev, Vladimir; Tan, Senren.的文章《KSgeneral:计算(离散)连续零分布的K-S检验的P值》。R工程KSgeneral软件包中实现的纯离散,混合或连续零分布,可以进行统计计算,对于给定的样本,它还可以计算KS检验统计量及其p值。或者,可以从文章《当潜在累积分布函数是完全离散,混合或连续时,计算Kolmogorov–Smirnov分布》中获得替代的C++实现。
      第163行: 第161行:  
If either the form or the parameters of ''F''(''x'') are determined from the data ''X''<sub>''i''</sub> the critical values determined in this way are invalid. In such cases, [[Monte Carlo method|Monte Carlo]] or other methods may be required, but tables have been prepared for some cases. Details for the required modifications to the test statistic and for the critical values for  the [[normal distribution]] and the [[exponential distribution]] have been published, and later publications also include the [[Gumbel distribution]]. The [[Lilliefors test]] represents a special case of this for the normal distribution. The logarithm transformation may help to overcome cases where the Kolmogorov test data does not seem to fit the assumption that it came from the normal distribution.
 
If either the form or the parameters of ''F''(''x'') are determined from the data ''X''<sub>''i''</sub> the critical values determined in this way are invalid. In such cases, [[Monte Carlo method|Monte Carlo]] or other methods may be required, but tables have been prepared for some cases. Details for the required modifications to the test statistic and for the critical values for  the [[normal distribution]] and the [[exponential distribution]] have been published, and later publications also include the [[Gumbel distribution]]. The [[Lilliefors test]] represents a special case of this for the normal distribution. The logarithm transformation may help to overcome cases where the Kolmogorov test data does not seem to fit the assumption that it came from the normal distribution.
   −
如果以数据Xi来确定F(x)的形式或参数,则以这种方式确定的临界值是无效的。在这种情况下,可能需要Monte Carlo或其他方法,不过数据表格已经做了多个情况背景的准备。业界目前已经发布了对测试统计量的必要修正细节以及正态分布和指数分布临界值的具体信息,以后的出版物还包括Gumbel分布。另外Lilliefors检测代表正态分布的一种特殊情况。另外为了克服Kolmogorov检验数据不符合(疑似)来自正态分布假设的情况,可以进行对数变换。
+
如果以数据Xi来确定F(x)的形式或参数,则以这种方式确定的临界值是无效的。在这种情况下,可能需要蒙特卡洛 Monte Carlo或其他方法,不过数据表格已经做了多个情况下的准备。业界目前已经发布了对测试统计量的必要修正细节以及正态分布和指数分布临界值的具体信息,以后的出版物还包括耿贝尔 Gumbel分布。另外莉莉福斯 Lilliefors检验代表正态分布的一种特殊情况。另外为了克服Kolmogorov检验数据可能不符合来自正态分布假设的情况,可以进行对数变换。
      第175行: 第173行:  
Under the assumption that <math>F(x)</math> is non-decreasing and right-continuous, with countable (possibly infinite) number of jumps, the KS test statistic can be expressed as:
 
Under the assumption that <math>F(x)</math> is non-decreasing and right-continuous, with countable (possibly infinite) number of jumps, the KS test statistic can be expressed as:
   −
假设F(x)是非递减且右连续的,且具有可数(可能是无限)的跳跃次数,则KS检验统计量可表示为:
+
假设F(x)是非递减且右连续的,且具有可数(可能是无限)的跳变次数,则KS检验统计量可表示为:
    
:<math>D_n= \sup_x |F_n(x)-F(x)| = \sup_{0 \leq t \leq 1} |F_n(F^{-1}(t)) - F(F^{-1}(t))|. </math>
 
:<math>D_n= \sup_x |F_n(x)-F(x)| = \sup_{0 \leq t \leq 1} |F_n(F^{-1}(t)) - F(F^{-1}(t))|. </math>
第194行: 第192行:  
The Kolmogorov–Smirnov test may also be used to test whether two underlying one-dimensional probability distributions differ. In this case, the Kolmogorov–Smirnov statistic is
 
The Kolmogorov–Smirnov test may also be used to test whether two underlying one-dimensional probability distributions differ. In this case, the Kolmogorov–Smirnov statistic is
   −
Kolmogorov–Smirnov检验也可用于检验两个基本的一维概率分布不同与否。在这种情况下,Kolmogorov-Smirnov统计量为
+
Kolmogorov–Smirnov检验也可用于检验两个潜在的一维概率分布是否不同。在这种情况下,Kolmogorov-Smirnov统计量为
    
<math>D_{n,m}=\sup_x |F_{1,n}(x)-F_{2,m}(x)|,</math>
 
<math>D_{n,m}=\sup_x |F_{1,n}(x)-F_{2,m}(x)|,</math>
第202行: 第200行:  
where <math>F_{1,n}</math> and <math>F_{2,m}</math> are the [[empirical distribution function]]s of the first and the second sample respectively, and <math>\sup</math> is the [[Infimum and supremum|supremum function]].
 
where <math>F_{1,n}</math> and <math>F_{2,m}</math> are the [[empirical distribution function]]s of the first and the second sample respectively, and <math>\sup</math> is the [[Infimum and supremum|supremum function]].
   −
其中F1,n和F2,m分别是第一样本和第二样本的经验分布函数,而sup是最高函数。对于量大的样本,如果满足以下条件,则原假设在α级被拒绝:
+
其中F1,n和F2,m分别是第一样本和第二样本的经验分布函数,而sup是上确界函数。
      第259行: 第257行:     
While the Kolmogorov–Smirnov test is usually used to test whether a given ''F''(''x'') is the underlying probability distribution of ''F''<sub>''n''</sub>(''x''), the procedure may be inverted to give confidence limits on ''F''(''x'') itself. If one chooses a critical value of the test statistic ''D''<sub>''α''</sub> such that P(''D''<sub>''n''</sub>&nbsp;>&nbsp;''D''<sub>''α''</sub>) = ''α'', then a band of width ±''D''<sub>''α''</sub> around ''F''<sub>''n''</sub>(''x'') will entirely contain ''F''(''x'') with probability 1&nbsp;−&nbsp;''α''.
 
While the Kolmogorov–Smirnov test is usually used to test whether a given ''F''(''x'') is the underlying probability distribution of ''F''<sub>''n''</sub>(''x''), the procedure may be inverted to give confidence limits on ''F''(''x'') itself. If one chooses a critical value of the test statistic ''D''<sub>''α''</sub> such that P(''D''<sub>''n''</sub>&nbsp;>&nbsp;''D''<sub>''α''</sub>) = ''α'', then a band of width ±''D''<sub>''α''</sub> around ''F''<sub>''n''</sub>(''x'') will entirely contain ''F''(''x'') with probability 1&nbsp;−&nbsp;''α''.
 +
 +
    
虽然通常使用Kolmogorov–Smirnov检验法来检验给定的F(x)是否为Fn(x)的潜在概率分布,但可以将过程倒过来给出F(x)本身的置信极限。如果选择检验统计量Dα的临界值,使得P(Dn>Dα)=α,则在Fn(x)周围宽度±Dα内将完全包含概率为1-α的F(x)。
 
虽然通常使用Kolmogorov–Smirnov检验法来检验给定的F(x)是否为Fn(x)的潜在概率分布,但可以将过程倒过来给出F(x)本身的置信极限。如果选择检验统计量Dα的临界值,使得P(Dn>Dα)=α,则在Fn(x)周围宽度±Dα内将完全包含概率为1-α的F(x)。
第274行: 第274行:  
The Kolmogorov–Smirnov test statistic needs to be modified if a similar test is to be applied to [[multivariate statistics|multivariate data]]. This is not straightforward because the maximum difference between two joint [[cumulative distribution function]]s is not generally the same as the maximum difference of any of the complementary distribution functions. Thus the maximum difference will differ depending on which of <math>\Pr(x < X \land y < Y)</math> or <math>\Pr(X < x \land Y > y)</math> or any of the other two possible arrangements is used. One might require that the result of the test used should not depend on which choice is made.
 
The Kolmogorov–Smirnov test statistic needs to be modified if a similar test is to be applied to [[multivariate statistics|multivariate data]]. This is not straightforward because the maximum difference between two joint [[cumulative distribution function]]s is not generally the same as the maximum difference of any of the complementary distribution functions. Thus the maximum difference will differ depending on which of <math>\Pr(x < X \land y < Y)</math> or <math>\Pr(X < x \land Y > y)</math> or any of the other two possible arrangements is used. One might require that the result of the test used should not depend on which choice is made.
   −
如果要将类似的检验应用于多元数据,则需要修改Kolmogorov–Smirnov检验统计量。过程略显复杂,因为两个联合累积分布函数之间的最大差异通常与任何互补分布函数中的最大差异都不相同。因此,最大差异将取决于使用<math>\Pr(x < X \land y < Y)</math>或<math>\Pr(X < x \land Y > y)</math>中的哪一个,或者使用其他两种可能分布中的任何一种。当然也有可能要求所用的检测结果无关于使用选择。
+
如果要将类似的检验应用于多元数据,则需要修改Kolmogorov–Smirnov检验统计量。过程略显复杂,因为两个联合累积分布函数之间的最大差异通常与任何互补分布函数中的最大差异都不相同。因此,最大差异将取决于使用<math>\Pr(x < X \land y < Y)</math>或<math>\Pr(X < x \land Y > y)</math>中的哪一个,或者使用其他两种可能分布中的任何一种。当然有可能要求所用的检测结果无关于这样的选择。
      第280行: 第280行:  
One approach to generalizing the Kolmogorov–Smirnov statistic to higher dimensions which meets the above concern is to compare the cdfs of the two samples with all possible orderings, and take the largest of the set of resulting K–S statistics.  In ''d'' dimensions, there are 2<sup>''d''</sup>−1 such orderings.  One such variation is due to Peacock(see also Gosset for a 3D version) and another to Fasano and Franceschini (see Lopes et al. for a comparison and computational details). Critical values for the test statistic can be obtained by simulations, but depend on the dependence structure in the joint distribution.
 
One approach to generalizing the Kolmogorov–Smirnov statistic to higher dimensions which meets the above concern is to compare the cdfs of the two samples with all possible orderings, and take the largest of the set of resulting K–S statistics.  In ''d'' dimensions, there are 2<sup>''d''</sup>−1 such orderings.  One such variation is due to Peacock(see also Gosset for a 3D version) and another to Fasano and Franceschini (see Lopes et al. for a comparison and computational details). Critical values for the test statistic can be obtained by simulations, but depend on the dependence structure in the joint distribution.
   −
在满足以上要求的同时,将Kolmogorov-Smirnov统计量泛化为更高维度的一种方法是,比较两个样本的累积分布函数与所有可能的排序,并从所得的K-S统计量集中最大。在d维中,有2d-1个这样的排序。Peacock得出了一种这样的变化量(有关3D版本,另请参见Gosset),另一种由Fasano和Franceschini得出(有关比较和计算细节,请参见Lopes等人)。可以通过模拟获得检测统计量的临界值,但取决于联合分布中的依存关系结构。
+
在满足以上要求的同时,将Kolmogorov-Smirnov统计量泛化为更高维度的一种方法是,在所有可能的排序中比较两个样本的累积分布函数,并从所得的K-S统计量中取最大。在d维数据中,有2d-1个这样的排序。Peacock得出了一种这样的变化量(有关3D版本,另请参见Gosset),另一种由Fasano和Franceschini得出(有关比较和计算细节,请参见Lopes等人)。检测统计量的临界值可以通过仿真获取,但取决于联合分布中的依存关系结构。
      第286行: 第286行:  
In one dimension, the Kolmogorov–Smirnov statistic is identical to the so-called star discrepancy D, so another native KS extension to higher dimensions would be simply to use D also for higher dimensions. Unfortunately, the star discrepancy is hard to calculate in high dimensions.
 
In one dimension, the Kolmogorov–Smirnov statistic is identical to the so-called star discrepancy D, so another native KS extension to higher dimensions would be simply to use D also for higher dimensions. Unfortunately, the star discrepancy is hard to calculate in high dimensions.
   −
一维的Kolmogorov-Smirnov统计量与所谓的星差异D相同,因此,另一个对更高维度的本地KS扩展是将D也用于更高维度。可惜的是,很难从高维度上计算出星差异。
+
一维的Kolmogorov-Smirnov统计量与所谓的星差D相同,因此,另一个对更高维度的本地KS扩展是将D也用于更高维度。可惜的是,很难从高维度上计算出星差。
    
== Implementations 软件实现==
 
== Implementations 软件实现==
第319行: 第319行:  
* [[Microsoft Excel|Excel]] runs the test  as KSCRIT and KSPROB
 
* [[Microsoft Excel|Excel]] runs the test  as KSCRIT and KSPROB
   −
* 科学计算软件Wolfram Mathematica内含Kolmogorov Smirnov Test
+
* 科学计算软件Wolfram Mathematica内含Kolmogorov Smirnov Test。
 
* MATLAB在其统计工具箱中含有K-S test。
 
* MATLAB在其统计工具箱中含有K-S test。
 
* R语言包“KSgeneral”可以在任意,可能离散,混合或连续的零分布下计算KS检验统计信息及其p值。
 
* R语言包“KSgeneral”可以在任意,可能离散,混合或连续的零分布下计算KS检验统计信息及其p值。
 
* R语言的统计基本程序包在其“stats”程序包中可以运行检验,命令为ks.test {stats}。
 
* R语言的统计基本程序包在其“stats”程序包中可以运行检验,命令为ks.test {stats}。
* 统计软件SAS在其PROC NPAR1WAY程序中可以实现检测。
+
* 统计软件SAS在其PROC NPAR1WAY程序中可以实现检验。
* Python通过SciPy中的统计功能(scipy.stats)可以实现检测。
+
* Python通过SciPy中的统计功能(scipy.stats)可以实现检验。
 
* SYSTAT(SPSS Inc.,伊利诺伊州芝加哥)
 
* SYSTAT(SPSS Inc.,伊利诺伊州芝加哥)
* 基于Java语言开发的Apache Commons可以实现检测
+
* 基于Java语言开发的Apache Commons可以实现检验。
* KNIME是一个数据分析平台,基于上述Java语言,可以通过一个节点Node来实现检测
+
* KNIME是一个数据分析平台,基于上述Java语言,可以通过一个节点Node来实现检验。
* StatsDirect(StatsDirect Ltd,英国曼彻斯特)实施所有常见变体。
+
* StatsDirect(StatsDirect Ltd,英国曼彻斯特)包含所有常见的变体。
* Stata(德克萨斯州大学城Stata公司)在ksmirnov(Kolmogorov–Smirnov分配均等测试)中执行检测命令。
+
* Stata(德克萨斯州大学城Stata公司)在ksmirnov(Kolmogorov–Smirnov分配均等测试)中执行检验命令。
* PSPP通过其Kolmogorov–Smirnov(或使用K-S快捷功能)实施测试。
+
* PSPP通过其Kolmogorov–Smirnov(或使用K-S快捷功能)实施检验。
* Excel以KSCRIT和KSPROB的形式运行检测
+
* Excel以KSCRIT和KSPROB的形式运行检验。
      第349行: 第349行:  
*[[Cramér–von Mises criterion|Cramér–von Mises test]]
 
*[[Cramér–von Mises criterion|Cramér–von Mises test]]
   −
* Lepage测试
+
* 勒帕热 Lepage检验
* Cucconi测试
+
* Cucconi检验
* Kuiper检验
+
* 柯伊伯 Kuiper检验
* Shapiro–Wilk测试
+
* 夏皮罗-威尔克 Shapiro–Wilk检验
* Anderson–Darling测试
+
* 安德森-达林 Anderson–Darling检验
* Cramér–von Mises检验
+
* 克莱姆·冯·米塞斯 Cramér–von Mises检验
      第397行: 第397行:  
* “Kolmogorov–Smirnov测验”,数学百科全书,EMS出版社,2001[1994]
 
* “Kolmogorov–Smirnov测验”,数学百科全书,EMS出版社,2001[1994]
 
* KS简短介绍
 
* KS简短介绍
* KS检测说明
+
* KS检验说明
* 单边和双边测试的JavaScript实现
+
* 单边和双边检验的JavaScript实现
* KS检测在线计算器
+
* KS检验在线计算器
* 开源C++代码可计算Kolmogorov分布并执行KS检测
+
* 开源C++代码可计算Kolmogorov分布并执行KS检验
 
* 关于评估Kolmogorov分布的论文,包含C实现。这是Matlab中常使用的方法。
 
* 关于评估Kolmogorov分布的论文,包含C实现。这是Matlab中常使用的方法。
 
* 计算双向Kolmogorov-Smirnov分布的论文;用C或Java计算KS统计信息的累积分布函数。
 
* 计算双向Kolmogorov-Smirnov分布的论文;用C或Java计算KS统计信息的累积分布函数。
* Paper powerlaw:用于分析重尾分布的Python包; Jeff Alstott,Ed Bullmore和Dietmar Plenz。除此之外,它还执行Kolmogorov-Smirnov检测。PyPi提供了powerlaw软件包的源代码和安装程序。
+
* Paper powerlaw:用于分析重尾分布的Python包; Jeff Alstott,Ed Bullmore和Dietmar Plenz。除此之外,它还执行Kolmogorov-Smirnov检验。PyPi提供了powerlaw软件包的源代码和安装程序。
19

个编辑

导航菜单