Books Probability and Statistical Inference

The Correlation Coefficient

Putting 𝑒(𝑋,π‘Œ)=(π‘‹βˆ’ΞΌπ‘‹)(π‘Œβˆ’ΞΌπ‘Œ)𝑒(𝑋,π‘Œ)=(𝑋-{\mu }_{𝑋})(π‘Œ-{\mu }_{π‘Œ}) in (4.1), we obtain a special mathematical expectation:

E[(π‘‹βˆ’ΞΌπ‘‹)(π‘Œβˆ’ΞΌπ‘Œ)]=βˆ‘(π‘₯,𝑦)βˆˆπ‘†(π‘₯βˆ’ΞΌπ‘‹)(π‘¦βˆ’ΞΌπ‘Œ)𝑓(π‘₯,𝑦)β‰•Οƒπ‘‹π‘Œβ‰•Cov⁑(𝑋,π‘Œ).\mathbb{E}[(𝑋-{\mu }_{𝑋})(π‘Œ-{\mu }_{π‘Œ})]=\sum _{(π‘₯,𝑦)\in 𝑆}(π‘₯-{\mu }_{𝑋})(𝑦-{\mu }_{π‘Œ})𝑓(π‘₯,𝑦)≕{\sigma }_{π‘‹π‘Œ}≕\operatorname{Cov}(𝑋,π‘Œ).
(4.2)

This is called the covariance of 𝑋𝑋 and π‘Œπ‘Œ.

The correlation coefficient of 𝑋𝑋 and π‘Œπ‘Œ is defined as

ρ=Οƒπ‘‹π‘ŒΟƒπ‘‹Οƒπ‘Œ.\rho =\frac{{\sigma }_{π‘‹π‘Œ}}{{\sigma }_{𝑋}{\sigma }_{π‘Œ}}.
(4.3)

By playing with (4.2) and (4.3), we can obtain some simple facts about the correlation coefficient:

  1. Cov⁑(𝑋,π‘Œ)=E[π‘‹π‘Œ]βˆ’ΞΌπ‘‹ΞΌπ‘Œ\operatorname{Cov}(𝑋,π‘Œ)=\mathbb{E}[π‘‹π‘Œ]-{\mu }_{𝑋}{\mu }_{π‘Œ}.
  2. E[π‘‹π‘Œ]=ΞΌπ‘‹ΞΌπ‘Œ+ΟΟƒπ‘‹Οƒπ‘Œ\mathbb{E}[π‘‹π‘Œ]={\mu }_{𝑋}{\mu }_{π‘Œ}+\rho {\sigma }_{𝑋}{\sigma }_{π‘Œ}. An interpretation of this is that the expected value of the product of 𝑋𝑋 and π‘Œπ‘Œ is roughly ΞΌπ‘‹ΞΌπ‘Œ{\mu }_{𝑋}{\mu }_{π‘Œ}β€”the product of the often assumed values of 𝑋𝑋 and π‘Œπ‘Œ plus a term that is proportional to the correlation coefficient ρ\rho .
Exercise 4.3

Let 𝑋𝑋 and π‘Œπ‘Œ have a trinomial distribution with parameters 𝑛𝑛, 𝑝𝑋{𝑝}_{𝑋}, and π‘π‘Œ{𝑝}_{π‘Œ}. Show that

E[π‘‹π‘Œ]=𝑛(π‘›βˆ’1)π‘π‘‹π‘π‘Œ\mathbb{E}[π‘‹π‘Œ]=𝑛(𝑛-1){𝑝}_{𝑋}{𝑝}_{π‘Œ}

and consequently,

Cov⁑(𝑋,π‘Œ)=βˆ’π‘›π‘π‘‹π‘π‘Œandρ=βˆ’π‘π‘‹π‘π‘Œ(1βˆ’π‘π‘‹)(1βˆ’π‘π‘Œ).\operatorname{Cov}(𝑋,π‘Œ)=-𝑛{𝑝}_{𝑋}{𝑝}_{π‘Œ}\quad \text{and}\quad \rho =-\sqrt{\frac{{𝑝}_{𝑋}{𝑝}_{π‘Œ}}{(1-{𝑝}_{𝑋})(1-{𝑝}_{π‘Œ})}}.

We first prove this via brute force calculation and we will provide another more interesting and neater proof later.

Proof

By definition and the formula of the trinomial PMF,

E[π‘‹π‘Œ]=βˆ‘π‘₯=0π‘›βˆ‘π‘¦=0π‘›βˆ’π‘₯π‘₯𝑦𝑛!π‘₯!𝑦!(π‘›βˆ’π‘₯βˆ’π‘¦)!𝑝𝑋π‘₯π‘π‘Œπ‘¦(1βˆ’π‘π‘‹βˆ’π‘π‘Œ)π‘›βˆ’π‘₯βˆ’π‘¦Drop the terms where either π‘₯ or 𝑦 is 0=βˆ‘π‘₯=1π‘›βˆ’1βˆ‘π‘¦=1π‘›βˆ’1βˆ’π‘₯π‘₯𝑦𝑛!π‘₯!𝑦!(π‘›βˆ’π‘₯βˆ’π‘¦)!𝑝𝑋π‘₯π‘π‘Œπ‘¦(1βˆ’π‘π‘‹βˆ’π‘π‘Œ)π‘›βˆ’π‘₯βˆ’π‘¦=βˆ‘π‘₯=1π‘›βˆ’1βˆ‘π‘¦=1π‘›βˆ’1βˆ’π‘₯𝑛!(π‘₯βˆ’1)!(π‘¦βˆ’1)!(π‘›βˆ’π‘₯βˆ’π‘¦)!𝑝𝑋π‘₯π‘π‘Œπ‘¦(1βˆ’π‘π‘‹βˆ’π‘π‘Œ)π‘›βˆ’π‘₯βˆ’π‘¦Reindex π‘₯←π‘₯+1 and 𝑦←𝑦+1=βˆ‘π‘₯=0π‘›βˆ’2βˆ‘π‘¦=0π‘›βˆ’2βˆ’π‘₯𝑛!π‘₯!𝑦!(π‘›βˆ’2βˆ’π‘₯βˆ’π‘¦)!𝑝𝑋π‘₯+1π‘π‘Œπ‘¦+1(1βˆ’π‘π‘‹βˆ’π‘π‘Œ)π‘›βˆ’2βˆ’π‘₯βˆ’π‘¦Pull out 𝑛(π‘›βˆ’1)π‘π‘‹π‘π‘Œ=𝑛(π‘›βˆ’1)π‘π‘‹π‘π‘Œβˆ‘π‘₯=0π‘›βˆ’2βˆ‘π‘¦=0π‘›βˆ’2βˆ’π‘₯(π‘›βˆ’2)!π‘₯!𝑦!(π‘›βˆ’2βˆ’π‘₯βˆ’π‘¦)!𝑝𝑋π‘₯π‘π‘Œπ‘¦(1βˆ’π‘π‘‹βˆ’π‘π‘Œ)π‘›βˆ’2βˆ’π‘₯βˆ’π‘¦βŸ=[𝑝𝑋+π‘π‘Œ+(1βˆ’π‘π‘‹βˆ’π‘π‘Œ)]π‘›βˆ’2=1π‘›βˆ’2=1=𝑛(π‘›βˆ’1)π‘π‘‹π‘π‘Œ.\begin{aligned}\mathbb{E}[π‘‹π‘Œ] & =\sum _{π‘₯=0}^{𝑛}\sum _{𝑦=0}^{𝑛-π‘₯}π‘₯𝑦\frac{𝑛!}{π‘₯!𝑦!(𝑛-π‘₯-𝑦)!}{𝑝}_{𝑋}^{π‘₯}{𝑝}_{π‘Œ}^{𝑦}{(1-{𝑝}_{𝑋}-{𝑝}_{π‘Œ})}^{𝑛-π‘₯-𝑦} \\ & \text{Drop the terms where either}\, π‘₯\, \text{or}\, 𝑦\, \text{is}\, 0 \\ & =\sum _{π‘₯=1}^{𝑛-1}\sum _{𝑦=1}^{𝑛-1-π‘₯}π‘₯𝑦\frac{𝑛!}{π‘₯!𝑦!(𝑛-π‘₯-𝑦)!}{𝑝}_{𝑋}^{π‘₯}{𝑝}_{π‘Œ}^{𝑦}{(1-{𝑝}_{𝑋}-{𝑝}_{π‘Œ})}^{𝑛-π‘₯-𝑦} \\ & =\sum _{π‘₯=1}^{𝑛-1}\sum _{𝑦=1}^{𝑛-1-π‘₯}\frac{𝑛!}{(π‘₯-1)!(𝑦-1)!(𝑛-π‘₯-𝑦)!}{𝑝}_{𝑋}^{π‘₯}{𝑝}_{π‘Œ}^{𝑦}{(1-{𝑝}_{𝑋}-{𝑝}_{π‘Œ})}^{𝑛-π‘₯-𝑦} \\ & \text{Reindex}\, π‘₯←π‘₯+1\, \text{and}\, 𝑦←𝑦+1 \\ & =\sum _{π‘₯=0}^{𝑛-2}\sum _{𝑦=0}^{𝑛-2-π‘₯}\frac{𝑛!}{π‘₯!𝑦!(𝑛-2-π‘₯-𝑦)!}{𝑝}_{𝑋}^{π‘₯+1}{𝑝}_{π‘Œ}^{𝑦+1}{(1-{𝑝}_{𝑋}-{𝑝}_{π‘Œ})}^{𝑛-2-π‘₯-𝑦} \\ & \text{Pull out}\, 𝑛(𝑛-1){𝑝}_{𝑋}{𝑝}_{π‘Œ} \\ & =𝑛(𝑛-1){𝑝}_{𝑋}{𝑝}_{π‘Œ}\underbrace{\sum _{π‘₯=0}^{𝑛-2}\sum _{𝑦=0}^{𝑛-2-π‘₯}\frac{(𝑛-2)!}{π‘₯!𝑦!(𝑛-2-π‘₯-𝑦)!}{𝑝}_{𝑋}^{π‘₯}{𝑝}_{π‘Œ}^{𝑦}{(1-{𝑝}_{𝑋}-{𝑝}_{π‘Œ})}^{𝑛-2-π‘₯-𝑦}}_{={[{𝑝}_{𝑋}+{𝑝}_{π‘Œ}+(1-{𝑝}_{𝑋}-{𝑝}_{π‘Œ})]}^{𝑛-2}={1}^{𝑛-2}=1} \\ & =𝑛(𝑛-1){𝑝}_{𝑋}{𝑝}_{π‘Œ}.\end{aligned}

Recall that π‘‹βˆΌBin⁑(𝑛,𝑝𝑋)π‘‹βˆΌ\operatorname{Bin}(𝑛,{𝑝}_{𝑋}) and π‘ŒβˆΌBin⁑(𝑛,π‘π‘Œ)π‘ŒβˆΌ\operatorname{Bin}(𝑛,{𝑝}_{π‘Œ}). We have

μ𝑋=𝑛𝑝𝑋,σ𝑋2=𝑛𝑝𝑋(1βˆ’π‘π‘‹),ΞΌπ‘Œ=π‘›π‘π‘Œ,Οƒπ‘Œ2=π‘›π‘π‘Œ(1βˆ’π‘π‘Œ).{\mu }_{𝑋}=𝑛{𝑝}_{𝑋},\quad {\sigma }_{𝑋}^{2}=𝑛{𝑝}_{𝑋}(1-{𝑝}_{𝑋}),\quad {\mu }_{π‘Œ}=𝑛{𝑝}_{π‘Œ},\quad {\sigma }_{π‘Œ}^{2}=𝑛{𝑝}_{π‘Œ}(1-{𝑝}_{π‘Œ}).

It then follows that

Cov⁑(𝑋,π‘Œ)=E[π‘‹π‘Œ]βˆ’ΞΌπ‘‹ΞΌπ‘Œ=𝑛(π‘›βˆ’1)π‘π‘‹π‘π‘Œβˆ’π‘›2π‘π‘‹π‘π‘Œ=βˆ’π‘›π‘π‘‹π‘π‘Œ\operatorname{Cov}(𝑋,π‘Œ)=\mathbb{E}[π‘‹π‘Œ]-{\mu }_{𝑋}{\mu }_{π‘Œ}=𝑛(𝑛-1){𝑝}_{𝑋}{𝑝}_{π‘Œ}-{𝑛}^{2}{𝑝}_{𝑋}{𝑝}_{π‘Œ}=-𝑛{𝑝}_{𝑋}{𝑝}_{π‘Œ}

and

ρ=Cov⁑(𝑋,π‘Œ)Οƒπ‘‹Οƒπ‘Œ=βˆ’π‘›π‘π‘‹π‘π‘Œπ‘›π‘π‘‹(1βˆ’π‘π‘‹)π‘›π‘π‘Œ(1βˆ’π‘π‘Œ)=βˆ’π‘π‘‹π‘π‘Œ(1βˆ’π‘π‘‹)(1βˆ’π‘π‘Œ).\rho =\frac{\operatorname{Cov}(𝑋,π‘Œ)}{{\sigma }_{𝑋}{\sigma }_{π‘Œ}}=\frac{-𝑛{𝑝}_{𝑋}{𝑝}_{π‘Œ}}{\sqrt{𝑛{𝑝}_{𝑋}(1-{𝑝}_{𝑋})}\sqrt{𝑛{𝑝}_{π‘Œ}(1-{𝑝}_{π‘Œ})}}=-\sqrt{\frac{{𝑝}_{𝑋}{𝑝}_{π‘Œ}}{(1-{𝑝}_{𝑋})(1-{𝑝}_{π‘Œ})}}.

We now give the alternative proof alluded to above, trading lengthy manipulation of the trinomial PMF for a more structural point of view. The central moveβ€”expressing each count as a sum of i.i.d. Bernoulli (indicator) random variables, one for each of the 𝑛𝑛 independent trialsβ€”makes the calculation of E[π‘‹π‘Œ]\mathbb{E}[π‘‹π‘Œ] a matter of bookkeeping over independent trials; the same random variable as a sum of i.i.d.i.i.d. pieces device is a standard and widely reusable first step in many problems.

Proof

Consider 𝑛𝑛 independent draws with replacement from an urn with three colors 𝐢1{𝐢}_{1}, 𝐢2{𝐢}_{2}, and 𝐢3{𝐢}_{3}, with probabilities 𝑝𝑋{𝑝}_{𝑋}, π‘π‘Œ{𝑝}_{π‘Œ}, and 1βˆ’π‘π‘‹βˆ’π‘π‘Œ1-{𝑝}_{𝑋}-{𝑝}_{π‘Œ} on each draw. For 𝑖=1,…,𝑛𝑖=1,\ldots ,𝑛, let 𝐼𝑖(1){𝐼}_{𝑖}^{(1)} indicate whether the 𝑖𝑖-th draw is 𝐢1{𝐢}_{1}, and let 𝐼𝑖(2){𝐼}_{𝑖}^{(2)} indicate whether the 𝑖𝑖-th draw is 𝐢2{𝐢}_{2}. Then 𝐼𝑖(1)∼Ber⁑(𝑝𝑋){𝐼}_{𝑖}^{(1)}∼\operatorname{Ber}({𝑝}_{𝑋}) and 𝐼𝑖(2)∼Ber⁑(π‘π‘Œ){𝐼}_{𝑖}^{(2)}∼\operatorname{Ber}({𝑝}_{π‘Œ}), and the 𝑛𝑛 trials are mutually independent (for a given 𝑖𝑖, of course, 𝐼𝑖(1)𝐼𝑖(2)=0{𝐼}_{𝑖}^{(1)}{𝐼}_{𝑖}^{(2)}=0).

The trinomial counts are

𝑋=βˆ‘π‘–=1𝑛𝐼𝑖(1)andπ‘Œ=βˆ‘π‘—=1𝑛𝐼𝑗(2).𝑋=\sum _{𝑖=1}^{𝑛}{𝐼}_{𝑖}^{(1)}\quad \text{and}\quad π‘Œ=\sum _{𝑗=1}^{𝑛}{𝐼}_{𝑗}^{(2)}.

Thus

π‘‹π‘Œ=βˆ‘π‘–=1π‘›βˆ‘π‘—=1𝑛𝐼𝑖(1)𝐼𝑗(2).π‘‹π‘Œ=\sum _{𝑖=1}^{𝑛}\sum _{𝑗=1}^{𝑛}{𝐼}_{𝑖}^{(1)}{𝐼}_{𝑗}^{(2)}.

Split the double sum according to whether 𝑖=𝑗𝑖=𝑗 or 𝑖≠𝑗𝑖\neq 𝑗:

π‘‹π‘Œ=βˆ‘π‘–β‰ π‘—πΌπ‘–(1)𝐼𝑗(2)+βˆ‘π‘–=𝑗𝐼𝑖(1)𝐼𝑗(2).π‘‹π‘Œ=\sum _{𝑖\neq 𝑗}{𝐼}_{𝑖}^{(1)}{𝐼}_{𝑗}^{(2)}+\sum _{𝑖=𝑗}{𝐼}_{𝑖}^{(1)}{𝐼}_{𝑗}^{(2)}.

The second sum is zero, because if 𝑖=𝑗𝑖=𝑗 then 𝐼𝑖(1)𝐼𝑖(2)=0{𝐼}_{𝑖}^{(1)}{𝐼}_{𝑖}^{(2)}=0 (the 𝑖𝑖-th draw cannot be both 𝐢1{𝐢}_{1} and 𝐢2{𝐢}_{2}). Hence

π‘‹π‘Œ=βˆ‘π‘–β‰ π‘—πΌπ‘–(1)𝐼𝑗(2).π‘‹π‘Œ=\sum _{𝑖\neq 𝑗}{𝐼}_{𝑖}^{(1)}{𝐼}_{𝑗}^{(2)}.

Whenever 𝑖≠𝑗𝑖\neq 𝑗, the indicators 𝐼𝑖(1){𝐼}_{𝑖}^{(1)} and 𝐼𝑗(2){𝐼}_{𝑗}^{(2)} refer to different trials, so they are independent. Taking expectations,

E[π‘‹π‘Œ]=βˆ‘π‘–β‰ π‘—E[𝐼𝑖(1)𝐼𝑗(2)]Due to independence=βˆ‘π‘–β‰ π‘—E[𝐼𝑖(1)]E[𝐼𝑗(2)]=βˆ‘π‘–β‰ π‘—π‘π‘‹π‘π‘Œ=𝑛(π‘›βˆ’1)π‘π‘‹π‘π‘Œ.\begin{aligned}\mathbb{E}[π‘‹π‘Œ] & =\sum _{𝑖\neq 𝑗}\mathbb{E}[{𝐼}_{𝑖}^{(1)}{𝐼}_{𝑗}^{(2)}] \\ & \text{Due to independence} \\ & =\sum _{𝑖\neq 𝑗}\mathbb{E}[{𝐼}_{𝑖}^{(1)}]\mathbb{E}[{𝐼}_{𝑗}^{(2)}] \\ & =\sum _{𝑖\neq 𝑗}{𝑝}_{𝑋}{𝑝}_{π‘Œ} \\ & =𝑛(𝑛-1){𝑝}_{𝑋}{𝑝}_{π‘Œ}.\end{aligned}

And yet we will have another derivation of the covariance of trinomial distribution when we introduce the conditional distributions later in Example 4.4.

Consider the 22-dimensional space of the joint support 𝑆𝑆 of random variables 𝑋𝑋 and π‘Œπ‘Œ and a line, with finite slope 𝑏𝑏, passing through the point (μ𝑋,ΞΌπ‘Œ)({\mu }_{𝑋},{\mu }_{π‘Œ}). (If we sample the points (π‘₯,𝑦)(π‘₯,𝑦) randomly following the joint distribution and depict a scatter plot, then we will see that (μ𝑋,ΞΌπ‘Œ)({\mu }_{𝑋},{\mu }_{π‘Œ}) is roughly the centroid of this cluster.) The equation of such a line is 𝑦=𝑏(π‘₯βˆ’ΞΌπ‘‹)+ΞΌπ‘Œπ‘¦=𝑏(π‘₯-{\mu }_{𝑋})+{\mu }_{π‘Œ}. Randomly sample a point (π‘₯,𝑦)(π‘₯,𝑦), the vertical distance between the point and the line is given by βˆ£π‘¦βˆ’π‘(π‘₯βˆ’ΞΌπ‘‹)βˆ’ΞΌπ‘Œβˆ£|𝑦-𝑏(π‘₯-{\mu }_{𝑋})-{\mu }_{π‘Œ}|. We are now interested in the expected value of the square of this distance, i.e.,

𝐿(𝑏)=E[βˆ£π‘Œβˆ’π‘(π‘‹βˆ’ΞΌπ‘‹)βˆ’ΞΌπ‘Œβˆ£2].𝐿(𝑏)=\mathbb{E}[{|π‘Œ-𝑏(𝑋-{\mu }_{𝑋})-{\mu }_{π‘Œ}|}^{2}].
(4.4)

As (4.4), this expectation can be regarded as a function 𝐿(𝑏)𝐿(𝑏) of 𝑏𝑏. The problem now is to find the value of 𝑏𝑏 that minimizes 𝐿(𝑏)𝐿(𝑏). Rearranging the terms and applying the linearity of expectations, we have

𝐿(𝑏)=Οƒπ‘Œ2+𝑏2σ𝑋2βˆ’2π‘Οƒπ‘‹π‘Œ.𝐿(𝑏)={\sigma }_{π‘Œ}^{2}+{𝑏}^{2}{\sigma }_{𝑋}^{2}-2𝑏{\sigma }_{π‘‹π‘Œ}.

Differentiating,

𝐿′(𝑏)=2𝑏σ𝑋2βˆ’2Οƒπ‘‹π‘Œ.{𝐿}^{\prime }(𝑏)=2𝑏{\sigma }_{𝑋}^{2}-2{\sigma }_{π‘‹π‘Œ}.

Setting to zero, we solve for 𝑏𝑏 to get

π‘βˆ—=Οƒπ‘‹π‘ŒΟƒπ‘‹2=ΟΟƒπ‘ŒΟƒπ‘‹.{𝑏}^{\ast }=\frac{{\sigma }_{π‘‹π‘Œ}}{{\sigma }_{𝑋}^{2}}=\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}.

Therefore, the equation of the optimal line is

𝑦=ΟΟƒπ‘ŒΟƒπ‘‹(π‘₯βˆ’ΞΌπ‘‹)+ΞΌπ‘Œ.𝑦=\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}(π‘₯-{\mu }_{𝑋})+{\mu }_{π‘Œ}.

Evaluated at ΟΟƒπ‘Œ/σ𝑋\rho {\sigma }_{π‘Œ}/{\sigma }_{𝑋}, 𝐿(𝑏)𝐿(𝑏), or the minimum value of the expected value of the square of the vertical distance, is

𝐿(ΟΟƒπ‘ŒΟƒπ‘‹)=Οƒπ‘Œ2(1βˆ’Ο2).𝐿\left(\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}\right)={\sigma }_{π‘Œ}^{2}(1-{\rho }^{2}).
(4.5)

We can gain a lot of insights from (4.5). First, since the expected value of a square is always non-negative, we clearly have Οƒπ‘Œ2(1βˆ’Ο2)β‰₯0{\sigma }_{π‘Œ}^{2}(1-{\rho }^{2})\geq 0, which yields

βˆ’1≀ρ≀1.-1\leq \rho \leq 1.

That is, the value of correlation coefficient is bounded by 11.

When ∣ρ∣=1|\rho |=1, that is, 𝑋𝑋 is strongly correlated with π‘Œπ‘Œ either in the positive or negative direction, we get 𝐿(π‘βˆ—)=0𝐿({𝑏}^{\ast })=0, which means that all the sampled points (π‘₯,𝑦)(π‘₯,𝑦) will lie on the line 𝑦=π‘βˆ—π‘₯+ΞΌπ‘Œπ‘¦={𝑏}^{\ast }π‘₯+{\mu }_{π‘Œ}.

When ρ=0\rho =0, we have 𝐿(π‘βˆ—)=Οƒπ‘Œ2𝐿({𝑏}^{\ast })={\sigma }_{π‘Œ}^{2}. The same quantity is E[(π‘Œβˆ’ΞΌπ‘Œ)2]\mathbb{E}[{(π‘Œ-{\mu }_{π‘Œ})}^{2}], the mean squared error from predicting π‘Œπ‘Œ by the constant ΞΌπ‘Œ{\mu }_{π‘Œ} without using 𝑋𝑋. Intuitively, pushing each sample (π‘₯,𝑦)(π‘₯,𝑦) onto the 𝑦𝑦-axis discards π‘₯π‘₯, yet nothing is gained by retaining it in mean squared error; that is the geometric echo of 𝑋𝑋 and π‘Œπ‘Œ being uncorrelated.

Suppose that 𝑋𝑋 and π‘Œπ‘Œ are independent. Then they must be uncorrelated, i.e., ρ=0\rho =0 or Cov⁑(𝑋,π‘Œ)=0\operatorname{Cov}(𝑋,π‘Œ)=0. Indeed, we have

Cov⁑(𝑋,π‘Œ)=E[π‘‹π‘Œ]βˆ’ΞΌπ‘‹ΞΌπ‘Œ=E[𝑋]E[π‘Œ]βˆ’ΞΌπ‘‹ΞΌπ‘Œ=ΞΌπ‘‹ΞΌπ‘Œβˆ’ΞΌπ‘‹ΞΌπ‘Œ=0.\operatorname{Cov}(𝑋,π‘Œ)=\mathbb{E}[π‘‹π‘Œ]-{\mu }_{𝑋}{\mu }_{π‘Œ}=\mathbb{E}[𝑋]\mathbb{E}[π‘Œ]-{\mu }_{𝑋}{\mu }_{π‘Œ}={\mu }_{𝑋}{\mu }_{π‘Œ}-{\mu }_{𝑋}{\mu }_{π‘Œ}=0.

The condition of independence is applied when we write E[π‘‹π‘Œ]=E[𝑋]E[π‘Œ]\mathbb{E}[π‘‹π‘Œ]=\mathbb{E}[𝑋]\mathbb{E}[π‘Œ]. However, the converse is not true. That is, if two random variables are uncorrelated, they are not, in general, independent.

Note
The derivation does not require 𝑋𝑋 and π‘Œπ‘Œ to be discrete. It uses only the algebra of expectations, not mass functions and sums over the support, so the same results apply to continuous (or more general) joint distributions, with integrals in place of sums when moments are defined in the usual way.

In fact, it was not necessary to parametrize the line as passing through (μ𝑋,ΞΌπ‘Œ)({\mu }_{𝑋},{\mu }_{π‘Œ}) in order to minimize the expected squared vertical error. Exercise 4.4 instead uses the general form 𝑦=π‘Ž+𝑏π‘₯𝑦=π‘Ž+𝑏π‘₯ and optimizes over π‘Žπ‘Ž and 𝑏𝑏; the same best line is obtained, and it still passes through (μ𝑋,ΞΌπ‘Œ)({\mu }_{𝑋},{\mu }_{π‘Œ}).

Example 4.3

Let 𝑋𝑋 and π‘Œπ‘Œ have the joint PMF

𝑓(π‘₯,𝑦)=13,(π‘₯,𝑦)∈{(0,1),(1,0),(2,1)}.𝑓(π‘₯,𝑦)=\frac{1}{3},\quad (π‘₯,𝑦)\in \{(0,1),(1,0),(2,1)\}.

Figure 4.2 shows this joint PMF. From the plot, we can easily find that μ𝑋=1{\mu }_{𝑋}=1, ΞΌπ‘Œ=2/3{\mu }_{π‘Œ}=2/3 and

E[π‘‹π‘Œ]=0β‹…1β‹…13+1β‹…0β‹…13+2β‹…1β‹…13=23.\mathbb{E}[π‘‹π‘Œ]=0\cdot 1\cdot \frac{1}{3}+1\cdot 0\cdot \frac{1}{3}+2\cdot 1\cdot \frac{1}{3}=\frac{2}{3}.

Therefore, Cov⁑(𝑋,π‘Œ)=E[π‘‹π‘Œ]βˆ’ΞΌπ‘‹ΞΌπ‘Œ=0\operatorname{Cov}(𝑋,π‘Œ)=\mathbb{E}[π‘‹π‘Œ]-{\mu }_{𝑋}{\mu }_{π‘Œ}=0, which meas that 𝑋𝑋 and π‘Œπ‘Œ are uncorrelated. But clearly they are not independent since their support is not rectangular.

Figure 4.2 Joint PMF on the three-point support {(0,1),(1,0),(2,1)}\{(0,1),(1,0),(2,1)\}, uniform with mass 13\frac{1}{3} at each point. Here 𝑋𝑋 and π‘Œπ‘Œ are uncorrelated yet dependent.

Exercises

Exercise 4.4

Let 𝑋𝑋 and π‘Œπ‘Œ be random variables with respective means μ𝑋{\mu }_{𝑋} and ΞΌπ‘Œ{\mu }_{π‘Œ}, respective variances σ𝑋2{\sigma }_{𝑋}^{2} and Οƒπ‘Œ2{\sigma }_{π‘Œ}^{2} and correlation coefficient ρ\rho . Fit the line 𝑦=π‘Ž+𝑏π‘₯𝑦=π‘Ž+𝑏π‘₯ by the method of least squares to the probability distribution by minimizing the expectation

𝐿(π‘Ž,𝑏)=E[(π‘Œβˆ’(π‘Ž+𝑏𝑋))2]𝐿(π‘Ž,𝑏)=\mathbb{E}[{(π‘Œ-(π‘Ž+𝑏𝑋))}^{2}]

with respect to π‘Žπ‘Ž and 𝑏𝑏.

Solution

Expand the expression inside the expectation,

𝐿(π‘Ž,𝑏)=π‘Ž2+E[𝑋2]𝑏2+2ΞΌπ‘‹π‘Žπ‘βˆ’2ΞΌπ‘Œπ‘Žβˆ’2E[π‘‹π‘Œ]𝑏+E[π‘Œ2].𝐿(π‘Ž,𝑏)={π‘Ž}^{2}+\mathbb{E}[{𝑋}^{2}]{𝑏}^{2}+2{\mu }_{𝑋}π‘Žπ‘-2{\mu }_{π‘Œ}π‘Ž-2\mathbb{E}[π‘‹π‘Œ]𝑏+\mathbb{E}[{π‘Œ}^{2}].

Differentiate with respect to π‘Žπ‘Ž and 𝑏𝑏,

βˆ‚βˆ‚π‘ŽπΏ(π‘Ž,𝑏)=2π‘Ž+2ΞΌπ‘‹π‘βˆ’2ΞΌπ‘Œβˆ‚βˆ‚π‘πΏ(π‘Ž,𝑏)=2ΞΌπ‘‹π‘Ž+2E[𝑋2]π‘βˆ’2E[π‘‹π‘Œ].\begin{aligned}\frac{\partial }{\partial π‘Ž}𝐿(π‘Ž,𝑏) & =2π‘Ž+2{\mu }_{𝑋}𝑏-2{\mu }_{π‘Œ} \\ \frac{\partial }{\partial 𝑏}𝐿(π‘Ž,𝑏) & =2{\mu }_{𝑋}π‘Ž+2\mathbb{E}[{𝑋}^{2}]𝑏-2\mathbb{E}[π‘‹π‘Œ].\end{aligned}

Setting to zero, we get the system of equations

{π‘Ž+ΞΌπ‘‹π‘βˆ’ΞΌπ‘Œ=0ΞΌπ‘‹π‘Ž+E[𝑋2]π‘βˆ’E[π‘‹π‘Œ]=0\begin{cases}π‘Ž+{\mu }_{𝑋}𝑏-{\mu }_{π‘Œ} & =0 \\ {\mu }_{𝑋}π‘Ž+\mathbb{E}[{𝑋}^{2}]𝑏-\mathbb{E}[π‘‹π‘Œ] & =0\end{cases}

We solve 𝑏𝑏 by multiplying the first equation by μ𝑋{\mu }_{𝑋} and then subtract it from the second equation:

π‘βˆ—=Οƒπ‘‹π‘ŒΟƒπ‘‹2=ΟΟƒπ‘ŒΟƒπ‘‹.{𝑏}^{\ast }=\frac{{\sigma }_{π‘‹π‘Œ}}{{\sigma }_{𝑋}^{2}}=\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}.

Then plugging π‘βˆ—{𝑏}^{\ast } back into the first equation, we get

π‘Žβˆ—=ΞΌπ‘Œβˆ’ΟΟƒπ‘ŒΟƒπ‘‹β‹…ΞΌπ‘‹.{π‘Ž}^{\ast }={\mu }_{π‘Œ}-\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}\cdot {\mu }_{𝑋}.

Therefore, the line of the best fit is

𝑦=ΞΌπ‘Œβˆ’ΟΟƒπ‘ŒΟƒπ‘‹β‹…ΞΌπ‘‹+ΟΟƒπ‘ŒΟƒπ‘‹π‘₯=ΞΌπ‘Œ+ΟΟƒπ‘ŒΟƒπ‘‹(π‘₯βˆ’ΞΌπ‘‹).𝑦={\mu }_{π‘Œ}-\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}\cdot {\mu }_{𝑋}+\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}π‘₯={\mu }_{π‘Œ}+\rho \frac{{\sigma }_{π‘Œ}}{{\sigma }_{𝑋}}(π‘₯-{\mu }_{𝑋}).

Note that it indeed passes through the point (μ𝑋,ΞΌπ‘Œ)({\mu }_{𝑋},{\mu }_{π‘Œ}).