Performs the Anderson-Darling test of goodness-of-fit to a specified continuous univariate probability distribution.
AndersonDarlingTest(x, null = "punif", ..., nullname)
numeric vector of data values.
a function, or a character string giving the name of a function, to compute the cumulative distribution function for the null distribution.
additional arguments for the cumulative distribution function.
optional character string describing the null distribution.
The default is "uniform distribution"
.
An object of class "htest"
representing the result of
the hypothesis test.
This command performs the Anderson-Darling test
of goodness-of-fit to the distribution specified by the argument
null
. It is assumed that the values in x
are
independent and identically distributed random values, with some
cumulative distribution function \(F\).
The null hypothesis is that \(F\) is the function
specified by the argument null
, while the alternative
hypothesis is that \(F\) is some other function.
The procedures currently implemented are for the case of a SIMPLE null hypothesis, that is, where all the parameters of the distribution are known. Note that other packages such as 'normtest' support the test of a COMPOSITE null hypothesis where some or all of the parameters are unknown leading to different results concerning the test statistic and the p-value. Thus in 'normtest' you can test whether the data come from a normal distribution with some mean and variance (which will be estimated from the same data).
The discrepancies can be large if you don't have a lot of data (say less than 1000 observations).
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. https://www.jstatsoft.org/v09/i02
shapiro.test
and all other tests for normality.
# NOT RUN {
x <- rnorm(10, mean=2, sd=1)
AndersonDarlingTest(x, "pnorm", mean=2, sd=1)
# }
Run the code above in your browser using DataLab