40
$\begingroup$

What is the formula for variance of product of dependent variables?

In the case of independent variables the formula is simple:

$$ {\rm var}(XY) = E(X^{2}Y^{2}) - E(XY)^{2} = {\rm var}(X){\rm var}(Y) + {\rm var}(X)E(Y)^2 + {\rm var}(Y)E(X)^2 $$ But what is the formula for correlated variables?

By the way, how can I find the correlation based on the statistical data?

$\endgroup$
38
$\begingroup$

Well, using the familiar identity you pointed out,

$$ {\rm var}(XY) = E(X^{2}Y^{2}) - E(XY)^{2} $$

Using the analogous formula for covariance,

$$ E(X^{2}Y^{2}) = {\rm cov}(X^{2}, Y^{2}) + E(X^2)E(Y^2) $$

and

$$ E(XY)^{2} = [ {\rm cov}(X,Y) + E(X)E(Y) ]^{2} $$

which implies that, in general, ${\rm var}(XY)$ can be written as

$$ {\rm cov}(X^{2}, Y^{2}) + [{\rm var}(X) + E(X)^2] \cdot[{\rm var}(Y) + E(Y)^2] - [ {\rm cov}(X,Y) + E(X)E(Y) ]^{2} $$

Note that in the independence case, ${\rm cov}(X^2,Y^2) = {\rm cov}(X,Y) = 0$ and this reduces to

$$ [{\rm var}(X) + E(X)^2] \cdot[{\rm var}(Y) + E(Y)^2] - [ E(X)E(Y) ]^{2} $$

and the two $[ E(X)E(Y) ]^{2}$ terms cancel out and you get

$$ {\rm var}(X){\rm var}(Y) + {\rm var}(X)E(Y)^{2} + {\rm var}(Y)E(X)^{2} $$

as you pointed out above.

Edit: If all you observe is $XY$ and not $X$ and $Y$ separately, then I don't think there is a way for you to estimate ${\rm cov}(X,Y)$ or ${\rm cov}(X^2,Y^2)$ except in special cases (for example, if $X,Y$ have means that are known a priori)

$\endgroup$
3
  • 2
    $\begingroup$ why do you put [var(X)+E(X)2]⋅[var(Y)+E(Y)2] instead of E(X2)E(Y2)??? $\endgroup$
    – user35458
    Nov 28 '13 at 19:53
  • 1
    $\begingroup$ @user35458, so he can end up with the equation as an expression of var(X) and var(Y), thus comparable to OP's statement. Notice that E(X ^ 2) = Var(X) + E(X) ^ 2. $\endgroup$ Mar 13 '16 at 12:49
  • 3
    $\begingroup$ In order to respond (offline) to a now-deleted challenge to the validity of this answer, I compared its results to direct calculation of the variance of the product in many simulations. It's not a practical formula to use if you can avoid it, because it can lose substantial precision through cancellation in subtracting one large term from another--but that's not the point. One pitfall to beware is that this question concerns random variables. Its results apply to data provided you compute variances and covariances using denominators of $n$ rather than $n-1$ (as is usual for software). $\endgroup$
    – whuber
    Oct 24 '17 at 16:12
18
$\begingroup$

This is an addendum to @Macro's very nice answer which lays out exactly what needs to known in order to determine the variance of the product of two correlated random variables. Since \begin{align} \operatorname{var}(XY) &= E\left[(XY)^2\right] - \left(E[XY]\right)^2 \tag{1}\\ &= E[(XY)^2] - \left(\operatorname{cov}(X,Y)+E[X]E[Y]\right)^2\\ &= E[X^2Y^2] - \left(\operatorname{cov}(X,Y)+E[X]E[Y]\right)^2\tag{2}\\ &= \left(\operatorname{cov}(X^2,Y^2)+E[X^2]E[Y^2]\right) - \left(\operatorname{cov}(X,Y)+E[X]E[Y]\right)^2\tag{3}\\ \end{align} where $\operatorname{cov}(X,Y)$, $E[X]$, $E[Y]$, $E[X^2]$, and $E[Y^2]$ can be assumed to be known quantities, we need to be able to determine the value of $E\left[X^2Y^2\right]$ in $(2)$ or $\operatorname{cov}(X^2,Y^2)$ in $(3)$. This is not easy to do in general, but, as pointed out already, if $X$ and $Y$ are independent random variables, then $\operatorname{cov}(X,Y) = \operatorname{cov}(X^2,Y^2) = 0$. In fact, dependence, not correlation (or lack thereof) is the key issue. That we know that $\operatorname{cov}(X,Y)$ equals $0$ instead of some nonzero value does not, by itself, help in the least in our efforts are determining the value of $E\left[X^2Y^2\right]$ or $\operatorname{cov}(X^2,Y^2)$ even though it does simplify the right sides of $(2)$ and $(3)$ a little.

When $X$ and $Y$ are dependent random variables, then in at least one (fairly common or fairly important) special case, it is possible to find the value of $E\left[X^2Y^2\right]$ relatively easily.

Suppose that $X$ and $Y$ are jointly normal random variables with correlation coefficient $\rho$. Then, conditioned on $X = x$, the conditional density of $Y$ is a normal density with mean $E[Y] + \rho\left.\left.\sqrt{\frac{\operatorname{var}(Y)}{\operatorname{var}(X)}} \right(x-E[X]\right)$ and variance $\operatorname{var}(Y)(1-\rho^2)$. Thus, \begin{align}E[X^2Y^2 \mid X] &= X^2E[Y^2 \mid X]\\ &= X^2\left[\operatorname{var}(Y)(1-\rho^2) + \left(E[Y] + \rho\left.\left.\sqrt{\frac{\operatorname{var}(Y)}{\operatorname{var}(X)}} \right(X-E[X]\right)\right)^2\right] \end{align} which is a quartic function of $X$, say $g(X)$, and the Law of Iterated Expectation tells us that $$E[X^2Y^2] = E\left[E[X^2Y^2\mid X]\right] = E[g(X)]\tag{4}$$ where the right side of $(4)$ can be computed from knowledge of the 3rd and 4th moments of $X$ -- standard results that can be found in many texts and reference books (meaning that I am too lazy to look them up and include them in this answer).


Further addendum: In a now-deleted answer, @Hydrologist gives the variance of $XY$ as $$\mathrm{Var}\left[xy\right] = \left(\mathrm{E}\left[x\right]\right)^2\mathrm{Var}\left[y\right] + \left(\mathrm{E}\left[y\right]\right)^2\mathrm{Var}\left[x\right] + 2\mathrm{E}\left[x\right]\mathrm{Cov}\left[x,y^2\right] + 2\mathrm{E}\left[y\right]\mathrm{Cov}\left[x^2,y\right]\\ + 2\mathrm{E}\left[x\right]\mathrm{E}\left[y\right]\mathrm{Cov}\left[x,y\right] +\mathrm{Cov}\left[x^2,y^2\right] - \left(\mathrm{Cov}\left[x,y\right]\right)^2 \tag{5}$$ and claims that this formula is from two papers published a half-century ago in JASA. This formula is an incorrect transcription of the results in the paper(s) cited by Hydrologist. Specifically, $\mathrm{Cov}\left[x^2,y^2\right]$ is a mistranscription of $E[(x-E[x])^2(y-E[y])^2]$ in the journal article, and similarly for $\mathrm{Cov}\left[x^2,y\right]$ and $\mathrm{Cov}\left[x,y^2\right]$.

$\endgroup$
1

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