CV | R Documentation |
The functions compute coefficient of variation (CV) as well as two robust versions of the CV.
CV(x, na.rm = FALSE) medCV(x, na.rm = FALSE, constant = 1/qnorm(0.75)) iqrCV(x, na.rm = FALSE, type = 7, constant = 2*qnorm(0.75))
x |
numeric vector with positive numbers. |
na.rm |
logical. Should missing values be removed? |
type |
an integer between 1 and 9 selecting one of nine quantile
algorithms; for more details see |
constant |
standardizing contant; see |
The functions compute the (classical) CV as well as two robust variants.
medCV
uses the (standardized) MAD instead of SD and median instead of mean.
iqrCV
uses the (standardized) IQR instead of SD and median instead of mean.
CV value.
Matthias Kohl Matthias.Kohl@stamats.de
C.N.P.G. Arachchige, L.A. Prendergast and R.G. Staudte. Robust analogues to the Coefficient of Variation. https://arxiv.org/abs/1907.01110.
## 5% outliers out <- rbinom(100, prob = 0.05, size = 1) sum(out) x <- (1-out)*rnorm(100, mean = 10, sd = 2) + out*25 CV(x) medCV(x) iqrCV(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.