Given two random variables $S$ and $W$, I'm trying to determine the variance of the weighted average

$$Z = \frac{\sum_{i=1}^n s_i w_i}{\sum_{i=1}^n w_i}$$

(With the same $w_i$ in denominator as in the numerator)

It seems $E[Z] = E[S]$, but what would be an estimate of the variance?

If the denominator term wasn't there could simply use the Variance of a Product [link]


2 Answers 2


Use the law of total variance:

$var(Z) = var_w[E[Z|W]) + E_w[var(Z|W)]$

Let's calculate the two intermediate values first:

1. $$ E[Z|W] = \frac{\sum_i E[s_i]w_i}{\sum_i w_i} = E[S]$$ which does not depend on w, thus $var_w[E[Z|W]] = 0$


if we assume independence of $s_i$'s

$$var(Z|W) = \frac{var(\sum_i w_i s_i)}{(\sum_i w_i)^2}$$

$$ = \frac{\sum_i w_i^2}{(\sum_i w_i)^2} var(S)$$

thus $E_w[var(Z|W)] = E[\frac{\sum_i w_i^2}{(\sum_i w_i)^2}]var(S)$

It seems the $E[\frac{\sum_i w_i^2}{(\sum_i w_i)^2}]$ part cannot be further simplified unless the distribution of $w_i$'s are given.

  • 1
    $\begingroup$ +1, nice and easy derivation. Also, the expectation involving $W$ can be easily approximated numerically if you can sample from the density of $W$ directly or using MCMC techniques $\endgroup$
    – Jeremias K
    Dec 17, 2017 at 12:29

Without independence between $S$ and $W$, $E[Z] \ne E[S]$ in general. This is because $$E[Z|W]=\Sigma_i \frac{w_i}{\Sigma_j w_j}E[s_i|W].$$ Hence, without knowing the conditional distribution of $s_i$ given $W$, we don't know whether $E[s_i|W]$ is the same across all $i$.


Your Answer

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

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