ADTest: Anderson-Darling Test

View source: R/normal_Tests.R

ADTestR Documentation

Anderson-Darling Test

Description

This function computes the one-sample Anderson-Darling test statistic and p-value for fit to a normal distribution.

Usage

ADTest(data, alpha = 0.05, j = 1)

Arguments

data

Data of a univariate distribution for which the test statistic is computed (vector)

alpha

The significance threshold for the upper-tail test

j

The # hypotheses tested; used to compute a Bonferonni correction, if applicable; should remain at its default if multiple testing is not an issue (scalar)

Details

An adjusted statistic provided by D'agostino & Stephens (1986) is used, where the mean and variance of the population are treated as unknown. D'agostino & Stephen's (1986) text provides the equations used to obtain the function's p-values.

The modified statistic follows Table 4.7, Case 3, and the p-value follows Table 4.9. Log-CDF and log-survival probabilities are evaluated directly. Standardization uses centered, scaled coordinates. Constant observations, fewer than two non-missing observations, or infinite observations terminate testing with an error. Missing values (NA and NaN) are omitted before calculating the statistic, preserving the existing behavior. This computational requirement does not establish small-sample calibration.

At the approximation breakpoints, 0.20 uses the first formula, 0.34 uses the second, and 0.60 uses the fourth. The statistic and p-value are rounded to three decimals; significance uses the unrounded p-value and alpha / j. The legacy final polynomial remains unchanged pending a separate tail-policy decision. Extrapolation to extreme statistics can yield invalid p-values, including values above one; the returned p-value and significance flag must not be interpreted as calibrated inference in that regime.

Value

An object including the test statistic, p-value, and a significance flag (list)

Precision metadata

Successful computed results also carry a rita_test attribute with the unrounded statistic and p.value, n_tested, precision, calibration and details. It records existing computations without rerunning the test. Legacy list elements, warning behavior and decisions are unchanged. Unsupported or undefined results retain their existing sentinel/NA representation and may lack this attribute. See rita_analysis for reporting conventions.

References

D'agostino, R. B., & Stephens, M. A. (1986). Goodness-of-fit-techniques (Vol. 68). CRC press.

Examples

values <- rnorm(100)
x <- ADTest(data = values)

Rita documentation built on Nov. 14, 2026, 1:07 a.m.

Related to ADTest in Rita...