Search code examples
rkolmogorov-smirnov

How to do Kolmogorov 2 sample test in r?


How to do Kolmogorov-Smirnov two-sample test in R? Which packages to use? I searched on the web and then found **ks2Test ** to use to do 2 sample test. But I couldnot find the packages for it. I used package

dgof 

and

 fHTEST 

but still not working. Can anyone please help ?

Thanks in advance

> ?ks2.test No documentation for ‘ks2.test’ in specified packages and libraries: you could try ‘??ks2.test’ and when I use

ks2.test 

it says no result found.

Can anyone please help me?


Solution

  • The function ks.test is in the stats package (no need to load it).

    x <- rnorm(50)
    y <- runif(30)
    # Do x and y come from the same distribution?
    ks.test(x, y)