Description Details Author(s) References See Also Examples
Cramer-von Mises and Anderson-Darling tests of goodness-of-fit for continuous univariate distributions, using modern algorithms to compute the null distributions.
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.
Adrian Baddeley, Julian Faraway, John Marsaglia, George Marsaglia.
Maintainer: Adrian Baddeley <adrian.baddeley@uwa.edu.au>
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
1 2 3 4 5 6 7 8 9 | 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)
|
Cramer-von Mises test of goodness-of-fit
Null hypothesis: Normal distribution
with parameters mean = 2, sd = 1
Parameters assumed to be fixed
data: x
omega2 = 0.053987, p-value = 0.8554
Anderson-Darling test of goodness-of-fit
Null hypothesis: Normal distribution
with parameters mean = 2, sd = 1
Parameters assumed to be fixed
data: x
An = 0.48004, p-value = 0.7659
Cramer-von Mises test of goodness-of-fit
Braun's adjustment using 5 groups
Null hypothesis: Normal distribution
with parameters mean = 2.03155070193341, sd = 1.10347239112013
Parameters assumed to have been estimated from data
data: x
omega2max = 0.47388, p-value = 0.1969
Anderson-Darling test of goodness-of-fit
Braun's adjustment using 5 groups
Null hypothesis: Normal distribution
with parameters mean = 2.03155070193341, sd = 1.10347239112013
Parameters assumed to have been estimated from data
data: x
Anmax = 1.3268, p-value = 0.7171
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.