# Thread: Variance calc with weighted coefficients

1. ## Variance calc with weighted coefficients

I want to understand the calculation of the variance of a sum of rvs where each variable is weighted using a constant coefficient. I post the full question and answer here and I highlight the areas that I am struggling to follow.

Question.

$Y_1,... Y_n$ is a sample from a population with mean $\mu$ and variance $\sigma$.

The sample is not random, $Cov(Y_i,Y_j)={\rho}\sigma^2$ for $i\neq{j}$. Let $U=\Sigma_{i=1}^na_iY_i$.

(a) Give the condition on a constants $a_1,...a_n$ for U to be unbiased estimator of $\mu$.
(b) Under this condition, calculate MSE(U).

(a) is not a problem, just need to calculate a if $E(U)=\mu$ which gives

$E(U)=\Sigma_{i=1}^na_iE(Y_i)=\mu\Sigma_{i=1}^na_i$ and $\Sigma_{i=1}^na_i=1$ is the condition.

(b) given (a) is met, then MSE(U)=Var(U):

$Var(U)=Var(\Sigma_{i=1}^na_iY_i)=E[\Sigma_{i=1}^na_i(Y_i-\mu)\Sigma_{j=1}^na_j(Y_j-\mu)]$ (1)

and starting from (2) I find it tricky to follow the solution:

$=\Sigma_{i=1}^n\Sigma_{j=1}^na_ia_jCov(Y_i, Y_j)$ (2)

$=\Sigma_{i=1}^na_i^2Var(Y_i)+\Sigma_{j=1}^n\Sigma_ {i\neq{j}}Cov(Y_i, Y_j)$ (3)

It looks to me like a sum of all entries of the variance matrix of an nx1 vector... but I cannot yet move beyond that.

Then it gets OK again, a straightforward substitution

$=\sigma^2\Sigma_{i=1}^na_i^2+\rho\sigma^2\Sigma_{j =1}^n\Sigma_{i\neq{j}a_ia_j}$ (4).

I'd appreciate a bit of clarification on manipulations in (2) and (3)...

2. I'm confused as to the covariance of Y's being $\sigma^2$
that means the correlation is 1.
The variance is just $\sigma^2\sum_{i=1}^n\sum_{j=1}^n a_ia_j$

3. Originally Posted by matheagle
I'm confused as to the covariance of Y's being $\sigma^2$
that means the correlation is 1.
I misspelt rho as ro! Latext didn't recognise it. Sorry! I edited. It's $\rho\sigma^2$

4. I've just realised I messed up the final answer too, it should read:

$\sigma^2\Sigma_{i=1}^na_i^2+\rho\sigma^2\Sigma_{j\ neq{i}}a_ia_j$

Anyways, I had a bright idea to look up "variance of a sum of correlated variables" and I've figure it out

$Var(\Sigma_{i=1}^na_iY_i)=\Sigma_{i=1}^n\Sigma_{j= 1}^nCov(a_iY_i,a_jY_j)$ (per Wiki),

which also includes $Var(a_iY_i)=Cov(a_iY_i,a_iY_i)$ when i=j:

$=\Sigma_{i=1}^nVar(a_iY_i)+\Sigma_{i=1}^n\Sigma_{j \neq{i}}Cov(a_iY_i,a_iY_i)$

$=\Sigma_{i=1}^na_i^2Var(Y_i)+\Sigma_{i=1}^n\Sigma_ {j\neq{i}}a_ia_jCov(Y_i,Y_i)$ (we can take constants outside)

$=\Sigma_{i=1}^na_i^2\sigma^2+\Sigma_{i=1}^n\Sigma_ {j\neq{i}}a_ia_j\rho\sigma^2$ (substibute info given in the question)

Finally, taking common factors outside the summation sign

$=\sigma^2\Sigma_{i=1}^na_i^2+\rho\sigma^2\Sigma_{i =1}^n\Sigma_{j\neq{i}}a_ia_j$ as per the final book answer.

Strange though that I didn't use the fact that from (a) that $\Sigma_{i=1}^na_i=1$

5. Originally Posted by Volga
Strange though that I didn't use the fact that from (a) that $\Sigma_{i=1}^na_i=1$
If $\sum a_i \ne 1$ then you would have to tack on the square of the bias, so you are using it implicitly when you jump straight into calculating the variance.