| rcv.test | R Documentation |
carry out hypothesis tests and obtain associated confidence intervals for robust versions of the coefficient of variation
rcv.test(
x,
y = NULL,
numerator = "mad",
quantile.type = 8,
var.method = "qor",
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
true.rcv = 0,
log.transf = TRUE,
back.transf = TRUE,
...
)
x |
a numeric vector of data values. |
y |
an optional second numeric vector of data values for two-sample testing. |
numerator |
a character string specifying the numerator used in the robust coefficient of variation. Must be either |
quantile.type |
argument for the quantile function. Default is |
var.method |
method used to estimate the quantile density function when |
alternative |
a character string specifying the alternative hypothesis; must be one of |
conf.level |
coverage level for the confidence interval. |
true.rcv |
the hypothesized value of the robust coefficient of variation, or of the difference/ratio in the two-sample case, depending on the transformation used. |
log.transf |
logical; if |
back.transf |
logical; if |
... |
additional arguments to be passed to |
This function performs hypothesis tests and constructs confidence intervals for robust versions of the coefficient of variation (rCV). It can be used for either one-sample or two-sample inference.
The type of robust coefficient of variation is determined by the argument numerator. Two choices are available (Arachchige & Prendergast, 2022):
"mad": based on the median absolute deviation (MAD). This is the default and most widely used choice.
"iqr": based on the interquartile range (IQR).
Let m denote the sample median. Then the MAD-based robust coefficient of variation is
\widehat{\mathrm{rCV}} = 1.4826 \times \frac{\mathrm{MAD}}{m}.
The multiplier 1.4826 makes the estimator comparable to the usual coefficient of variation under a Gaussian model.
If the IQR is preferred, then
\widehat{\mathrm{rCV}} = 0.75 \times \frac{\mathrm{IQR}}{m}.
The multiplier 0.75 is the corresponding scaling constant for the IQR-based version.
For numerator = "mad", Wald-type confidence intervals are computed using an asymptotic variance estimate for the rCV. The default is to perform the calculations on the log scale (log.transf = TRUE) and then, when back.transf = TRUE, exponentiate the estimate and interval endpoints back to the original rCV scale.
For numerator = "iqr", the rCV is treated as a ratio of linear combinations of quantiles and the function q.test is used to carry out the hypothesis test and compute the associated interval estimate. In this case, var.method controls how the quantile density is estimated.
Additional arguments in ... are passed to density when numerator = "mad" and to q.test when numerator = "iqr".
an object of class "htest" containing the test result, estimate, null value, p-value, and confidence interval.
Arachchige, C. N. P. G., & Prendergast, L. A. (2022). Robust analogs to the coefficient of variation. Journal of Applied Statistics, 49(2), 268–290.
qcov for covariance estimation of sample quantiles,
qrcov for covariance estimation of ratios of linear combinations of quantiles, and
q.test for hypothesis tests and confidence intervals based on ratios of linear combinations of quantiles.
set.seed(123)
x1 <- rnorm(100, 8)
x2 <- rnorm(120, 10)
# One-sample tests
rcv.test(x1)
rcv.test(x1, numerator = "iqr")
# Two-sample tests
rcv.test(x1, x2)
rcv.test(x1, x2, numerator = "iqr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.