Description Usage Arguments Details Value Note Author(s) References See Also Examples
Compute the sample coefficient of variation.
1 2 3 
x 
numeric vector of observations. 
method 
character string specifying what method to use to compute the sample coefficient
of variation. The possible values are 
sd.method 
character string specifying what method to use to compute the sample standard
deviation when 
l.moment.method 
character string specifying what method to use to compute the
Lmoments when 
plot.pos.cons 
numeric vector of length 2 specifying the constants used in the formula for
the plotting positions when 
na.rm 
logical scalar indicating whether to remove missing values from 
Let \underline{x} denote a random sample of n observations from some distribution with mean μ and standard deviation σ.
Product Moment Coefficient of Variation (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{σ}{μ} \;\;\;\;\;\; (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, rightskewed 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} ∑_{i=1}^n x_i \;\;\;\;\;\; (3)
s = [\frac{1}{n1} ∑_{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} ∑_{i=1}^n (x_i  \bar{x})^2]^{1/2} \;\;\;\;\;\; (6)
LMoment Coefficient of Variation (method="l.moments"
)
Hosking (1990) defines an Lmoment analog of the
coefficient of variation (denoted the LCV) as:
τ = \frac{l_2}{l_1} \;\;\;\;\;\; (7)
that is, the second Lmoment divided by the first Lmoment. He shows that for a positivevalued random variable, the LCV lies in the interval (0, 1).
When l.moment.method="unbiased"
, the LCV is estimated by:
t = \frac{l_2}{l_1} \;\;\;\;\;\; (8)
that is, the unbiased estimator of the second Lmoment divided by the unbiased estimator of the first Lmoment.
When l.moment.method="plotting.position"
, the LCV is estimated by:
\tilde{t} = \frac{\tilde{l_2}}{\tilde{l_1}} \;\;\;\;\;\; (9)
that is, the plottingposition estimator of the second Lmoment divided by the plottingposition estimator of the first Lmoment.
See the help file for lMoment
for more information on
estimating Lmoments.
A numeric scalar – the sample coefficient of variation.
Traditionally, the coefficient of variation has been estimated using product moment estimators. Hosking (1990) introduced the idea of Lmoments and the LCV. Vogel and Fennessey (1993) argue that Lmoment ratios should replace product moment ratios because of their superior performance (they are nearly unbiased and better for discriminating between distributions).
Steven P. Millard ([email protected])
Berthouex, P.M., and L.C. Brown. (2002). Statistics for Environmental Engineers, Second Edition. Lewis Publishers, Boca Raton, FL.
Gilbert, R.O. (1987). Statistical Methods for Environmental Pollution Monitoring. Van Nostrand Reinhold, NY.
Ott, W.R. (1995). Environmental Statistics and Data Analysis. Lewis Publishers, Boca Raton, FL.
Taylor, J.K. (1990). Statistical Techniques for Data Analysis. Lewis Publishers, Boca Raton, FL.
Vogel, R.M., and N.M. Fennessey. (1993). L Moment Diagrams Should Replace Product Moment Diagrams. Water Resources Research 29(6), 1745–1752.
Zar, J.H. (2010). Biostatistical Analysis. Fifth Edition. PrenticeHall, Upper Saddle River, NJ.
Summary Statistics, summaryFull
, var
,
sd
, skewness
, kurtosis
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  # 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)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.