= Positive covariance
{title2=$\operatorname{Cov}(X,Y)>0$}
Two <random variables> have \b[positive covariance] when their centered product has positive <expected value>:
$$
\operatorname{Cov}(X,Y)=\mathbb E[(X-\mathbb EX)(Y-\mathbb EY)]>0.
$$
Assume throughout that their <second moments> are finite. Outcomes where the centered values have the same sign contribute positively; opposite signs contribute negatively. The sign describes their average balance, rather than requiring every outcome to have matching signs.<Covariance and Correlation by Jeremy Orloff and Jonathan Bloom>[§§2–2.1, definition and properties of covariance]{ref}
A shared group effect can produce <positive covariance> even when the relation inside each group runs in the opposite direction. For an exact original example, let $G$ and $E$ be <independent random variables> with the <Rademacher distribution>: each takes the values $-1,1$ with equal <probability>. Define $X=2G+E$ and $Y=2G-E$. Both <expected values> vanish, and <independence> gives
$$
\operatorname{Var}(X)=\operatorname{Var}(Y)=5,
\qquad
\boxed{\operatorname{Cov}(X,Y)=4\operatorname{Var}(G)-\operatorname{Var}(E)=3>0.}
$$
Their <Pearson correlation coefficient> is consequently $3/5$. The four equiprobable outcomes $(X,Y)$ are $(-3,-1)$, $(-1,-3)$, $(1,3)$ and $(3,1)$.
For either fixed value $G=g$, however, $Y=4g-X$. Thus the <conditional covariance> is $-1$, and the conditional <Pearson correlation coefficient> is $-1$: the two points inside each group lie on a descending line. The <law of total covariance> identifies exactly where the positive pooled value comes from:
$$
\operatorname{Cov}(X,Y)
=\mathbb E[\operatorname{Cov}(X,Y\mid G)]
+\operatorname{Cov}(\mathbb E[X\mid G],\mathbb E[Y\mid G])
=-1+\operatorname{Cov}(2G,2G)=-1+4=3.
$$
The first term averages the <conditional covariances>; the second measures how the two <conditional expectations> move together across groups. Here the between-group contribution outweighs the negative within-group contribution. This is a covariance form of <Simpson's paradox>.
\Image[/positive-covariance-from-grouping.png]
{title=Positive pooled <covariance> with negative <conditional covariance> in both groups}
{description=Original four-outcome model $X=2G+E$, $Y=2G-E$ with independent equiprobable signs. Colored segments show the two conditional relations; the dashed line is the pooled least-squares fit. These are exact model outcomes, not measured data.}
The dashed <linear regression> line has slope $\operatorname{Cov}(X,Y)/\operatorname{Var}(X)=3/5$, but that slope does not give the direction of the relation at fixed $G$. Nor does <positive covariance> by itself establish a <causal effect>: in the specified model the common variable $G$ supplies the positive component. Choosing which variables to condition on is a question about the model and the intended comparison, beyond computing one number.
<Positive covariance> is also weaker than requiring one variable to be an increasing function of the other. Under appropriate <integrability> assumptions, <strict positive covariance with an increasing payoff> supplies a useful sufficient condition; the grouping example shows a different route to the same sign.
Back to article page