# 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.

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

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

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

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

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

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

$\displaystyle 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:

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

$\displaystyle =\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

$\displaystyle =\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 $\displaystyle \sigma^2$
that means the correlation is 1.
The variance is just $\displaystyle \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 $\displaystyle \sigma^2$
that means the correlation is 1.
I misspelt rho as ro! Latext didn't recognise it. Sorry! I edited. It's $\displaystyle \rho\sigma^2$

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

$\displaystyle \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

$\displaystyle 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 $\displaystyle Var(a_iY_i)=Cov(a_iY_i,a_iY_i)$ when i=j:

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

$\displaystyle =\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)

$\displaystyle =\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

$\displaystyle =\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 $\displaystyle \Sigma_{i=1}^na_i=1$

5. Originally Posted by Volga
Strange though that I didn't use the fact that from (a) that $\displaystyle \Sigma_{i=1}^na_i=1$
If $\displaystyle \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.