Ksgeneral
Computing (complementary)cdf for one-sample Kolmogorov-Smirnov statistic when the underlying distribution is purely discrete, mixed, or continuous
Install / Use
/learn @raymondtsr/KsgeneralREADME
KSgeneral
Computes a p-value of the one-sample two-sided (or one-sided, as a special case) Kolmogorov-Smirnov (KS) statistic, for any fixed critical level, and an arbitrary, possibly large sample size for a pre-specified purely discrete, mixed or continuous cumulative distribution function (cdf) under the null hypothesis.
If a data sample is supplied, 'KSgeneral' (also available from https://CRAN.R-project.org/package=KSgeneral) computes the p-value corresponding to the value of the KS test statistic computed based on the user provided data sample.
The package 'KSgeneral' implements a novel, accurate and efficient method named Exact-KS-FFT, developed by Dimitrova, Kaishev, Tan (2017), available together with the underlying C++ code from http://openaccess.city.ac.uk/18541.
To cite this package in publication use: Dimitrina S. Dimitrova, Vladimir K. Kaishev, and Senren Tan. Computing the Kolmogorov-Smirnov Distribution When the Underlying CDF is Purely Discrete, Mixed, or Continuous. Journal of Statistical Software. 2020, 95(10): 1–42. doi:10.18637/jss.v095.i10, which is available from https://www.jstatsoft.org/article/view/v095i10.
The p-value is expressed as a double-boundary non-crossing probability for a homogeneous Poisson process, which is then efficiently computed using Fast Fourier Transform (FFT).
The package can also be used to compute and plot the complementary cdf of the KS statistic which is known to depend on the hypothesized distribution when the latter is discontinuous (i.e. purely discrete or mixed).
Installation
In order to build the KSgeneral package from source, a C++ compiler is required.
The latter is contained in the Windows Rtools, available from https://cran.r-project.org/bin/windows/Rtools/, or under MacOS in Xcode, downloadable from the App Store.
The package KSgeneral uses Rcpp in R, and utilizes the C++ code that efficiently computes the complementary cdf using the Exact-KS-FFT method developed by Dimitrova, Kaishev, Tan (2017), available together with the underlying C++ code from http://openaccess.city.ac.uk/18541.
Since the latter requires computation of Fast Fourier Transform (FFT), the FFTW3 library developed by Matteo Frigo and Steven G.Johnson needs to be installed from http://www.fftw.org/index.html.
It should be noted that the Rtools and FFTW3 should be installed in the system PATH.
For Windows users, The FFTW3 library (static library, with a ".a" extension) for Windows (32-bit or 64-bit) can be found in the local323.zip file, available from http://www.stats.ox.ac.uk/pub/Rtools/libs.html.
For Mac or Unix users, it is straightforward to install the FFTW3 library from the command line, following the instructions from http://www.fftw.org/index.html.
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
