ch 4. random variables and expectations

원준식·2022년 9월 19일

링크텍스트

위 강의를 듣고 정리하는 글입니다.


random variable(확률변수): a function from sample space to (real) number

RV

  1. continuous RV
  2. Discrete RV

cumulative distribution function(cdf, 누적 분포 함수) of RV XX

F(x)=P(Xx)F(x) = P(X≤x)




4.2 types of RV

1. Discrete RV

probability mass function(pmf): PX(a)=P(X=a)P_X(a) = P(X=a)

ΣiP(xi)=1Σ_iP(x_i)=1

2. Continuous RV

probability density function(pdf): f(x)=dF(x)dxf(x)=\frac{dF(x)}{dx} (cdf를 미분한 것)

P(a<Xb)=abf(x)dxP(a<X≤b)=∫^b_af(x)dxf(x)f(x)는 확률이 아니고 확률 밀도임!

P(X=a)=0P(X=a)=0




4.3 jointly distributed random variables

joint cumulative distribution function(joint cdf) FXY(x,y)=P(Xx,Yy)F_{XY}(x,y)=P(X≤x, Y≤y)

marginal cdf FX(x)=P(Xx)=P(Xx,Y)=FXY(x,)F_{X}(x)=P(X≤x) = P(X≤x, Y≤∞) = F_{XY}(x,∞)

FY(y)=FXY(,y)F_Y(y)=F_{XY}(∞,y)

  • 만약 X, Y가 discrete RV라면
    • joint pmf P(xi,yi)=P(X=xi,Y=yi)P(x_i, y_i)=P(X=x_i, Y=y_i)
    • marginal pmf P(xi)=ΣjP(xi,yj)P(x_i)=Σ_jP(x_i, y_j), P(yi)=ΣjP(xj,yi)P(y_i)=Σ_jP(x_j, y_i)
      • joint pmf를 알면 marginal pmf를 구할 수 있겠지
      • marginal pmf를 알면 joint pmf를 구할 수 있나? → X, Y가 independent해야만 구하는게 가능하겠지
  • 만약 X, Y가 contiuous RV라면
    • joint pdf fXY(x,y)=2F(x,y)xyf_{XY}(x,y) = \frac{∂^2F(x,y)}{∂x∂y}F(a,b)=baf(x,y)dxdyF(a, b)=∫^b_{-∞}∫^a_{-∞}f(x, y)dxdy
    • marginal pdf fX(x)=f(x,y)dyf_X(x)=∫^∞_{-∞}f(x, y)dy, fY(y)=f(x,y)dxf_Y(y)=∫^∞_{-∞}f(x, y)dx

4.3.1 independent random variables

FXY(a,b)=FX(a)FY(b)  for  all a, bF_{XY}(a,b) = F_X(a)F_Y(b)\ \ for \ \ all \ a,\ b

joint cdf가 marginal cdf의 곱으로 표현이 될 때 두 RV XXYY는 independent

  • discrete RV
    • PXY(x,y)=PX(x)PY(y)P_{XY}(x,y)=P_X(x)P_Y(y)
  • continuous RV
    • fXY(x,y)=fX(x)fY(y)f_{XY}(x,y)=f_X(x)f_Y(y)

4.3.2 conditional distributions

  • discrete RV
    • conditional pmf PXY(xy)=P(X=xY=y)=P(X=x,Y=y)P(Y=y)=P(x,y)PY(y)P_{X|Y}(x|y)=P(X=x|Y=y)=\frac{P(X=x, Y=y)}{P(Y=y)} = \frac{P(x, y)}{P_Y(y)}
  • continuous RV
    • conditional pdf fXY(xy)=fXY(x,y)fY(y)f_{X|Y}(x|y) = \frac{f_{XY}(x, y)}{f_Y(y)}




4.4 expectation

mean of X

expectation of X

E[X]=ixiP(X=xi)E[X]= \sum_ix_iP(X=x_i)
E[X]=xfX(x)dx=limxP(x<X<x+dx)E[X]= \int^\infty_{-\infty}xf_X(x)dx = \lim\sum xP(x<X<x+dx)

discrete RV XX에 대하여 P(X=xi)=PiP(X=x_i)=P_i(i=1,2,,ni=1,2,…,n)라고 했을 때

xix_i의 정보의 양(Amount of information of xix_i) = log21Pi\log_2\frac{1}{P_i}

RV XX의 평균 information(Entropy) H(X)=i=1nPilog21PiH(X)=\sum^n_{i=1}P_i\log_2\frac{1}{P_i}




4.5 properties of the expected value

E[aX+b]=aE[X]+bE[aX+b] = aE[X]+b

E[Xn]E[X^n] = nth moment of XX

4.5.1 expected value of sums of random variables

E[aX+bY]=aE[X]+bE[Y]E[aX+bY] = aE[X]+bE[Y]

어떤 RV의 값을 그것의 mean(µ)으로 예측하면 mean square error(MSE, prediction의 오류의 제곱의 평균)가 최소가 된다.

증명)

c=prediction of Xc=prediction\ of\ X

µ=E[X]µ=E[X]

E[(Xc)2]=E[(Xµ+µc)2]=E[(Xµ)2]+(µc)2E[(Xµ)2]E[(X-c)^2] = E[(X-µ+µ-c)^2] = E[(X-µ)^2] + (µ-c)^2 ≥ E[(X-µ)^2]




4.6 variance

E[X]=µE[X]=µ
Var(X)=E[(Xµ)2]=E[X2]µ2Var(X)=E[(X-µ)^2] = E[X^2]-µ^2




4.7 covariance and variance of sums of RVs

RV가 여러 개 있을 때 그것들의 합의 분포에 관심이 많게 됨

일반적으로는 Var(X+Y)Var(X)+Var(Y)Var(X+Y) ≠ Var(X) + Var(Y)

그럼 합의 variance는 어떻게 되니? → covariance

covariance of XX and YY

Cov(X,Y)=E[(XµX)(YµY)]Cov(X, Y) = E[(X-µ_X)(Y-µ_Y)]
=E[XYµXYµYX+µXµY]= E[XY - µ_XY-µ_YX+µ_Xµ_Y]
=E[XY]µXµYµXµY+µXµY= E[XY]-µ_Xµ_Y-µ_Xµ_Y+µ_Xµ_Y
=E[XY]E[X]E[Y]= E[XY] - E[X]E[Y]
  • E[XY]=E[X]E[Y]E[XY]=E[X]E[Y]이면 XX and YY are uncorrelated(Cov(X,Y)=0Cov(X,Y)=0)
  • XX and YY are independent → XX and YY are uncorrelated

correlation of XX and YY = E[XY]E[XY]


correlation coefficient of XX and YY = Cov(X,Y)Var(X)Var(Y)\frac{Cov(X, Y)}{\sqrt{Var(X)Var(Y)}}


Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)




4.8 moment generating functions(MGF)

Φ(t)=E[etx]=xetxp(x)Φ(t)=E[e^{tx}] = \sum_xe^{tx}p(x)
Φ(t)=E[etx]=infinfetxf(x)dxΦ(t)=E[e^{tx}] = \int^{\inf}_{-\inf}e^{tx}f(x)dx
Φ(t)=ddtE[etx]=E[ddtetx]=E[xetx]Φ'(t)= \frac{d}{dt}E[e^{tx}] = E[\frac{d}{dt}e^{tx}] = E[xe^{tx}]
Φ(0)=E[x]Φ'(0)= E[x]

MGF를 알면 E[x]E[x] 구하기가 쉬움. MGF 미분해서 0 넣으면 됨.(pdf의 경우 E[x]E[x]를 구하기 위해 적분을 해야 하지만 MGF는 미분을 하면 됨 → 일반적으로 적분보다 미분이 쉬움)




4.9 Chebyshev’s inequality and the weak law of large numbers

Markov’s inequality

XX is a positive RV, a>0일 때

P(X>a)<=E[x]aP(X>a) <= \frac{E[x]}{a}

E[x]E[x]는 분포에 대해 많은 것을 이야기해 주는구나

증명)

E[x]=0infxf(x)dx=0axf(x)dx+ainfxf(x)dxE[x] = \int^{\inf}_0xf(x)dx = \int^a_0xf(x)dx + \int^{\inf}_axf(x)dx
>=ainfxf(x)dx>=ainfaf(x)dx=aainff(x)dx=aP(X>a)>= \int^{\inf}_axf(x)dx >= \int^{\inf}_aaf(x)dx = a\int^{\inf}_af(x)dx = aP(X>a)

Chebyshev’s inequality

E[x]=µE[x] = µ, Var(X)=σ2Var(X)=σ^2

P(Xµ>=k)<=σ2k2P(|X-µ| >= k) <= \frac{σ^2}{k^2}

증명)

Markov’s inequality에서 XX 대신 (Xµ)2(X-µ)^2을 넣어주고, aa 대신 k2k^2을 넣어주면 됨


The weak law of large numbers

X1,XnX_1, … X_n: iid(independent and identically distributed, 독립이고 분포가 같은) RVs

분포가 모두 같으니 E[Xi]=µE[X_i] = µ

임의의 ε>0ε>0에 대하여

limn>infP(X1+...+Xnnµ>ε)=0\lim_{n->\inf}P(|\frac{X_1 + ... + X_n}{n}- µ| > ε)=0

0개의 댓글