Salta al contenuto
Note per Studenti Independent Random Variables Report

Independent Random Variables

In questa pagina 5

Definition

Definition. (X,Y)(X,Y) are independent if their joint density factorizes:

pXY(xi,yj)=pX(xi) pY(yj)for all (xi,yj)∈X×Y.p_{XY}(x_i,y_j)=p_X(x_i)\,p_Y(y_j)\qquad\text{for all }(x_i,y_j)\in\mathcal{X}\times\mathcal{Y}.

Equivalent to: P([X=xi]∩[Y=yj])=P(X=xi)P(Y=yj)P([X=x_i]\cap[Y=y_j])=P(X=x_i)P(Y=y_j) (see Discrete Random VectorsA discrete random vector (X,Y) is described by its joint discrete density p_XY(x_i,y_j) = P(X = x_i, Y = y_j), whose marginals are obtained by summing over the other variable and which gives expectations of any function g(X,Y), including E(XY), covariance and the density of X + Y.Discrete Random Vectors → for the joint density and its marginals).

Example. (X,Y)(X,Y) with joint density (rows XX, columns YY, marginals at the edge):

X\YX\backslash Y −1-1 22 pXp_X
−1-1 0.420.42 0.180.18 0.60.6
00 0.210.21 0.090.09 0.30.3
11 0.070.07 0.030.03 0.10.1
pYp_Y 0.70.7 0.30.3

Check that (X,Y)(X,Y) are independent (exercise on the page): every entry is the product of its two marginals, e.g. 0.6⋅0.7=0.420.6\cdot0.7=0.42, 0.6⋅0.3=0.180.6\cdot0.3=0.18, 0.3⋅0.7=0.210.3\cdot0.7=0.21, 0.3⋅0.3=0.090.3\cdot0.3=0.09, 0.1⋅0.7=0.070.1\cdot0.7=0.07, 0.1⋅0.3=0.030.1\cdot0.3=0.03.

Exercise. Let (X,Y)(X,Y) be both binary random variables with joint density pXY(i,j)p_{XY}(i,j), i,j∈{0,1}i,j\in\{0,1\}, and marginals pXp_X, pYp_Y. Prove that (X,Y)(X,Y) are independent if and only if the determinant of the joint density vanishes.

Solution sketch. The determinant is Δ=pXY(0,0)pXY(1,1)−pXY(0,1)pXY(1,0)\Delta=p_{XY}(0,0)p_{XY}(1,1)-p_{XY}(0,1)p_{XY}(1,0). Using pX(0)=pXY(0,0)+pXY(0,1)p_X(0)=p_{XY}(0,0)+p_{XY}(0,1), pY(0)=pXY(0,0)+pXY(1,0)p_Y(0)=p_{XY}(0,0)+p_{XY}(1,0) and the normalization ∑pXY=1\sum p_{XY}=1, pX(0)pY(0)=pXY(0,0)(pXY(0,0)+pXY(0,1)+pXY(1,0))+pXY(0,1)pXY(1,0)=pXY(0,0)−Δ.p_X(0)p_Y(0)=p_{XY}(0,0)\big(p_{XY}(0,0)+p_{XY}(0,1)+p_{XY}(1,0)\big)+p_{XY}(0,1)p_{XY}(1,0)=p_{XY}(0,0)-\Delta. So pXY(0,0)=pX(0)pY(0)p_{XY}(0,0)=p_X(0)p_Y(0) iff Δ=0\Delta=0; the other three cells differ from the product of marginals by ∓Δ\mp\Delta in the same way. Hence factorization holds for all four cells iff Δ=0\Delta=0.

Independence is preserved by functions

Lemma. (X,Y)(X,Y) independent if and only if (f(X),g(Y))(f(X),g(Y)) independent for all f,g:R→Rf,g:\mathbb{R}\to\mathbb{R}.

Proof. (⇐\Leftarrow) trivial: it is enough to take f=g=f=g= identity.

(⇒\Rightarrow) For given f,gf,g let U=f(X)U=f(X) and V=g(Y)V=g(Y). Then

pUV(uk,vh)=∑xi:f(xi)=ukyj:g(yj)=vhpXY(xi,yj)=∑xi:f(xi)=ukyj:g(yj)=vhpX(xi)pY(yj)=[∑xi: f(xi)=ukpX(xi)]⋅[∑yj: g(yj)=vhpY(yj)]=pU(uk) pV(vh). □p_{UV}(u_k,v_h)=\sum_{\substack{x_i:\,f(x_i)=u_k\\ y_j:\,g(y_j)=v_h}}p_{XY}(x_i,y_j)=\sum_{\substack{x_i:\,f(x_i)=u_k\\ y_j:\,g(y_j)=v_h}}p_X(x_i)p_Y(y_j)=\Bigg[\sum_{x_i:\,f(x_i)=u_k}p_X(x_i)\Bigg]\cdot\Bigg[\sum_{y_j:\,g(y_j)=v_h}p_Y(y_j)\Bigg]=p_U(u_k)\,p_V(v_h).\ \square

Remark. This result should be compared with: events (E,F)(E,F) are independent iff (Ec,F)(E^c,F) are independent iff (E,Fc)(E,F^c) are independent iff (Ec,Fc)(E^c,F^c) are independent.

Consequences for expectations and variances

Lemma. If (X,Y)(X,Y) is independent then X,YX,Y are uncorrelated, i.e. E(XY)=E(X)E(Y)E(XY)=E(X)E(Y).

Proof. E(XY)=∑xi∑yjxiyjpXY(xi,yj)=∑xi∑yjxiyjpX(xi)pY(yj)=∑xixipX(xi)∑yjyjpY(yj)=E(X)E(Y). □E(XY)=\sum_{x_i}\sum_{y_j}x_iy_jp_{XY}(x_i,y_j)=\sum_{x_i}\sum_{y_j}x_iy_jp_X(x_i)p_Y(y_j)=\sum_{x_i}x_ip_X(x_i)\sum_{y_j}y_jp_Y(y_j)=E(X)E(Y).\ \square

Corollary. If (X,Y)(X,Y) is independent then E(f(X)g(Y))=E(f(X))E(g(Y))E(f(X)g(Y))=E(f(X))E(g(Y)) for all f,g:R→Rf,g:\mathbb{R}\to\mathbb{R} (apply the lemma to f(X),g(Y)f(X),g(Y), which are independent by the previous lemma). Example: (X,Y)(X,Y) independent ⇒E(X2Y3)=E(X2)E(Y3)\Rightarrow E(X^2Y^3)=E(X^2)E(Y^3).

Corollary. If (X,Y)(X,Y) is independent then cov(X,Y)=0\mathrm{cov}(X,Y)=0. Proof: cov(X,Y)=E(XY)−E(X)E(Y)=0\mathrm{cov}(X,Y)=E(XY)-E(X)E(Y)=0 (see Covariance and CorrelationThe variance of a sum X + Y equals var(X) + var(Y) + 2 cov(X,Y), where the covariance E((X - E(X))(Y - E(Y))) cannot be computed from the two marginal laws alone, which motivates the study of random vectors and joint behaviour.Covariance and Correlation →).

Corollary. If (X,Y)(X,Y) is independent then var(X+Y)=var(X)+var(Y)\mathrm{var}(X+Y)=\mathrm{var}(X)+\mathrm{var}(Y).

Exercise. Let (X,Y)(X,Y) be independent. Compute var(X−Y)\mathrm{var}(X-Y). Solution: var(X−Y)=var(X)+var(−Y)+2cov(X,−Y)=var(X)+var(Y)\mathrm{var}(X-Y)=\mathrm{var}(X)+\mathrm{var}(-Y)+2\mathrm{cov}(X,-Y)=\mathrm{var}(X)+\mathrm{var}(Y) because cov(X,−Y)=−cov(X,Y)=0\mathrm{cov}(X,-Y)=-\mathrm{cov}(X,Y)=0 and var(−Y)=var(Y)\mathrm{var}(-Y)=\mathrm{var}(Y) (property 4 of covariance with a=1,c=−1a=1,c=-1).

Uncorrelated does not imply independent

WARNING. (X,Y)(X,Y) independent ⇒\Rightarrow (X,Y)(X,Y) uncorrelated, but (X,Y)(X,Y) uncorrelated ⇏\not\Rightarrow (X,Y)(X,Y) independent.

Counterexample. Consider the joint density

pXY(0,1)=pXY(1,0)=pXY(0,−1)=pXY(−1,0)=14p_{XY}(0,1)=p_{XY}(1,0)=p_{XY}(0,-1)=p_{XY}(-1,0)=\frac14

(four points on the axes at distance 11 from the origin, figure). Verify that (X,Y)(X,Y) are uncorrelated but not independent. Verification: pX(−1)=pX(1)=14p_X(-1)=p_X(1)=\frac14, pX(0)=12p_X(0)=\frac12 and the same for YY, so E(X)=E(Y)=0E(X)=E(Y)=0; E(XY)=0E(XY)=0 because on each of the four points at least one coordinate is 00; hence cov(X,Y)=0\mathrm{cov}(X,Y)=0. But pXY(0,0)=0≠pX(0)pY(0)=12⋅12=14p_{XY}(0,0)=0\ne p_X(0)p_Y(0)=\frac12\cdot\frac12=\frac14, so the density does not factorize.

Extension to nn-ples

Definition. The components of the random vector (X1,X2,…,Xn)(X_1,X_2,\dots,X_n) are independent if

pX1…Xn(x1,…,xn)=∏i=1npXi(xi).p_{X_1\dots X_n}(x_1,\dots,x_n)=\prod_{i=1}^np_{X_i}(x_i).

Remark. Compare with the definition of independence for a family {E1,…,En}\{E_1,\dots,E_n\} of events, and explain why the definition for random variables is given only nn at a time instead of kk at a time for k=2,3,…,nk=2,3,\dots,n (the notes leave this as a question; the reason is that summing the factorization over the remaining variables gives the factorization of every sub-family, so the nn-fold identity implies all the kk-fold ones).

Lemma. (X1,…,Xn)(X_1,\dots,X_n) independent ⇒\Rightarrow (Xi,Xj)(X_i,X_j) uncorrelated for all i≠ji\ne j. Proof. E(XiXj)=E(Xi)E(Xj)E(X_iX_j)=E(X_i)E(X_j), indeed all the two-marginals satisfy pXiXj=pXipXjp_{X_iX_j}=p_{X_i}p_{X_j}. □\square

Lemma. (X1,…,Xn)(X_1,\dots,X_n) independent ⇒\Rightarrow var(∑iXi)=∑ivar(Xi)\mathrm{var}\left(\sum_iX_i\right)=\sum_i\mathrm{var}(X_i).

Remark. For var(∑iXi)=∑ivar(Xi)\mathrm{var}(\sum_iX_i)=\sum_i\mathrm{var}(X_i) it is enough that (X1,…,Xn)(X_1,\dots,X_n) are uncorrelated (the covariance matrix of Mean Vector and Covariance MatrixFor a column random vector X the mean vector collects the expectations of the components, the correlation matrix R = E(X X^T) and the covariance matrix Sigma = E((X - mu)(X - mu)^T) = R - mu mu^T are symmetric positive semidefinite, and under Y = A X + b they transform as mu_Y = A mu_X + b and Sigma_Y = A Sigma_X A^T.Mean Vector and Covariance Matrix → is then diagonal).

Versione ripasso

Definition. pXY(xi,yj)=pX(xi)pY(yj)p_{XY}(x_i,y_j)=p_X(x_i)p_Y(y_j) for all (xi,yj)(x_i,y_j); equivalently P([X=xi]∩[Y=yj])=P(X=xi)P(Y=yj)P([X=x_i]\cap[Y=y_j])=P(X=x_i)P(Y=y_j). For nn components: pX1…Xn=∏ipXip_{X_1\dots X_n}=\prod_ip_{X_i} (marginalizing gives every sub-family).

Checks. Table with pX=(0.6,0.3,0.1)p_X=(0.6,0.3,0.1), pY=(0.7,0.3)p_Y=(0.7,0.3) and entries 0.42,0.18,0.21,0.09,0.07,0.030.42,0.18,0.21,0.09,0.07,0.03: independent. Binary (X,Y)(X,Y): independent iff pXY(0,0)pXY(1,1)−pXY(0,1)pXY(1,0)=0p_{XY}(0,0)p_{XY}(1,1)-p_{XY}(0,1)p_{XY}(1,0)=0.

Functions. (X,Y)(X,Y) independent   ⟺  (f(X),g(Y))\iff(f(X),g(Y)) independent for all f,gf,g (sum pXY=pXpYp_{XY}=p_Xp_Y over preimages).

Consequences.

  • E(XY)=E(X)E(Y)E(XY)=E(X)E(Y), and E(f(X)g(Y))=E(f(X))E(g(Y))E(f(X)g(Y))=E(f(X))E(g(Y)) (e.g. E(X2Y3)=E(X2)E(Y3)E(X^2Y^3)=E(X^2)E(Y^3));
  • cov(X,Y)=0\mathrm{cov}(X,Y)=0;
  • var(X+Y)=var(X)+var(Y)\mathrm{var}(X+Y)=\mathrm{var}(X)+\mathrm{var}(Y), and var(X−Y)=var(X)+var(Y)\mathrm{var}(X-Y)=\mathrm{var}(X)+\mathrm{var}(Y);
  • nn independent: pairs uncorrelated, var(∑Xi)=∑var(Xi)\mathrm{var}(\sum X_i)=\sum\mathrm{var}(X_i) (uncorrelated is enough for the variance).

WARNING. Independent ⇒\Rightarrow uncorrelated, not the converse. Counterexample: mass 14\frac14 at (0,1),(1,0),(0,−1),(−1,0)(0,1),(1,0),(0,-1),(-1,0): E(X)=E(Y)=E(XY)=0E(X)=E(Y)=E(XY)=0 but pXY(0,0)=0≠14=pX(0)pY(0)p_{XY}(0,0)=0\ne\frac14=p_X(0)p_Y(0).

Typical mistakes. Checking factorization on a few cells only (it must hold for all pairs, including cells of zero probability); concluding independence from cov=0\mathrm{cov}=0; writing var(X−Y)=var(X)−var(Y)\mathrm{var}(X-Y)=\mathrm{var}(X)-\mathrm{var}(Y).

Teoria collegata