柯尔莫可洛夫-斯米洛夫检验(Kolmogorov–Smirnov test,K-S test)
柯?tīng)柲缏宸?斯米爾諾夫檢驗(yàn)(Колмогоров-Смирнов檢驗(yàn))基于累計(jì)分布函數(shù),用以檢驗(yàn)兩個(gè)經(jīng)驗(yàn)分布是否不同或一個(gè)經(jīng)驗(yàn)分布與另一個(gè)理想分布是否不同。
在進(jìn)行cumulative probability統(tǒng)計(jì)(如下圖)的時(shí)候,你怎么知道組之間是否有顯著性差異?有人首先想到單因素方差分析或雙尾檢驗(yàn)(2 tailed TEST)。其實(shí)這些是不準(zhǔn)確的,最好采用Kolmogorov-Smirnov test(柯?tīng)柲Z夫-斯米爾諾夫檢驗(yàn))來(lái)分析變量是否符合某種分布或比較兩組之間有無(wú)顯著性差異。
Kolmogorov-Smirnov test原理:尋找最大距離(Distance), 所以常簡(jiǎn)稱為D法。 適用于大樣本。KS test checks if two independent distributions are similar or different, by generating cumulative probability plots for two distributions and finding the distance along the y-axis for a given x values between the two curves. From all the distances calculated for each x value, the maximum distance is searched.
如何分析結(jié)果呢?This maximum distance or maximum difference is then plugged into KS probability function to calculate the probability value. The lower the probability value is the less likely the two distributions are similar. Conversely, the higher or more close to 1 the value is the more similar the two distributions are.極端情況:如果P值為1的話,說(shuō)明兩給數(shù)據(jù)基本相同,如果P值無(wú)限接近0,說(shuō)明兩組數(shù)據(jù)差異性極大。
有一個(gè)網(wǎng)站可以進(jìn)行在線的統(tǒng)計(jì),你只需要輸入數(shù)據(jù)就可以了。地址如下:http://www.physics.csbsju.edu/stats/KS-test.n.plot_form.html
當(dāng)然還有更多的軟件支持這個(gè)統(tǒng)計(jì),如SPSS,SAS,MiniAnalysis,Clampfit10
根據(jù)軟件統(tǒng)計(jì)出來(lái)后給出的結(jié)果決定有沒(méi)有顯著性差異,如果Dmax值>D0.05。則認(rèn)為有顯著性差異。D0.05的經(jīng)驗(yàn)算法:1.36/SQRT(N) 其中SQRT為平方要,N為樣本數(shù)。D0.01經(jīng)驗(yàn)算法1.64/SQRT(N) 。當(dāng)然最準(zhǔn)確的辦法還是去查KS檢定表。不過(guò)大多數(shù)軟件如CLAMPFIT,MINIANALYSIS統(tǒng)計(jì)出來(lái)的結(jié)果都是直接有P值。根據(jù)這個(gè)值(alpha=0.05)就可以斷定有沒(méi)有差異了。
在統(tǒng)計(jì)學(xué)中,柯?tīng)柲陕宸?斯米洛夫檢驗(yàn)基于累計(jì)分布函數(shù),用以檢驗(yàn)兩個(gè)經(jīng)驗(yàn)分布是否不同或一個(gè)經(jīng)驗(yàn)分布與另一個(gè)理想分布是否不同。
在進(jìn)行累計(jì)概率(cumulative probability)統(tǒng)計(jì)的時(shí)候,你怎么知道組之間是否有顯著性差異?有人首先想到單因素方差分析或雙尾檢驗(yàn)(2 tailedTEST)。其實(shí)這些是不準(zhǔn)確的,最好采用Kolmogorov-Smirnovtest(柯?tīng)柲Z夫-斯米爾諾夫檢驗(yàn))來(lái)分析變量是否符合某種分布或比較兩組之間有無(wú)顯著性差異。
分類(lèi):
1、Single sample Kolmogorov-Smirnov goodness-of-fit hypothesis test.
采用柯?tīng)柲Z夫-斯米爾諾夫檢驗(yàn)來(lái)分析變量是否符合某種分布,可以檢驗(yàn)的分布有正態(tài)分布、均勻分布、Poission分布和指數(shù)分布。指令如下:
>> H = KSTEST(X,CDF,ALPHA,TAIL) % X為待檢測(cè)樣本,CDF可選:如果空缺,則默認(rèn)為檢測(cè)標(biāo)準(zhǔn)正態(tài)分布;
如果填寫(xiě)兩列的矩陣,第一列是x的可能的值,第二列是相應(yīng)的假設(shè)累計(jì)概率分布函數(shù)的值G(x)。ALPHA是顯著性水平(默認(rèn)0.05)。TAIL是表示檢驗(yàn)的類(lèi)型(默認(rèn)unequal,不平衡)。還有l(wèi)arger,smaller可以選擇。
如果,H=1 則否定無(wú)效假設(shè); H=0,不否定無(wú)效假設(shè)(在alpha水平上)
例如,
x = -2:1:4
x =
-2-101234
[h,p,k,c] = kstest(x,[],0.05,0)
h =
0
p =
0.13632
k =
0.41277
c =
0.48342
The test fails to reject the null hypothesis that the values come from a standard normal distribution.
2、Two-sample Kolmogorov-Smirnov test
檢驗(yàn)兩個(gè)數(shù)據(jù)向量之間的分布的。
>>[h,p,ks2stat] = kstest2(x1,x2,alpha,tail)
% x1,x2都為向量,ALPHA是顯著性水平(默認(rèn)0.05)。TAIL是表示檢驗(yàn)的類(lèi)型(默認(rèn)unequal,不平衡)。
例如,x = -1:1:5
y = randn(20,1);
[h,p,k] = kstest2(x,y)
h =
0
p =
0.0774
k =
0.5214
wiki翻譯起來(lái)太麻煩,還有可能曲解本意,最好看原版解釋。
Instatistics, theKolmogorov–Smirnovtest (K–S test)is a form ofminimum distance estimationused as anonparametric testof equality of one-dimensionalprobability distributionsused to compare asamplewith a reference probability distribution (one-sample K–S test), or to compare two samples (two-sample K–S test). The Kolmogorov–Smirnov statistic quantifies adistancebetween theempirical distribution functionof the sample and thecumulative distribution functionof the reference distribution, or between the empirical distribution functions of two samples. Thenull distributionof this statistic is calculated under the null hypothesis that the samples are drawn from the same distribution (in the two-sample case) or that the sample is drawn from the reference distribution (in the one-sample case). In each case, the distributions considered under the null hypothesis are continuous distributions but are otherwise unrestricted.
The two-sample KS test is one of the most useful and general nonparametric methods for comparing two samples, as it is sensitive to differences in both location and shape of the empirical cumulative distribution functions of the two samples.
The Kolmogorov–Smirnov test can be modified to serve as agoodness of fittest. In the special case of testing fornormalityof 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 the sample to modify the null hypothesis reduces thepowerof a test. Correcting for this bias leads to theLilliefors test. However, even Lilliefors' modification is less powerful than theShapiro–Wilk testorAnderson–Darling testfor testing normality.[1]
總結(jié)
以上是生活随笔為你收集整理的柯尔莫可洛夫-斯米洛夫检验(Kolmogorov–Smirnov test,K-S test)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 毛玻璃效果简单实现
- 下一篇: STM32 各引脚功能