stat 712 fa 2021 lec 9 slides conditional distributions

49
STAT 712 fa 2021 Lec 9 slides Conditional distributions, independence Karl B. Gregory University of South Carolina These slides are an instructional aid; their sole purpose is to display, during the lecture, definitions, plots, results, etc. which take too much time to write by hand on the blackboard. They are not intended to explain or expound on any material. Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 1 / 39

Upload: others

Post on 13-Nov-2021

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: STAT 712 fa 2021 Lec 9 slides Conditional distributions

STAT 712 fa 2021 Lec 9 slides

Conditional distributions, independence

Karl B. Gregory

University of South Carolina

These slides are an instructional aid; their sole purpose is to display, during the lecture,definitions, plots, results, etc. which take too much time to write by hand on the blackboard.

They are not intended to explain or expound on any material.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 1 / 39

Page 2: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

1 Conditional pmfs and pdfs

2 Conditional pmfs and pdfs

3 Independence of random variables

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 2 / 39

Page 3: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Conditional probability mass functionsLet (X ,Y ) be discrete rvs with joint pmf p and marginal pmfs pX and pY .

For any y such that pY (y) > 0, the conditional pmf of X |Y = y is

p(x |y) = p(x , y)

pY (y), x 2 R.

Likewise the conditional pmf of Y |X = x .

Exercise: Show that p(x |y) is a valid pmf.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 3 / 39

Plum Papi if

PLAN HIP

undPlan E PEI Pi L

Page 4: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Let X = sum of two dice rolls, Y = max.

Y

X

1 2 3 4 5 6 pX (x)2 1/36 1/36

3 2/36 2/36

4 1/36 2/36 3/36

5 2/36 2/36 4/36

6 1/36 2/36 2/36 5/36

7 2/36 2/36 2/36 6/36

8 1/36 2/36 2/36 5/36

9 2/36 2/36 4/36

10 1/36 2/36 3/36

11 2/36 2/36

12 1/36 1/36

pY (y) 1/36 3/36 5/36 7/36 9/36 11/36

Exercise: Tabulate p(x |y = 4) and p(y |x = 7).

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 4 / 39

Page 5: STAT 712 fa 2021 Lec 9 slides Conditional distributions

mail.EE

Page 6: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Conditional probability density functionsLet (X ,Y ) be continuous rvs with joint pdf f and marginal pdfs fX and fY .

For any y such that fY (y) > 0, the conditional pdf of X |Y = y is

f (x |y) = f (x , y)

fY (y), x 2 R.

Likewise the conditional pdf of Y |X = x .

Exercise: Show that f (x |y) is a valid pdf.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 5 / 39

Stunde S tja E e

Page 7: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Exercise: Let (X ,Y ) ⇠ f (x , y) = y(1 � x)y�1e�y1(0 < x < 1, 0 < y < 1).

1 Find the pdf f (x |y) of X given Y = y .

2 Find P(X < 1/2|Y = 2).

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 6 / 39

Öffne dx z 1 e da

2

Sylt yci nidx yef.li x da

il

Page 8: STAT 712 fa 2021 Lec 9 slides Conditional distributions

fc

fly Ily o

Fur y 10

SGly tfly

Ytt ÄjoyFor y o

f x y y 1 x I omas

Page 9: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

x

y

0.0 0.2 0.4 0.6 0.8 1.0

0.5

1.0

1.5

2.0

0.0 0.2 0.4 0.6 0.8 1.00

24

68

x

f(x|y)

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 7 / 39

f x

Page 10: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Exercise: Let (X ,Y ) have joint pdf given by

f (x , y) =1

2⇡x�3/2 exp

� 1

2x(y2 + 1)

�1(0 < x < 1,�1 < y < 1).

1 Find the conditional pdf f (y |x) of Y given X = x .

2 Find P(Y > 1|X = 4).

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 8 / 39

Y X 4 Normal o E 4

Ayla Öflat JE er E dy

Page 11: STAT 712 fa 2021 Lec 9 slides Conditional distributions

erf ft er E d

heul t for x so

t.IE

L E

Idf of Normal o o

Page 12: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

x

y

0.0 0.5 1.0 1.5 2.0

−4−2

02

4

−4 −2 0 2 40.0

0.5

1.0

1.5

y

f(y|x)

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 9 / 39

Ja

Page 13: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Exercise: Let (U,V ) be a pair of rvs with joint pdf given by

f (u, v) = 6(v � u)1(0 < u < v < 1).

1 Find the conditional pdf f (u|v) of U given V = v .

2 Find P(U < 1/4|V = 1/2).

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 10 / 39

Hutu tfy.GEo f jo

C 56mn ru E 1 b i

A

Page 14: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Conditional expectationLet (X ,Y ) be discrete or continuous rvs on X and Y and g : R2 ! R.

For any y 2 Y, the conditional expectation of g(X ) given Y = y is

E[g(X )|Y = y ] =

8>>><

>>>:

X

x2Xg(x) · p(x |y) for (X ,Y ) discrete

Z

Rg(x) · f (x |y) for (X ,Y ) continuous

The conditional expectation E[g(Y )|X = x ] is likewise defined.

Note that E[g(X )|Y = y ] is a function of y , since X is summed/integrated out.

We often have g(x) = x , so that we consider E[X |Y = y ].

If we write E[X |Y ], without specifying a value y for Y , then E[X |Y ] is a rv.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 12 / 39

ÖSE__g_

de

Ifffunction of Y z

Page 15: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Exercise: Let (U,V ) be a pair of rvs with joint pdf given by

f (u, v) = 6(v � u)1(0 < u < v < 1).

1 Find E[U|V = v ].2 Find E[U|V = 1/2].

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 13 / 39

a

U Er

ECU V Gu teatr duR L

aufjdaK

Page 16: STAT 712 fa 2021 Lec 9 slides Conditional distributions

u EE du

ur ne du

zu t t

EU V ju

EL U K 5 E J

Page 17: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Conditional varianceThe conditional variance of X given that Y = y is

Var[X |Y = y ] = E[(X � E[X |Y = y ])2|Y = y ].

If we write Var[X |Y ], without specifying a value y for Y , then Var[X |Y ] is a rv.

Useful expression: Var[X |Y ] = E[X 2|Y ]� (E[X |Y ])2

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 14 / 39

Vor X E G Ex

e

VarX EX Ex

Page 18: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Exercise: Let (X ,Y ) ⇠ f (x , y) = y(1 � x)y�1e�y1(0 < x < 1, 0 < y < 1).

1 Find E[X |Y = y ].2 Find Var[X |Y = y ].3 Find Var[X |Y = 2].

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 15 / 39

f x y y 1 I omas

EEX Y x f xl dx

R

x y 1 x dx0

Page 19: STAT 712 fa 2021 Lec 9 slides Conditional distributions

y f ölen dx

12 Y

iii

Beta az ß

Play 1 PC D

Dir

EffektX Y It

Vor X D ELI E EE

EIL 4 i y r da

y x in da

es

Page 20: STAT 712 fa 2021 Lec 9 slides Conditional distributions

iiiElf 4 4 III

V Lx in yt

Et

Gti

Ii iiiyt

Page 21: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Conditional pmfs and pdfs

Exercise: Let (X ,Y ) have joint pdf given by

f (x , y) =1

2⇡x�3/2 exp

� 1

2x(y2 + 1)

�1(0 < x < 1,�1 < y < 1).

1 Find E[Y |X = x ].2 Find Var[Y |X = x ].3 Find Var[Y |X = 2].

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 16 / 39

Y X x Normal o EO

X

2

Page 22: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

1 Conditional pmfs and pdfs

2 Conditional pmfs and pdfs

3 Independence of random variables

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 17 / 39

A B E B

PLANB PLA PCB

if A B are

independent

Page 23: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

On (S ,B,P), independence of events A,B 2 B is the property that

P(A \ B) = P(A)P(B).

Independence of random variablesTwo rvs X and Y are independent if

P(X 2 A,Y 2 B) = P(X 2 A)P(Y 2 B) for all A,B 2 B(R).

We sometimes write X ?? Y to express that X and Y are independent.

Basically: If all pairs of events concerning X and Y are independent, then X ?? Y .

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 18 / 39

II

Page 24: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Theorem (Independence iff joint is product of marginals)

If (X ,Y ) discrete with joint pmf p and marginal pmfs pX and pY , then

X ?? Y () p(x , y) = pX (x)pY (y) for all (x , y) 2 R2.

If (X ,Y ) continuous with joint pdf f and marginal pdfs fX and fY , then

X ?? Y () f (x , y) = fX (x)fY (y) for all (x , y) 2 R2.

Check independence by checking whether the joint is the product of the marginals.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 19 / 39

PLAY P X P Y for all E er

At

Page 25: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Suppose there are six chairs in a circle numbered 1, . . . , 6. Then:

1 Let X be the roll of a die and sit in chair X .

2 Roll die again and move that many chairs clockwise.

3 Let Y be the number of the chair in which you now sit.

Are X and Y independent?

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 20 / 39

Page 26: STAT 712 fa 2021 Lec 9 slides Conditional distributions
Page 27: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let X and Y be independent rvs with marginal pmfs given by

px(x) = px(1 � p)1�x · 1(x 2 {0, 1})

pY (y) =

✓3

y

◆⌘y (1 � ⌘)3�y · 1(y 2 {0, 1, 2, 3})

Give the joint pmf of the rv pair (X ,Y ).

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 21 / 39

2 X EGO13 y 69011_2,7

1 VETOZLYEEO.bz

O O W

play FCI p Y 1 y ICKE 0,13 yo 0.1.2.3

Page 28: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) be a pair of rvs with joint pdf given by

f (x , y) =6

5[1 � (x � y)2] · 1(0 < x < 1, 0 < y < 1).

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 22 / 39

f G I x2 zu y dy

G y Ey xy

Page 29: STAT 712 fa 2021 Lec 9 slides Conditional distributions

G l x t x d

July G I y t y f

Ayla fyly G i x t x g

1 y t y f

X Y

Page 30: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let X1 and X2 be independent rvs with the Exponential(1) distribution.

1 Give the joint pdf of (X1,X2)2 Find P(X2 < X1 < 2X2).

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 23 / 39

Jf e Ala

Ix a e I x o

ftp.x e E I x so x o

P x x 2xÖ i dx den

Kz

Page 31: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Theorem (Easier independence check)Let (X ,Y ) be discrete or continuous rvs with joint pmf p or joint pdf f .

Then X ?? Y () there exist functions g and h such that

p(x , y) = g(x)h(y) for all (x , y) 2 R2 or

f (x , y) = g(x)h(y) for all (x , y) 2 R2, respectively.

Check if the joint is the product of a function of just x and a function of just y .

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 24 / 39

Page 32: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) have the joint pdf

f (x , y) = 48xy(y � xy) · 1(0 < x < 1, 0 < y < 1).

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 25 / 39

f x Ö X 1 X 1 omas y ICocyca

TEEtu j.org

Page 33: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Annika

f x yX 1 I love a

Tacocycafltx de fix in de Blau FEI t

Sitcowaffydy 34 L

Page 34: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) be a pair of rvs with joint pdf given by

f (x , y) =6

5[1 � (x � y)2] · 1(0 < x < 1, 0 < y < 1).

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 26 / 39

I Itu

f a 8Mt µ

Page 35: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) be a pair of rvs with joint pdf given by

f (x , y) =1

8(x + y) · 1(0 < x < 2, 0 < y < 2).

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 27 / 39

hlu NO

Page 36: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) have the joint pdf

f (x , y) =1

4⇡exp

�x2 + y2 � 2x + 1

4

�for all x , y 2 R.

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 28 / 39

Jun yep E er FEIT

Page 37: STAT 712 fa 2021 Lec 9 slides Conditional distributions

i

TE TE

Page 38: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) be a pair of rvs with joint pdf given by

f (x , y) = y(1 � x)y�1e�y1(0 < x < 1, 0 < y < 1)

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 29 / 39

Page 39: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) be a pair of rvs with joint pdf given by

f (x , y) =1

2⇡x�3/2 exp

� 1

2x(y2 + 1)

�1(0 < x < 1,�1 < y < 1)

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 30 / 39

6

Page 40: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (X ,Y ) be a pair of rvs with joint pdf given by

f (x , y) = 4xy · 1(0 < x < 1, 0 < y < 1).

Check whether X and Y are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 31 / 39

Yes

Page 41: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let (U,V ) be a pair of rvs with joint pdf given by

f (u, v) = 6(v � u)1(0 < u < v < 1).

Check whether U and V are independent.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 32 / 39

9

Page 42: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Theorem (Expectation of the product of independent rvs)Let X and Y be independent rvs. Then

EXY = EXEY .

Moreover, for any functions g : R ! R and h : R ! R,

Eg(X )h(Y ) = Eg(X )Eh(Y ).

Exercise: Prove the result.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 33 / 39

xy x.y.tydxdy ffx y.fm fylysdxdyR R IR fpxfxlxdx

fpytykdyEXEY.sn

Page 43: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let X and Y be independent rvs with marginal pdfs

fX (x) = 2e�2x1(x > 0)

fY (y) = e�2|y |1(�1 < y < 1)

Find EXY 2.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 34 / 39

X Expon E

EX L

EttaE XY EX EY

Page 44: STAT 712 fa 2021 Lec 9 slides Conditional distributions

EY Ii dy8

2 yie dytf.pe

D

n 24

2 ie dy

fügenE drin

I Iii du

El XY EXEY E L

Page 45: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let X and Y be independent rvs such that

X ⇠ Beta(3, 4)

Y ⇠ Beta(1, 2)

Find E[XY ].

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 35 / 39

Wer Beta L ß

Elw Ep

El XY EY EY Int1 2

Page 46: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Theorem (mgf of a sum of independent random variables)If X and Y are indep. rvs with mgfs MX and MY , the mgf of V = X + Y is

MV (t) = MX (t)MY (t)

for all t at which MX (t) and MY (t) are defined.

Exercise: Prove the result.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 36 / 39

SEE

ME EE E El et et Es EetMit My It

Page 47: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let X and Y be independent rvs such that

X ⇠ Binomial(n, p)

Y ⇠ Binomial(m, p)

Find the distribution of U = X + Y .

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 37 / 39

P U o p x o Y o

P U PLX c Y o

PLY 1 X

8

Mu t Mylady t pet r pet in

pet I p

Iff Binomial htm

Page 48: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let X and Y be independent rvs such that

X ⇠ Normal(µX ,�2X )

Y ⇠ Normal(µY ,�2Y )

Find the distribution of U = X + Y .

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 38 / 39

Multi Mit Myltent

Eth entGeil

ehxtm.tttE

EkmoPofNMxtMy Eto

Page 49: STAT 712 fa 2021 Lec 9 slides Conditional distributions

Independence of random variables

Exercise: Let X1 and X2 be independent rvs such that

X1 ⇠ Poisson(�1)

X2 ⇠ Poisson(�2)

Find the distribution of Y = X1 + X2.

Karl B. Gregory (U. of South Carolina) STAT 712 fa 2021 Lec 9 slides 39 / 39

Myt