Learn R Programming

Renext (version 3.0-0)

CV2.test: CV2 test of exponentiality

Description

Test of exponentiality based on the squared coefficient of variation.

Usage

CV2.test(x, method = c("num", "sim", "asymp"), nSamp = 15000)

Arguments

x
Numeric vector giving the sample.
method
Method used to compute the $p$-value. Can be "asymp", "num" or "sim" as in LRExp.test.
nSamp
Number of samples used to compute the $p$-value when method is "sim".

Value

  • A list of test results.
  • statistic, p.valueThe test statistic, i.e. the squared coefficient of variation $\textrm{CV}^2$ and the $p$-value.
  • dfThe sample size.
  • methodDescription of the test method.

Details

The distribution of $\textrm{CV}^2$ is that of Greenwood's statistic up to normalising constants. It approximately normal with expectation $1$ and standard deviation $2/\sqrt{n}$ for a large sample size n. Yet the convergence to the normal is known to be very slow.

References

S. Ascher (1990) "A Survey of Tests for Exponentiality" Commun. Statist. Theory Methods, 19(5), pp. 1811-1525.

See Also

The function CV2 that computes the statistic and LRExp.test or Jackson.test for functions implementing comparable tests or exponentiality with the same arguments.

Examples

Run this code
n <- 30; nSamp <- 500
X <- matrix(rexp(n * nSamp), nrow = nSamp, ncol = n)
pVals <- apply(X, 1, function(x) CV2.test(x)$p.value)
plot(pVals)  ## should be uniform on (0, 1)

Run the code above in your browser using DataLab