calc_ad_test_stat: Calculate the AD test statistic of data against a fitted...

View source: R/test_statistics.R

calc_ad_test_statR Documentation

Calculate the AD test statistic of data against a fitted distribution

Description

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.

Usage

calc_ad_test_stat(x, params, fn_p)

Arguments

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.

Value

The AD test statistic.

See Also

Other Test statistic functions: calc_ks_test_stat()

Examples

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

PaulMTeggin/practechniques documentation built on Aug. 19, 2023, 4:44 p.m.