[R] Kolmogorov Smirnov Distribution

jacinthe at gmx.de jacinthe at gmx.de
Fri Nov 17 12:48:27 CET 2006


Hi,

i need to calculate the p-value given the kolmogorv smirnov test statistic (two sided). When I look at the function ks.test I found the following function which calls C code:

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)
}


Extracting and using this function, I get the following error message:

Error in .C("pkstwo", as.integer(length(x)), p = as.double(x[IND]), as.double(tol),  : 
        C entry point "pkstwo" not in DLL for package "ctest"



Any suggestions (perhaps a small example) how to calculate the p-value for the KS-statistic (without using ks.test()!!!). Help is welcome.

Regards
Jaci


--



More information about the R-help mailing list