Skip to main content

The coefficient of variation for each subgroup must be normalized with the grand mean rather than the subgroup means. However, the sum of within- and between-group CV are still only approximately the total CV.

When taking the squared coefficient of variation, i.e. $CV^{2}=\sum_{i=1}^{I}\frac{1}{n_{i}}\frac{Var(Y_{i})}{Mean(Y_{i})^2}$, the within- and between-group components equal exactly the total squared coefficient of variation.

Here is some R code showing this result:

# Create data
set.seed(1)
n <- 1000000
y1 <- rnorm(n, 10, 10)
y2 <- rnorm(n, 1000, 5)
y3 <- rnorm(n, 30, 1)
y <- c(y1, y2, y3)

# Variance
var_w <- 1/3*var(y1)+1/3*var(y2)+1/3*var(y3)
var_b <- 1/3*(mean(y1)-mean(y))^2+1/3*(mean(y2)-mean(y))^2+1/3*(mean(y3)-mean(y))^2
var_w+var_b # 213538
var(y)      # 213538

# Coefficient of variation
cv_y1 <- sqrt(var(y1))/mean(y)
cv_y2 <- sqrt(var(y2))/mean(y)
cv_y3 <- sqrt(var(y3))/mean(y)

cv_w <- 1/3 *cv_y1 + 1/3*cv_y2 + 1/3 * cv_y3
cv_b <- sqrt(var_b)/mean(y)

cv_w+cv_b            # 1.35
sqrt(var(y))/mean(y) # 1.33

# Squared coefficient of variation 

cv2_y1 <- var(y1)/mean(y)^2
cv2_y2 <- var(y2)/mean(y)^2
cv2_y3 <- var(y3)/mean(y)^2

cv2_w <- 1/3 *cv2_y1 + 1/3*cv2_y2 + 1/3 * cv2_y3
cv2_b <- var_b/mean(y)^2

cv2_w+cv2_b      # 1.78
var(y)/mean(y)^2 # 1.78
Ben
  • 215
  • 1
  • 9