goftest-package {goftest} | R Documentation |
Classical Goodness-of-Fit Tests
Description
Cramer-von Mises and Anderson-Darling tests of goodness-of-fit for continuous univariate distributions, using modern algorithms to compute the null distributions.
Details
The goftest package contains implementations of the classical Cramer-von Mises and Anderson-Darling tests of goodness-of-fit for continuous univariate distributions.
The Cramer-von Mises test
is performed by cvm.test
. The cumulative distribution
function of the null distribution of the test statistic
is computed by pCvM
using the algorithm of Csorgo
and Faraway (1996). The quantiles are computed by qCvM
by root-finding.
The Anderson-Darling test is performed by
ad.test
. The cumulative distribution
function of the null distribution of the test statistic
is computed by pAD
using the algorithm of Marsaglia and Marsaglia (2004).
The quantiles are computed by qAD
by root-finding.
By default, each test assumes that the parameters of the null
distribution are known (a simple null hypothesis).
If the parameters were estimated (calculated from the data)
then the user should set estimated=TRUE
which uses
the method of Braun (1980) to adjust for the effect of
estimating the parameters from the data.
Author(s)
Adrian Baddeley, Julian Faraway, John Marsaglia, George Marsaglia.
Maintainer: Adrian Baddeley <adrian.baddeley@uwa.edu.au>
References
Braun, H. (1980) A simple method for testing goodness-of-fit in the presence of nuisance parameters. Journal of the Royal Statistical Society 42, 53–63.
Csorgo, S. and Faraway, J.J. (1996) The exact and asymptotic distributions of Cramer-von Mises statistics. Journal of the Royal Statistical Society, Series B 58, 221–234.
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
Examples
x <- rnorm(30, mean=2, sd=1)
# default behaviour: parameters fixed: simple null hypothesis
cvm.test(x, "pnorm", mean=2, sd=1)
ad.test(x, "pnorm", mean=2, sd=1)
# parameters estimated: composite null hypothesis
mu <- mean(x)
sigma <- sd(x)
cvm.test(x, "pnorm", mean=mu, sd=sigma, estimated=TRUE)
ad.test(x, "pnorm", mean=mu, sd=sigma, estimated=TRUE)