[R] KS test and theoretical distribution
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Oct 6 17:18:05 CEST 2011
On Thu, 6 Oct 2011, francogrex wrote:
>> x <- runif(100)
>> y <- runif(100)
>> ks.test(x,y)
>
> Two-sample Kolmogorov-Smirnov test
>
> data: x and y
> D = 0.11, p-value = 0.5806
> alternative hypothesis: two-sided
>
> ok I expected that, but:
>
>> ks.test(runif(100), "runif")
>
> One-sample Kolmogorov-Smirnov test
>
> data: runif(100)
> D = 0.9106, p-value < 2.2e-16
> alternative hypothesis: two-sided
>
> How come?
Pilot error. The help says
y: either a numeric vector of data values, or a character string
naming a cumulative distribution function or an actual
cumulative distribution function such as ‘pnorm’. Only
continuous CDFs are valid.
"runif" is not 'an actual cumulative distribution function' ....
>
> --
> View this message in context: http://r.789695.n4.nabble.com/KS-test-and-theoretical-distribution-tp3878640p3878640.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list