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 --
On Fri, 17 Nov 2006, jacinthe at gmx.de wrote:> 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) > }Not from a version of R from at least the last 3 years!> 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.Use pkstwo from a current version of R, which has PACKAGE = "stats". -- 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
Thank you for your quick help. Regards Jaci -------- Original-Nachricht -------- Datum: Fri, 17 Nov 2006 13:15:13 +0000 (GMT) Von: Prof Brian Ripley <ripley at stats.ox.ac.uk> An: jacinthe at gmx.de Betreff: Re: [R] Kolmogorov Smirnov Distribution> On Fri, 17 Nov 2006, jacinthe at gmx.de wrote: > > > 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) > > } > > Not from a version of R from at least the last 3 years! > > > 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. > > Use pkstwo from a current version of R, which has PACKAGE = "stats". > > -- > 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 > > ______________________________________________ > R-help at stat.math.ethz.ch 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.--