[R] ks.test or other Kolmogorov-Smirnov code
William Dunlap
wdunlap at tibco.com
Mon Sep 30 21:35:45 CEST 2013
> If the ecdf is to be read as y=Pr(x<x_i), for each x_i , well at which x_i
> does D occur?
The definition is Pr(x <= x_i), but that doesn't matter much here.
You know the maximum occurs at one of the points in union(x, y) so
you can find it by comparing the ecdf's at each of those points:
f <- function(x, y) {
xy <- union(x, y)
d <- abs(ecdf(x)(xy) - ecdf(y)(xy))
xy[ d == max(d) ]
}
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of sitterlyb
> Sent: Monday, September 30, 2013 10:39 AM
> To: r-help at r-project.org
> Subject: [R] ks.test or other Kolmogorov-Smirnov code
>
> Can any of the tools available provide where the supremum happens?
>
> So classically D = sup|F1 - F2| or something to that affect, and then we use
> D to figure out significance.
>
> If the ecdf is to be read as y=Pr(x<x_i), for each x_i , well at which x_i
> does D occur?
>
> Sorry for the repetition just trying to give all the context of what I'm
> asking.
>
> Thanks in advance.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/ks-test-or-other-
> Kolmogorov-Smirnov-code-tp4677290.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.
More information about the R-help
mailing list