I am looking at the function ks.test in the stats package and trying to figure out why it gives a different result for a p-value than does the corresponding function in MATLAB. I am hoping for one of two responses: 1. You know about ks.tests and have a familiarity with both the R and MATLAB algorithms and can tell me why this should be happening. 2. You know where I can find the C code so that I can decipher it. Thanks, -Steve Wolf [[alternative HTML version deleted]]
Peter Langfelder
2011-Jun-24 00:36 UTC
[R] packages which call functions which run C code...
On Thu, Jun 23, 2011 at 4:46 PM, Steven Wolf <wolfste4 at msu.edu> wrote:> I am looking at the function ks.test in the stats package and trying to > figure out why it gives a different result for a p-value than does the > corresponding function in MATLAB. ?I am hoping for one of two responses: > > > > 1. ? ? ? You know about ks.tests and have a familiarity with both the R and > MATLAB algorithms and can tell me why this should be happening. > > 2. ? ? ? You know where I can find the C code so that I can decipher it.You can download the source R bundle (a .tar.gz or tar.bz, for example http://cran.stat.ucla.edu/src/base/R-2/R-2.13.0.tar.gz), unpack it, then navigate to the R source directory, go to subdirectory src/library/stats/src and look at the file ks.c. The R function ks.test is defined in src/library/stats/R/ks.test.R. HTH, Peter
On 2011-06-23 16:46, Steven Wolf wrote:> I am looking at the function ks.test in the stats package and trying to > figure out why it gives a different result for a p-value than does the > corresponding function in MATLAB. I am hoping for one of two responses: > > > > 1. You know about ks.tests and have a familiarity with both the R and > MATLAB algorithms and can tell me why this should be happening. > > 2. You know where I can find the C code so that I can decipher it. > >Go to https://svn.r-project.org/R/trunk/src/library/stats/R/ks.test.R for the code of ks.test() and to https://svn.r-project.org/R/trunk/src/library/stats/src/ks.c for the relevant C code. Or download the source code from your favourite CRAN mirror. Peter Ehlers> > Thanks, > > -Steve Wolf > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.