View source: R/test_statistics.R
calc_ad_test_stat | R Documentation |
The purpose of this function is to allow the AD 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_ad_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 AD test statistic.
Other Test statistic functions:
calc_ks_test_stat()
set.seed(1)
x <- rnorm(100)
params <- list(mean = mean(x), sd = sd(x))
calc_ad_test_stat(x, params, function(x, params) pnorm(x, params$mean, params$sd))
if (require(ADGofTest)) ADGofTest::ad.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.