第109行: |
第109行: |
| | | |
| From the right-continuity of F(x), it follows that F(F^{-1}(t)) \geq t and F^{-1}(F(x)) \leq x and hence, the distribution of D_{n} depends on the null distribution F(x), i.e., is no longer distribution-free as in the continuous case. Therefore, a fast and accurate method has been developed to compute the exact and asymptotic distribution of D_{n} when F(x) is purely discrete or mixed as part of the dgof package of the R language. Major statistical packages among which SAS PROC NPAR1WAY , Stata ksmirnov implement the KS test under the assumption that F(x) is continuous, which is more conservative if the null distribution is actually not continuous (see | | From the right-continuity of F(x), it follows that F(F^{-1}(t)) \geq t and F^{-1}(F(x)) \leq x and hence, the distribution of D_{n} depends on the null distribution F(x), i.e., is no longer distribution-free as in the continuous case. Therefore, a fast and accurate method has been developed to compute the exact and asymptotic distribution of D_{n} when F(x) is purely discrete or mixed as part of the dgof package of the R language. Major statistical packages among which SAS PROC NPAR1WAY , Stata ksmirnov implement the KS test under the assumption that F(x) is continuous, which is more conservative if the null distribution is actually not continuous (see |
− |
| |
− |
| |
| | | |
| The asymptotic [[statistical power|power]] of this test is 1. | | The asymptotic [[statistical power|power]] of this test is 1. |
− |
| |
− |
| |
| | | |
| Illustration of the two-sample Kolmogorov–Smirnov statistic. Red and blue lines each correspond to an empirical distribution function, and the black arrow is the two-sample KS statistic. | | Illustration of the two-sample Kolmogorov–Smirnov statistic. Red and blue lines each correspond to an empirical distribution function, and the black arrow is the two-sample KS statistic. |
− |
| |
− | 两样本 Kolmogorov-Smirnov 统计量的图解。红线和蓝线分别对应于一个经验分布函数,黑箭头是两个样本的 KS 统计。
| |
| | | |
| Fast and accurate algorithms to compute the cdf <math>\operatorname{Pr}(D_n \leq x)</math> or its complement for arbitrary <math>n</math> and <math>x</math>, are available from: | | Fast and accurate algorithms to compute the cdf <math>\operatorname{Pr}(D_n \leq x)</math> or its complement for arbitrary <math>n</math> and <math>x</math>, are available from: |
− |
| |
− |
| |
| | | |
| 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 统计量是
| + | [6] and [7] for continuous null distributions with code in C and Java to be found in [6]. |
− | | + | [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]. |
− | * <ref name=SL2011>{{Cite journal |vauthors=Simard R, L'Ecuyer P |year=2011 |title=Computing the Two-Sided Kolmogorov–Smirnov Distribution |journal=Journal of Statistical Software |volume=39 |issue=11 |pages=1–18 |doi=10.18637/jss.v039.i11 |doi-access=free }}</ref> and <ref>{{Cite journal |vauthors=Moscovich A, Nadler B |year=2017 |title=Fast calculation of boundary crossing probabilities for Poisson processes |journal=Statistics and Probability Letters |volume=123 |issue= |pages=177–182 |doi=10.1016/j.spl.2016.11.027|arxiv=1503.04363 }}</ref> for continuous null distributions with code in C and Java to be found in <ref name=SL2011/>.
| |
− | | |
− | | |
− | | |
− | D_{n,m}=\sup_x |F_{1,n}(x)-F_{2,m}(x)|,
| |
− | | |
− | D _ { n,m } = sup _ x | f _ {1,n }(x)-f _ {2,m }(x) | ,
| |
− | | |
− | * <ref name=DKT2019>{{Cite journal |vauthors=Dimitrova DS, Kaishev VK, Tan S |year=2019 |title=Computing the Kolmogorov–Smirnov Distribution when the Underlying cdf is Purely Discrete, Mixed or Continuous |journal=Journal of Statistical Software |volume=forthcoming |url=http://openaccess.city.ac.uk/18541/ }}</ref> for purely discrete, mixed or continuous null distribution implemented in the KSgeneral package <ref name=KSgeneral>{{Cite web|url=https://cran.r-project.org/web/packages/KSgeneral/index.html|title=KSgeneral: Computing P-Values of the K-S Test for (Dis)Continuous Null Distribution|last1=Dimitrova|first1=Dimitrina | last2=Kaishev| first2=Vladimir | last3=Tan|first3=Senren|date=|website=cran.r-project.org/web/packages/KSgeneral/index.html|publisher=|access-date=}}</ref> of the [[R (programming language)|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 <ref name=DKT2019/>.
| |
− | | |
− | | |
− | | |
− | where F_{1,n} and F_{2,m} are the empirical distribution functions of the first and the second sample respectively, and \sup is the supremum function.
| |
− | | |
− | 其中 f {1,n }和 f {2,m }分别是第一和第二样本的经验分布函数,sup 是上确界函数。
| |
| | | |
| ===Test with estimated parameters=== | | ===Test with estimated parameters=== |