DescTools (version 0.99.36)

CoefVar: Coefficient of Variation

Description

Calculates the coefficient of variation and its confidence limits using the noncentral t-distribution..

Usage

CoefVar(x, ...)

# S3 method for lm CoefVar(x, unbiased = FALSE, conf.level = NA, na.rm = FALSE, ...)

# S3 method for aov CoefVar(x, unbiased = FALSE, conf.level = NA, na.rm = FALSE, ...)

# S3 method for default CoefVar(x, weights = NULL, unbiased = FALSE, conf.level = NA, na.rm = FALSE, ...)

Arguments

x

a (non-empty) numeric vector of data values.

weights

a numerical vector of weights the same length as x giving the weights to use for elements of x.

unbiased

logical value determining, if a bias correction should be used (see. details). Default is FALSE.

conf.level

confidence level of the interval.

na.rm

logical. Should missing values be removed? Defaults to FALSE.

further arguments (not used here).

Value

if no confidence intervals are requested: the estimate as numeric value (without any name) else a named numeric vector with 3 elements

est

estimate

lwr.ci

lower confidence interval

upr.ci

upper confidence interval

Details

In order for the coefficient of variation to be an unbiased estimate of the true population value, the coefficient of variation is corrected as: $$ CV_{korr} = CV \cdot \left( 1 - \frac{1}{4\cdot(n-1)} + \frac{1}{n} \cdot CV^2 + \frac{1}{2 \cdot (n-1)^2} \right) $$

References

Johnson, B. L., Welch, B. L. (1940). Applications of the non-central t-distribution. Biometrika, 31, 362--389.

Kelley, K. (2007). Sample size planning for the coefcient of variation from the accuracy in parameter estimation approach. Behavior Research Methods, 39 (4), 755-766

Kelley, K. (2007). Constructing confidence intervals for standardized effect sizes: Theory, application, and implementation. Journal of Statistical Software, 20 (8), 1-24

McKay, A. T. (1932). Distribution of the coefficient of variation and the extended t distribution, Journal of the Royal Statistical Society, 95, 695--698.

Smithson, M.J. (2003) Confidence Intervals, Quantitative Applications in the Social Sciences Series, No. 140. Thousand Oaks, CA: Sage. pp. 39-41

See Also

Mean, SD, (both supporting weights)

Examples

Run this code
# NOT RUN {
set.seed(15)
x <- runif(100)
CoefVar(x, conf.level=0.95)

#       est    low.ci    upr.ci
# 0.5092566 0.4351644 0.6151409

# Coefficient of variation for a linear model
r.lm <- lm(Fertility ~ ., swiss)
CoefVar(r.lm)
# }

Run the code above in your browser using DataCamp Workspace