cvm.test: Discrete Cramer-von Mises Goodness-of-Fit Tests

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

View source: R/cvm.test.R

Description

Computes the test statistics for doing one-sample Cramer-von Mises goodness-of-fit tests and calculates asymptotic p-values.

Usage

1
cvm.test(x, y, type = c("W2", "U2", "A2"))

Arguments

x

a numerical vector of data values.

y

an ecdf or step-function (stepfun) for specifying the hypothesized model.

type

the variant of the Cramer-von Mises test; "W2" is the default and most common method, "U2" is for cyclical data, and "A2" is the Anderson-Darling alternative. For details see references.

Details

Details here.

Value

An object of class htest.

Note

Additional notes?

Author(s)

Taylor B. Arnold and John W. Emerson

Maintainer: Taylor B. Arnold <taylor.arnold@yale.edu>

References

V. Choulakian, R. A. Lockhart, and M. A. Stephens (1994). Cramer-von Mises statistics for discrete distributions. The Canadian Journal of Statistics, 22(1): 125-137.

H. Cramer (1928). On the composition of elementary errors. Skand. Akt., 11:141-180.

M. A. Stephens (1974). Edf statistics for goodness of fit and some comparisons. Journal of the American Statistical Association, 69(347): 730-737.

R. E. von Mises (1928). Wahrscheinlichkeit, Statistik und Wahrheit. Julius Springer, Vienna, Austria.

See Also

ks.test, ecdf, stepfun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
x3 <- sample(1:10, 25, replace=TRUE)

# Using ecdf() to specify a discrete distribution:
if (require(ks.test, quietly=TRUE)) {
  ks.test(x3, ecdf(1:10))
} else {
  cat(paste("See package ks.test for a revised ks.test()",
            "handling discrete distributions.\n"))
}
cvm.test(x3, ecdf(1:10))

# Using step() to specify the same discrete distribution:
myfun <- stepfun(1:10, cumsum(c(0, rep(0.1, 10))))
if (require(ks.test, quietly=TRUE)) ks.test(x3, myfun)
cvm.test(x3, myfun)

# Usage of U2 for cyclical distributions (note U2 unchanged, but W2 not)

set.seed(1)
y <- sample(1:4, 20, replace=TRUE)
cvm.test(y, ecdf(1:4), type='W2')
cvm.test(y, ecdf(1:4), type='U2')
z <- y
cvm.test(z, ecdf(1:4), type='W2')
cvm.test(z, ecdf(1:4), type = 'U2')

cvm.test documentation built on May 2, 2019, 4:58 p.m.

Related to cvm.test in cvm.test...