Sample Coefficient of Variation.
Compute the sample coefficient of variation.
cv(x, method = "moments", sd.method = "sqrt.unbiased", l.moment.method = "unbiased", plot.pos.cons = c(a = 0.35, b = 0), na.rm = FALSE)
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
L-moments 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, 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} ∑_{i=1}^n x_i \;\;\;\;\;\; (3)
s = [\frac{1}{n-1} ∑_{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)
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:
τ = \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.
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 L-moments and the L-CV. Vogel and Fennessey (1993) argue that L-moment ratios should replace product moment ratios because of their superior performance (they are nearly unbiased and better for discriminating between distributions).
Steven P. Millard (EnvStats@ProbStatInfo.com)
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. Prentice-Hall, Upper Saddle River, NJ.
# 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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.