You are on page 1of 1

Kolmogorov-Smirnov Test in R (With Examples) Hypothesis Used – H0(Null Hypothesis):

 KS is a non-parametric test to determine whether a  The null hypothesis supposes that the
sample comes from a specific distribution and tells us numbers are evenly spaced between 0 and 1.
if the continuous and discontinuous components are If we successfully disprove the null
identical, comparing the probability test with sample hypothesis, the numbers are not randomly
reference. distributed between 0 and 1. Numbers do not
 Typically, it is employed to verify the consistency of necessarily follow a uniform distribution if the
random integers. One of the most crucial null hypothesis is not rejected.
characteristics of any random number generator is Pros and cons of the K-S test:
uniformity, which can be tested using the
Strengths:
Kolmogorov-Smirnov test.
 The cumulative distribution function of the reference  It is also possible to determine whether two
distribution and the empirical distributions of the underlying one-dimensional probability
two samples are measured using the K-S Test. distributions differ using the Kolmogorov-
Smirnov test.
K-S Test Formula
 It is a highly effective method for determining
whether two samples differ significantly.
 It is also essential to check the normality.
Supx: The greatest in the group of distances
Fn(x): Empiric distribution function for n id Limitations:
observations Xi
 It applies only to continuous distributions.
Implementation of KS test using “ks. test ()”
 Compared to the nails, it is typically more
ks. text (x, y, …, alternative = c(“two. sided”, “less”,
“greater”), exact= NULL, tol= 1e-8, sensitive close to the distribution center.
simulate.p.value = FALSE, B=2000)  The simulation determines it.

Output:
data: x and x2 References:
D^- = 0.34, p-value = 0.003089 https://www.youtube.com/watch?
alternative hypothesis: the CDF of x lies below that of y
v=MEcAn5yzTwA

Graph: https://www.geeksforgeeks.org/kolmogorov-
smirnov-test-ks-test/?ref=rp

Sdsd s

#Source: https://tinyurl.com/2p97242c

You might also like