[R] Confidence Band for empirical distribution function
Hotz, T.
th50 at leicester.ac.uk
Tue Jul 22 12:37:39 CEST 2003
Dear Leif,
If you look at the definition of ks.test, you'll find the lines
pkstwo <- function(x, tol = 1e-06) {
if (is.numeric(x))
x <- as.vector(x)
else stop("Argument x must be numeric")
p <- rep(0, length(x))
p[is.na(x)] <- NA
IND <- which(!is.na(x) & (x > 0))
if (length(IND) > 0) {
p[IND] <- .C("pkstwo", as.integer(length(x)), p = as.double(x[IND]),
as.double(tol), PACKAGE = "ctest")$p
}
return(p)
}
which calls C code to calculate the p-values given the test statistic.
You'll find explanations on what this function does in the original C file
src/library/ctest/src/ks.c
I haven't tried that but I assume that you could use it to calculate p-values
given the test-statistics yourself.
Please also note that ks.test() returns the p-value as well.
If you need quantiles, I assume you need to invert the cdf yourself,
e.g. using uniroot().
HTH
Thomas
---
Thomas Hotz
Research Associate in Medical Statistics
University of Leicester
United Kingdom
Department of Epidemiology and Public Health
22-28 Princess Road West
Leicester
LE1 6TP
Tel +44 116 252-5410
Fax +44 116 252-5423
Division of Medicine for the Elderly
Department of Medicine
The Glenfield Hospital
Leicester
LE3 9QP
Tel +44 116 256-3643
Fax +44 116 232-2976
> -----Original Message-----
> From: Leif.Boysen [mailto:boysen at math.uni-goettingen.de]
> Sent: 21 July 2003 14:42
> To: r-help at stat.math.ethz.ch
> Subject: [R] Confidence Band for empirical distribution function
>
>
> Hi,
>
> I was trying to draw an empirical distribution function with uniform
> confidence bands. So I tried to find a way to calculate values of the
> Kolmogorov-Smirnov Distribution but failed.
> I guess it must be hidden somewhere (since the ks-test is
> implemented),
> but I was unable to find it.
>
> Is there any way to do this?
>
> Thanks
>
> Leif Boysen
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list