Learn R Programming

lmomco (version 2.3.1)

cvm.test.lmomco: Cram<U+00E9>r--von Mises Test for Goodness-of-Fit

Description

The Cram<U+00E9>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<U+00F6>rg<U+0151> 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, ...)

Arguments

x

A vector of data values.

para1

The parameters of the distribution.

...

Additional arguments to pass to par2cdf.

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”.

Details

The above definition for \(\omega^2\) as the Cram<U+00E9>r--von Mises test statistic is consistent with the notation in Cs<U+00F6>rg<U+0151> 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<U+00E9>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<U+00F6>rg<U+0151>, S., and Faraway, J.J., 1996, The exact and asymptotic distributions of Cram<U+00E9>r--von Mises statistics: Journal of the Royal Statistical Society, Series B, v. 58, pp. 221--234.

See Also

lmrdia

Examples

Run this code
# NOT RUN {
# 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