ad.test: Anderson-Darling Normality Test

View source: R/gmeans.R

ad.testR Documentation

Anderson-Darling Normality Test

Description

Perform the Anderson-Darling normality test.

Usage

ad.test(x)

Arguments

x

(numeric())
Vector of data values. Missing values are allowed, but the number of non-missing values must be greater than 7.

Details

The Anderson-Darling test is an EDF omnibus test for the composite hypothesis of normality. The test statistic is

A^2 = -n -\frac{1}{n} \sum_{i=1}^{n} (2i - 1) [\ln(z_{i}) + \ln(1 - z_{n + 1 - i})]

where z_{i} = \Phi(\frac{x_{i} - \bar{x}}{s}). Here, \Phi is the cumulative distribution function of the standard normal distribution, and \bar{x} and s are mean and standard deviation of the data values. The p-value is computed from the modified statistic A^2_*=A^2 (1.0 + 0.75/n + 2.25/n^{2}) according to Table 4.9 in Stephens (1986).

Value

A list inheriting from classes "htest" containing the following components:

  • statistic: the value of the statistic.

  • p.value: the p-value of the test.

  • method: the character string "Anderson-Darling normality test".

  • data.name: a character string giving the name(s) of the data.

Source

Adapted from nortest::ad.test()

References

Stephens, A. M (1986). “Goodness-of-Fit-Techniques.” In D'Agostino, B. R (eds.), chapter Tests based on EDF statistics. CRC Press.

Thode, C. H (2002). Testing for normality, 1 edition. CRC Press. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/9780203910894")}.

See Also

stats::shapiro.test() for performing the Shapiro-Wilk test for normality. nortest::cvm.test(), nortest::lillie.test(), nortest::pearson.test(), nortest::sf.test() for performing further tests for normality. stats::qqnorm() for producing a normal quantile-quantile plot.

Examples

set.seed(123)
ad.test(rnorm(100, mean = 5, sd = 3))
ad.test(runif(100, min = 2, max = 4))

gmeans documentation built on Sept. 12, 2026, 1:06 a.m.