フィルターのクリア

how interpret Kolmogrov test outputs?

9 ビュー (過去 30 日間)
Mar Ta
Mar Ta 2017 年 9 月 9 日
Hello, I want to use kstest2 function to see whether my samples have same distribution or not.
[h,p,ks2stat] = kstest2(x1,x2);
i tested different samples and all the time i got h = 1 and p = 0 as output, but ks2stat output changes for different tests. my question is that what is ks2stat and how it changes between different samples. can i use it to get in to any conclusion about samples? if YES, how?
thanks

回答 (2 件)

dpb
dpb 2017 年 9 月 9 日
編集済み: dpb 2017 年 9 月 9 日
h,p are the results of the hypothesis test at the (default) 5% significance level-- h is a logical "pass/fail" flag while p is the estimated significance for the specific test evaluated; the last optional argument is the actual computed statistic.
If the null hypothesis that the two distributions are from the same parent distribution cannot be rejected at the chosen significance level h will be 0 (False); otherwise it will be 1 (True). If your cases all are [1,0] for the first two, that indicates there's such a large dichotomy between the two cases that the estimate of the probability is so far out into the tail that it is approximately 0 to the precision shown by default. That the actual statistic is somewhat different shows that the data aren't actually identically the same.
Look at the first example in the documentation but then make a simple change/extension to it--
>> rng(1); % For reproducibility
x1 = wblrnd(1,1,1,50); % sample from Weibel
x2 = wblrnd(1.2,2,1,50); % sample different distribution
>> [h,p,ks2]=kstest2(x1,x2) % output -- they're different; p=0.03 < 0.05 default
h =
1
p =
0.0317
ks2 =
0.2800
>> x2 = wblrnd(1,1,1,50); % make second distribution from same parameters as first
>> [h,p,ks2]=kstest2(x1,x2) % can't tell they're different; as expected.
h =
0
p =
0.8409
ks2 =
0.1200
>>
Read the extended help More About sections for background on the test itself; references in the statistical literature are also given altho any competent statistics text that includes nonparametric tests will cover it in some depth.

Albert Johan Mamani Larico
Albert Johan Mamani Larico 2022 年 4 月 1 日
編集済み: Albert Johan Mamani Larico 2022 年 4 月 1 日
My understading about it is:
-h : is the result of the comparison of 2 vectors (h=0 means equal distribution, h=1 means diferent distributions)
-p : is the p-value or the level of confidence of the results(which depend on the number of data in each vector)
-ks2stat: is the test statistic D(maximum difference between empirical distribution functions) in the original equation of the KS test, which is used for h estimation

カテゴリ

Help Center および File ExchangeHypothesis Tests についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by