cv(x, method = "moments", sd.method = "sqrt.unbiased",
l.moment.method = "unbiased", plot.pos.cons = c(a = 0.35, b = 0),
na.rm = FALSE)
"moments"
(product moment ratio estimator; the default), or "l.moments"
(L-moment ratio estimatormethod="moments"
. The possible values are
"sqrt.ubiased"
(the square root of the unbiased estimate of variance;
the defaultmethod="l.moments"
. The possible values are
"ubiased"
(method based on the $U$-statistic; the default), or
"plotting.position"
method="l.moments"
and
l.moment.method="plotting.position"
. The default value is
plot.pos.cons=c(a=0.35, b
x
.
If na.rm=FALSE
(the default) and x
contains missing values,
then a missing value (NA
) is returned. If na.rm=TRUE
,method="moments"
)
The coefficient of variation (sometimes denoted CV) of a distribution is
defined as the ratio of the standard deviation to the mean. That is:
$$CV = \frac{\sigma}{\mu} \;\;\;\;\;\; (1)$$
The coefficient of variation measures how spread out the distribution is
relative to the size of the mean. It is usually used to characterize positive,
right-skewed distributions such as the lognormal distribution.
When sd.method="sqrt.unbiased"
, the coefficient of variation is estimated
using the sample mean and the square root of the unbaised estimator of variance:
$$\widehat{CV} = \frac{s}{\bar{x}} \;\;\;\;\;\; (2)$$
where
$$\bar{x} = \frac{1}{n} \sum_{i=1}^n x_i \;\;\;\;\;\; (3)$$
$$s = [\frac{1}{n-1} \sum_{i=1}^n (x_i - \bar{x})^2]^{1/2} \;\;\;\;\;\; (4)$$
Note that the estimator of standard deviation in equation (4) is not unbiased.
When sd.method="moments"
, the coefficient of variation is estimated using
the sample mean and the square root of the method of moments estimator of variance:
$$\widehat{CV} = \frac{s_m}{\bar{x}} \;\;\;\;\;\; (5)$$
$$s = [\frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2]^{1/2} \;\;\;\;\;\; (6)$$
L-Moment Coefficient of Variation (method="l.moments"
)
Hosking (1990) defines an $L$-moment analog of the
coefficient of variation (denoted the $L$-CV) as:
$$\tau = \frac{l_2}{l_1} \;\;\;\;\;\; (7)$$
that is, the second $L$-moment divided by the first $L$-moment.
He shows that for a positive-valued random variable, the $L$-CV lies in the
interval (0, 1).
When l.moment.method="unbiased"
, the $L$-CV is estimated by:
$$t = \frac{l_2}{l_1} \;\;\;\;\;\; (8)$$
that is, the unbiased estimator of the second $L$-moment divided by
the unbiased estimator of the first $L$-moment.
When l.moment.method="plotting.position"
, the $L$-CV is estimated by:
$$\tilde{t} = \frac{\tilde{l_2}}{\tilde{l_1}} \;\;\;\;\;\; (9)$$
that is, the plotting-position estimator of the second $L$-moment divided by
the plotting-position estimator of the first $L$-moment.
See the help file for lMoment
for more information on
estimating $L$-moments.summaryFull
, var
,
sd
, skewness
, kurtosis
.# Generate 20 observations from a lognormal distribution with
# parameters mean=10 and cv=1, and estimate the coefficient of variation.
# (Note: the call to set.seed simply allows you to reproduce this example.)
set.seed(250)
dat <- rlnormAlt(20, mean = 10, cv = 1)
cv(dat)
#[1] 0.5077981
cv(dat, sd.method = "moments")
#[1] 0.4949403
cv(dat, method = "l.moments")
#[1] 0.2804148
#----------
# Clean up
rm(dat)
Run the code above in your browser using DataLab