Why different methods yield different results for covariance calculation?

64 Views Asked by At

Let $A=B+C$, with B and C independent.

$\mathbf E[B]=m$, $\textrm{var}(B)=v$,

$\mathbf E[C]=0$, $\textrm{var}(C)=h$.

$\mathbf E[A]=\mathbf E[B+C]=\mathbf E[B]+\mathbf E[C] = m$

$\textrm{var}(A)=\textrm{var}(B+C)=\textrm{var}(B)+\textrm{var}(C)=v+h$.

I have trouble calculating $\textrm{cov}(B,A)$ using two different methods. Can someone tell me what went wrong?


Method 1:

$\textrm{cov}(B,A) = \mathbf E[BA] - \mathbf E[B]\mathbf E[A]$

$= \mathbf E[B(B+C)] - \mathbf E[B]\mathbf E[B+C]$

$= \mathbf E[B^2] + \mathbf E[BC] - (\mathbf E[B])^2 -\mathbf E[BC]\Leftarrow\textrm{problem here}$

$= \mathbf E[B^2] - (\mathbf E[B])^2$

$=\textrm{var}(B)=v$.


Method 2:

$\textrm{cov}(B,A) = \mathbf E[BA] - \mathbf E[B]\mathbf E[A]$

$= \mathbf E[(A-C)A] - \mathbf E[A-C]\mathbf E[A]$

$= \mathbf E[A^2] - \mathbf E[AC] - (\mathbf E[A])^2 + \mathbf E[AC]\Leftarrow\textrm{problem here}$

$= \mathbf E[A^2] - (\mathbf E[A])^2$

$=\textrm{var}(A)=v+h$.


Correction from Ian and drhab's inputs.

Problem step 1:

$= \mathbf E[B^2] + \mathbf E[BC] - (\mathbf E[B])^2 - \mathbf E[B]\mathbf E[C]$

$= \mathbf E[B^2] + \mathbf E[BC] - (\mathbf E[B])^2 - \mathbf E[BC]$

Can simplify as $B$ and $C$ are independent.


Problem step 2:

$= \mathbf E[A^2] - \mathbf E[AC] - (\mathbf E[A])^2 +\mathbf E[A]\mathbf E[C]$

Cannot simplify as $A$ and $C$ are not independent.

2

There are 2 best solutions below

2
On BEST ANSWER

In the third line of method 1 I read $\mathbb EBC$ as last term while it actually should be $\mathbb EB\mathbb EC$.

This is wrong but harmless because $B$ and $C$ are independent.

In the third line of method 2 I read $\mathbb EAC$ as last term while it actually should be $\mathbb EC\mathbb EA$.

Again it is wrong but this time not harmless because $A$ and $C$ are not independent.


It is more handsome to make use of bilinearity of covariance which leads to:$$\mathsf{Cov}\left(B,A\right)=\mathsf{Cov}\left(B,B+C\right)=\mathsf{Cov}\left(B,B\right)+\mathsf{Cov}\left(B,C\right)=\mathsf{Var}B+0=\mathsf{Var}B$$where the third equality is based on independence.

2
On

In method 1 you have $E[B]E[C]$ from the last term and you skipped the step of using independence of $B$ and $C$ to write this as $E[BC]$. In method 2 you have $E[A]E[C]$ from the last term and you skipped the corresponding step again, but this time the step is not valid since $A$ and $C$ are not independent.