Last chance! 50% off unlimited learning
Sale ends in
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)
numeric vector of observations.
character string specifying what method to use to compute the sample coefficient
of variation. The possible values are "moments"
(product moment ratio estimator; the default), or "l.moments"
(L-moment ratio estimator).
character string specifying what method to use to compute the sample standard
deviation when method="moments"
. The possible values are
"sqrt.ubiased"
(the square root of the unbiased estimate of variance;
the default), or "moments"
(the method of moments estimator).
character string specifying what method to use to compute the
method="l.moments"
. The possible values are
"ubiased"
(method based on the "plotting.position"
(method based on the plotting position formula).
numeric vector of length 2 specifying the constants used in the formula for
the plotting positions when method="l.moments"
and
l.moment.method="plotting.position"
. The default value is
plot.pos.cons=c(a=0.35, b=0)
. If this vector has a names attribute
with the value c("a","b")
or c("b","a")
, then the elements will
be matched by name in the formula for computing the plotting positions.
Otherwise, the first element is mapped to the name "a"
and the second
element to the name "b"
.
logical scalar indicating whether to remove missing values from x
.
If
na.rm=FALSE
(the default) and x
contains missing values,
then a missing value (NA
) is returned. If na.rm=TRUE
,
missing values are removed from x
prior to computing the coefficient
of variation.
A numeric scalar -- the sample coefficient of variation.
Let
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:
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:
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:
L-Moment Coefficient of Variation (method="l.moments"
)
Hosking (1990) defines an
When l.moment.method="unbiased"
, the
When l.moment.method="plotting.position"
, the
See the help file for lMoment
for more information on
estimating
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).
Zar, J.H. (2010). Biostatistical Analysis. Fifth Edition. Prentice-Hall, Upper Saddle River, NJ.
Summary Statistics, summaryFull
, var
,
sd
, skewness
, kurtosis
.
# NOT RUN {
# 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