Define KolmogorovSmirnov Two Sample test and PermutationSolu
Define Kolmogorov-Smirnov Two- Sample test and Permutation.
Solution
The Kolmogorov-Smirnov test is such a test.
It tests
H0:The distributions are the same
H1:The distributions are not the same
Suppose we have two samples, X1,...,Xm and Y1,...,Yn.
Denote F1(x) the cumulative distribution function (CDF) for the distribution of the first population
and F2(y) the CDF for the second.
Next, denote F1^ the sample CDF for the first treatment
and F2^ be the sample CDF for the second treatment.
The Kolmogorov-Smirnov statistic, denotes KS
KS=maxw|F1^(w)F2^(w)|.
OR
Dn=supsup1jk|i=1j(fexp,(i)fobs,(i))|
where is a permutation of the order of the categories, f.,i are the observed and expected frequencies in category i. This can be written equivalently as:
Dn=12i=1|fexp,ifobs,i|
I would like to extend this to a two-sample case using a randomising/permutation procedure, such:
D(r)n=12i=1|f(r)group1,if(r)group2,i|,r=1,…,R
where .(r) denotes a statistic calculated based on the rth permutation of the categorical variable.
Reject if the value of the original statistic is larger than the value of 95% of the permuted statistics.
