Learn R Programming

lmomco (version 2.4.14)

cvm.test.lmomco: Cramér--von Mises Test for Goodness-of-Fit

Description

The Cramér--von Mises test for goodness-of-fit is implemented for the order statistics \(x_{1:n} \le x_{i:n} \le x_{n:n}\) of a sample of size \(n\). Define the test statistic (Csörgő and Faraway, 1996) as $$\omega^2 = \frac{1}{12n} + \sum_{i=1}^n \biggl[\frac{2i-1}{2n} - F_\theta(x_i)\biggr]\mbox{,}$$ where \(F_\theta(x)\) is the cumulative distribution function (continuous) for some distribution having parameters \(\theta\). If the value for \(\omega^2\) is larger than some critical value, reject the null hypothesis. The null hypothesis is that \(F\) is the function specified by \(\theta\), while the alternative hypothesis is that \(F\) is some other function.

Usage

cvm.test.lmomco(x, para1, ...)

Value

An R

list is returned.

null.dist

The null distribution, which is an echoing of the para argument, which recall for lmomco that is contains the distribution abbreviation.

text

The string “Cramer--von Mises test of goodness-of-fit”.

statistic

The \(\omega^2\) as defined above (see Note).

p.value

The p-value computed from the pCvM() function from the goftest package for the null distribution of the test statistic.

source

An attribute identifying the computational source of the L-moments:
“cvm.test.lmomco”.

Arguments

x

A vector of data values.

para1

The parameters of the distribution.

...

Additional arguments to pass to par2cdf.

Author

W.H. Asquith

Details

The above definition for \(\omega^2\) as the Cramér--von Mises test statistic is consistent with the notation in Csörgő and Faraway (1996) as well as that in package goftest. Depending on how the null distribution is defined by other authors and attendant notation, the Cramér--von Mises statistic can be branded as \(T = n\omega^2\). The null distribution herein requires just \(\omega^2\) and the sample size is delivered separately into the cumulative distribution function:


  goftest::pCvM(omega.sq, n=n, lower.tail=FALSE)

References

Csörgő, S., and Faraway, J.J., 1996, The exact and asymptotic distributions of Cramér--von Mises statistics: Journal of the Royal Statistical Society, Series B, v. 58, pp. 221--234.

See Also

lmrdia

Examples

Run this code
# An example in which the test is conducted on a sample but the parent is known.
# This will lead to more precise inference than if the sample parameters are used.
mu <- 120; sd <- 25; para <- vec2par(c(120, 25), type="nor")
x <- rnorm(56, mean=mu, sd=sd)
T1 <- cvm.test.lmomco(x, para)$statistic
T2 <- goftest::cvm.test(x, null="pnorm", mean=mu, sd=sd)$statistic
message("Cramer--von Mises: T1=", round(T1, digits=6), " and T2=", round(T2, digits=6))

Run the code above in your browser using DataLab