pAD: Null Distribution of Anderson-Darling Test Statistic

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/andarl.R

Description

pAD computes the cumulative distribution function, and qAD computes the quantile function, of the null distribution of the Anderson-Darling test statistic.

Usage

1
2
  pAD(q, n = Inf, lower.tail = TRUE, fast=TRUE)
  qAD(p, n = Inf, lower.tail = TRUE, fast=TRUE)

Arguments

q

Numeric vector of quantiles (values for which the cumulative probability is required).

p

Numeric vector of probabilities.

n

Integer. Sample size for the Anderson-Darling test.

lower.tail

Logical. If TRUE (the default), probabilities are P(X <= q), and otherwise they are P(X > q).

fast

Logical value indicating whether to use a fast algorithm or a slower, more accurate algorithm, in the case n=Inf.

Details

pAD uses the algorithms and C code described in Marsaglia and Marsaglia (2004).

qAD uses uniroot to find the quantiles.

The argument fast applies only when n=Inf and determines whether the asymptotic distribution is approximated using the faster algorithm adinf (accurate to 4-5 places) or the slower algorithm ADinf (accurate to 11 places) described in Marsaglia and Marsaglia (2004).

Value

A numeric vector of the same length as p or q.

Author(s)

Original C code by G. and J. Marsaglia. R interface by Adrian Baddeley.

References

Anderson, T.W. and Darling, D.A. (1952) Asymptotic theory of certain 'goodness-of-fit' criteria based on stochastic processes. Annals of Mathematical Statistics 23, 193–212.

Anderson, T.W. and Darling, D.A. (1954) A test of goodness of fit. Journal of the American Statistical Association 49, 765–769.

Marsaglia, G. and Marsaglia, J. (2004) Evaluating the Anderson-Darling Distribution. Journal of Statistical Software 9 (2), 1–5. February 2004. doi: 10.18637/jss.v009.i02

See Also

ad.test

Examples

1
2
3
4
5
6
  pAD(1.1, n=5)
  pAD(1.1)
  pAD(1.1, fast=FALSE)

  qAD(0.5, n=5)
  qAD(0.5)

Example output

[1] 0.6945818
[1] 0.6911871
[1] 0.6912038
[1] 0.7640094
[1] 0.7742347

goftest documentation built on Oct. 7, 2021, 5:07 p.m.