rcv.test: Hypothesis Tests and Confidence Intervals for the Robust...

rcv.testR Documentation

Hypothesis Tests and Confidence Intervals for the Robust Coefficient of Variation

Description

carry out hypothesis tests and obtain associated confidence intervals for robust versions of the coefficient of variation

Usage

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,
  ...
)

Arguments

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 "mad" or "iqr".

quantile.type

argument for the quantile function. Default is 8 so that output is consistent with the default quantile function use and with other functions such as IQR (see ?quantile for details).

var.method

method used to estimate the quantile density function when numerator = "iqr". Either "qor" (default) or "density".

alternative

a character string specifying the alternative hypothesis; must be one of "two.sided" (default), "less", or "greater".

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 TRUE, the test and interval are computed on the log scale.

back.transf

logical; if TRUE, estimates and confidence intervals are back-transformed to the original rCV scale using exp.

...

additional arguments to be passed to density when numerator = "mad" and to q.test when numerator = "iqr".

Details

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

Value

an object of class "htest" containing the test result, estimate, null value, p-value, and confidence interval.

References

Arachchige, C. N. P. G., & Prendergast, L. A. (2022). Robust analogs to the coefficient of variation. Journal of Applied Statistics, 49(2), 268–290.

See Also

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.

Examples

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")

rquest documentation built on Aug. 28, 2026, 9:06 a.m.