Introduction
K-S test는 두 가지 경우에 사용된다. 첫 번째는 추출한 샘플들이 특정한 probability distribution을 따를 것인지를 확인하는 것이고(one-sample K-S test), 두 번째는 두 개의 sample 집합을 보고 같은 probability distribution에서 추출되었는지를 확인하는 것이다(two-sample K-S test).
K-S test는 non-parametric test이다. 두 함수가 continuous한 경우나 discrete한 경우 모두 사용할 수 있다. continuous한 경우에는 CDF(cumulative distribution function)을 사용하고, discrete한 경우에는 EDF(Empirical distribution function)을 사용한다.
CDF(Cumulative Distribution Function)
CDF는 한 probability distribution의 누적값이다. 어떤 PDF을 $(-\infty, x]$까지 integrate한 함수로 생각해도 된다.
위 사진은 왼쪽에 standard normal distribution의 PDF가, 오른쪽엔 CDF가 놓여져 있어 비교하며 확인할 수 있다.
EDF(Empirical Distribution Function)
EDF는 CDF와 비슷한데, $n$개의 discrete한 간격을 두고 구한 누적값이다. 간격에서만 값이 더해지므로, step function의 모양을 가진다.
위 figure은 EDF의 특징을 잘 보여주고 있다.
Kormogorov-Smirnov statistic
이와 같은 경우 reference function의 CDF를 $F(x)$라고 하고, observed data의 $n$까지의 EDF를 $F_n (x)$라고 하면, Kolmogorov-Smirnov statistic은 다음과 같다.
$$ D_n = \sup_x | F_n(x) - F(x) | $$
sup는 x까지 가능한 모든 distance 값 중 absolute값의 maximum으로 생각하면 된다.
위 그림의 쌍방향 화살표가 supremum값이다.
만약 D값이 critical value보다 크다면, null hypothesis는 reject된다. 이 때 critical value는 보통 value table을 보고 찾을 수 있다.
References
- "Kolmogorov–Smirnov test", Wikipedia, Last modified Jan 11. 2022, accessed Feb 22, 2022. https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test
- "Kolmogorov-Smirnov Goodness of Fit Test", Statistics How to, accessed Feb 22. 2022, https://www.statisticshowto.com/kolmogorov-smirnov-test/
- "6 ways to test for a Normal Distribution — which one to use?", toward data science, last modified Dec 13. 2019, accessed Feb 22, 2022. https://towardsdatascience.com/6-ways-to-test-for-a-normal-distribution-which-one-to-use-9dcf47d8fa93
Footnotes
'Mathematics > Statistics' 카테고리의 다른 글
Transformation of Random Variables (0) | 2024.04.16 |
---|---|
적률생성함수(Moment Generating Function, MGF) (0) | 2021.06.16 |