# Coefficient of Quartile Variation

Coefficient of quartile variation ($$CQV$$) is a measure of relative dispersion that is based on interquartile range (IQR). Since cqv is unitless, it is useful for comparison of variables with different units. It is also a measure of homogeneity (Altunkaynak & Gamgam, 2018; Bonett, 2006).
The population coefficient of quartile variation is:
$CQV = \biggl(\frac{Q_3-Q_1}{Q_3+Q_1}\biggr)\times100$ where $$q_3$$ and $$q_1$$ are the population third quartile (i.e., $$75^{th}$$ percentile) and first quartile (i.e., $$25^{th}$$ percentile), respectively. Almost always, we analyze data from samples but want to generalize it as the population’s parameter (Albatineh, Kibria, Wilcox, & Zogheib, 2014). Its sample’s estimate is given as:
$cqv = \biggl(\frac{q_3-q_1}{q_3+q_1}\biggr)\times100$ There are different methods for the calculation of confidence intervals (CI) for CQV. All of them are fruitful and have particular use cases. For sake of versatility, we cover almost all of these methods in cvcqv package. Here, we explain them along with some examples:

### Bonett Confidence Interval

Bonett (Bonett, 2006) introduced the following confidence interval for CQV:
$\exp\{\ln{(D/S)c\ \pm\ Z_{1-\alpha/2}\sqrt{v} }\}$ where $$c = n/(n-1)$$ is a centering adjustment which helps to equalize the tail error probabilities (Altunkaynak & Gamgam, 2018; Bonett, 2006). $$D = \hat{Q3}-\hat{Q1}$$ and $$S = \hat{Q3}+\hat{Q1}$$ are the sample $$25^{th}$$ and $$75^{th}$$ percentiles, respectively; $$Z_{1-\alpha/2}$$ is the $$1-\alpha/2$$ quantile of the standard normal distribution. Computation of $$v$$ which is $$Var\{\ln{(D/S)}\}$$ is long and a bit complicated, but has been implemented for cqv function:

x <- c(
0.2, 0.5, 1.1, 1.4, 1.8, 2.3, 2.5, 2.7, 3.5, 4.4,
4.6, 5.4, 5.4, 5.7, 5.8, 5.9, 6.0, 6.6, 7.1, 7.9
)
cqv_versatile(
x,
na.rm = TRUE,
digits = 3,
method = "bonett"
)
## $method ## [1] "cqv with Bonett 95% CI" ## ##$statistics
##      est  lower  upper
##   45.625 24.785 77.329

### Bootstrap Confidence Intervals

Thanks to package boot (Canty & Ripley, 2017) we can obtain bootstrap CI around $$cqv$$:

cqv_versatile(
x,
na.rm = TRUE,
digits = 3,
method = "bca"
)
## $method ## [1] "cqv with adjusted bootstrap percentile (BCa) 95% CI" ## ##$statistics
##      est  lower  upper
##   45.625 21.527 79.698

### All Available Methods

In conclusion, we can observe CIs calculated by all available methods:

cqv_versatile(
x,
na.rm = TRUE,
digits = 3,
method = "all"
)
## $method ## [1] "All methods" ## ##$statistics
##            est  lower  upper
## bonett  45.625 24.785 77.329
## norm    45.625 19.410 70.462
## basic   45.625 19.398 73.303
## percent 45.625 17.947 71.852
## bca     45.625 25.532 83.405
##                                                 description
## bonett                               cqv with Bonett 95% CI
## norm                   cqv with normal approximation 95% CI
## basic                       cqv with basic bootstrap 95% CI
## percent                cqv with bootstrap percentile 95% CI
## bca     cqv with adjusted bootstrap percentile (BCa) 95% CI

# References

Albatineh, A. N., Kibria, B. M., Wilcox, M. L., & Zogheib, B. (2014). Confidence interval estimation for the population coefficient of variation using ranked set sampling: A simulation study. Journal of Applied Statistics, 41(4), 733–751. https://doi.org/10.1080/02664763.2013.847405

Altunkaynak, B., & Gamgam, H. (2018). Bootstrap confidence intervals for the coefficient of quartile variation. Communications in Statistics: Simulation and Computation, 0(0), 1–9. https://doi.org/10.1080/03610918.2018.1435800

Bonett, D. G. (2006). Confidence interval for a coefficient of quartile variation. Computational Statistics and Data Analysis, 50(11), 2953–2957. https://doi.org/10.1016/j.csda.2005.05.007

Canty, A., & Ripley, B. (2017). boot: Bootstrap R (S-Plus) Functions. R package version 1.3-20.