View source: R/test_statistics.R
calc_ks_test_stat | R Documentation |
The purpose of this function is to allow the KS test statistic to be calculated for a wide range of distributions, i.e. to abstract the calculation of the test statistic from the CDF (p) function. This requires the estimated parameters to be specified as a single object.
calc_ks_test_stat(x, params, fn_p)
x |
The data. |
params |
The parameters of the distribution, generally estimated from the data, as a single object. |
fn_p |
The cumulative distribution function of the distribution, in the form of a function that takes the data and estimated parameters as a single object, and returns cumulative probability values. |
The KS test statistic.
Other Test statistic functions:
calc_ad_test_stat()
set.seed(1)
x <- rnorm(100)
params <- list(mean = mean(x), sd = sd(x))
calc_ks_test_stat(x, params, function(x, params) pnorm(x, params$mean, params$sd))
stats::ks.test(x, "pnorm", mean(x), sd(x))$statistic
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.