Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

goftest-package

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. http://www.jstatsoft.org/v09/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)

goftest

Classical Goodness-of-Fit Tests for Univariate Distributions

v1.2-2
GPL (>= 2)
Authors
Julian Faraway [aut], George Marsaglia [aut], John Marsaglia [aut], Adrian Baddeley [aut, cre]
Initial release
2019-11-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.