1
$\begingroup$

I know that the variance can be decomposed into within- and between-group components.

Let $Y$ be a vector and $Y_{i}$ and be a subgroup of $Y$ and we have $I$ subgroups, then

$Var_{T}(Y)=Var_{W}(Y)+Var_{B}(Y)$ with

$Var_{W}=\sum_{i=1}^{I}\frac{1}{n_{i}}*Var(Y_{i})$ and $Var_{B}=\sum_{i=1}^{I}\frac{1}{n_{i}}(Mean(Y_{i})-Mean(Y))^{2}$, where $n_{i}$ is the size of group $i$.

According to Cowell (2011: 74) "Measuring inequality", the coefficient of variation can likewise be decomposed into within- and between-group components.

However, when I decompose the CV like this:

$CV_{W}=\sum_{i=1}^{I}\frac{1}{n_{i}}*\frac{\sqrt{Var(Y_{i})}}{Mean(Y_{i})}$ and $CV_{B}=\sum_{i=1}^{I}\frac{1}{n_{i}}\frac{\sqrt{(Mean(Y_{i})-Mean(Y))^{2}}}{Mean(Y)}$,

the sum of within- and between-group CV is not exactly the total coefficient of variation.

Here some R code to replicate the problem:

# Create data (three groups)
set.seed(1)
n <- 10000
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 <- 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(y1)
cv_y2 <- sqrt(var(y2))/mean(y2)
cv_y3 <- sqrt(var(y3))/mean(y3)

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.69
sqrt(var(y))/mean(y) # 1.33

The two values are close enough (also true for different distributions of Y) to make me think that there might be a simple correction factor.

How can I decompose the coefficient of variation into within- and between-group components?

$\endgroup$
3
  • 2
    $\begingroup$ What do you do when one or more groups have means near $0$? This possibility suggests that Cowell must have had some very special circumstances in mind and, quite likely, was only making an approximation anyway. $\endgroup$
    – whuber
    Commented Nov 17, 2020 at 17:19
  • $\begingroup$ @whuber That's one disadvantage of the coefficient of variation but should not affect the decomposition as far as I can see $\endgroup$
    – Ben
    Commented Nov 17, 2020 at 17:25
  • 2
    $\begingroup$ The problem is that a true additive decomposition is impossible when one of the components is likely to (far) exceed the total. $\endgroup$
    – whuber
    Commented Nov 17, 2020 at 17:38

1 Answer 1

2
$\begingroup$

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
$\endgroup$
1
  • $\begingroup$ Here is a Python gist going over equivalent calculations (with different RNG). $\endgroup$
    – Galen
    Commented Oct 28, 2022 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.