cv (x, is.sample = TRUE, coefnorm = FALSE, weighting = NULL,
wmean = FALSE, na.rm = FALSE)
numeric
vector
is.sample = TRUE
, so the denominator of variance is \(n-1\))
coefnorm = FALSE
)
numeric
vector containing weighting data to compute the weighted coefficient of variation (instead of the non-weighted cv)
coefnorm = FALSE
the function returns the non-standardized cv (\(0 < v < \infty\)). If coefnorm = TRUE
the standardized cv (\(0 < v* < 1\)) is returned.x
is automatically treated as a sample (such as in the base sd
function), so the denominator of variance is \(n-1\), if it is not, set is.sample = FALSE
.gini
, herf
, hoover
, rca
# Regional disparities / sigma convergence in Germany
data(gdppc)
# GDP per capita for German counties (Landkreise)
cvs <- apply (gdppc[3:17], MARGIN = 2, FUN = cv)
# Calculating cv for the years 2000-2014
years <- 2000:2014
plot(years, cvs, "l", ylim=c(0.3,0.6), xlab = "year",
ylab = "CV of GDP per capita")
# Plot cv over time
Run the code above in your browser using DataLab