16: continuous joint distributions - stanford university3 continuous joint distributions...

Post on 06-Jul-2020

10 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

16: Continuous Joint DistributionsLisa Yan

May 11, 2020

1

Lisa Yan, CS109, 2020

Quick slide reference

2

3 Continuous joint distributions 16a_cont_joint

18 Joint CDFs 16b_joint_CDF

23 Independent continuous RVs 16c_indep_cont_rvs

28 Multivariate Gaussian RVs 16d_sum_normal

32 Exercises LIVE

59 Extra: Double integrals 16f_extra

Continuous joint distributions

3

16a_cont_joint

Lisa Yan, CS109, 2020

Remember target?

4

Good times…

Lisa Yan, CS109, 2020

CS109 logo with darts

5

Quick check: What is the probability that a dart

hits at (456.2344132343, 532.1865739012)?

The CS109 logo was created by throwing 500,000 darts according to a joint distribution.

If we throw another dart according to the same distribution, what is

P(dart hits within π‘Ÿ pixels of center)?

Lisa Yan, CS109, 2020

CS109 logo with darts

6

1 pixel = 1 dart thrown

at screen

Possible dart counts (in 100x100 boxes)

P(dart hits within π‘Ÿ pixels of center)?

Lisa Yan, CS109, 2020

CS109 logo with darts

7

Possible dart counts (in 50x50 boxes)

P(dart hits within π‘Ÿ pixels of center)?

Lisa Yan, CS109, 2020

CS109 logo with darts

8

Possible dart counts(in infinitesimally small boxes)

P(dart hits within π‘Ÿ pixels of center)?

Lisa Yan, CS109, 2020

Continuous joint probability density functions

If two random variables 𝑋 and π‘Œ are jointly continuous, then there exists a joint probability density function 𝑓𝑋,π‘Œ defined over βˆ’βˆž < π‘₯, 𝑦 < ∞ such that:

𝑃 π‘Ž1 ≀ 𝑋 ≀ π‘Ž2, 𝑏1≀ π‘Œ ≀ 𝑏2 = ΰΆ±π‘Ž1

π‘Ž2

ࢱ𝑏1

𝑏2

𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑𝑦 𝑑π‘₯

9

Lisa Yan, CS109, 2020

From one continuous RV to jointly continuous RVs

Single continuous RV 𝑋

β€’ PDF 𝑓𝑋 such that βˆ’βˆžβˆžπ‘“π‘‹ π‘₯ 𝑑π‘₯ = 1

β€’ Integrate to get probabilities

Jointly continuous RVs 𝑋 and π‘Œ

β€’ PDF 𝑓𝑋,π‘Œ such thatβˆ’βˆžβˆžβˆžβˆ’βˆžπ‘“π‘‹,π‘Œ π‘₯, 𝑦 𝑑𝑦 𝑑π‘₯ = 1

β€’ Double integrate to get probabilities

10

Probability for jointly continuous RVs is volume under a surface.

Probability = area

under curve

Lisa Yan, CS109, 2020

Double integrals without tears

Let 𝑋 and π‘Œ be two continuous random variables.

β€’ Support: 0 ≀ 𝑋 ≀ 1, 0 ≀ π‘Œ ≀ 2.

Is 𝑔 π‘₯, 𝑦 = π‘₯𝑦 a valid joint PDF over 𝑋 and π‘Œ?

Write down the definite double integral that

must integrate to 1:

πŸ€”

Lisa Yan, CS109, 2020

Double integrals without tears

Let 𝑋 and π‘Œ be two continuous random variables.

β€’ Support: 0 ≀ 𝑋 ≀ 1, 0 ≀ π‘Œ ≀ 2.

Is 𝑔 π‘₯, 𝑦 = π‘₯𝑦 a valid joint PDF over 𝑋 and π‘Œ?

Write down the definite double integral that

must integrate to 1:

ࢱ𝑦=0

2

ΰΆ±π‘₯=0

1

π‘₯𝑦 𝑑π‘₯ 𝑑𝑦 = 1 or ΰΆ±π‘₯=0

1

ࢱ𝑦=0

2

π‘₯𝑦 𝑑𝑦 𝑑π‘₯ = 1

(used in next slide)

Lisa Yan, CS109, 2020

Double integrals without tears

Let 𝑋 and π‘Œ be two continuous random variables.

β€’ Support: 0 ≀ 𝑋 ≀ 1, 0 ≀ π‘Œ ≀ 2.

Is 𝑔 π‘₯, 𝑦 = π‘₯𝑦 a valid joint PDF over 𝑋 and π‘Œ?

13

1 = ΰΆ±βˆ’βˆž

∞

ΰΆ±βˆ’βˆž

∞

𝑔 π‘₯, 𝑦 𝑑π‘₯ 𝑑𝑦 = ࢱ𝑦=0

2

ΰΆ±π‘₯=0

1

π‘₯𝑦 𝑑π‘₯ 𝑑𝑦

ࢱ𝑦=0

2

ΰΆ±π‘₯=0

1

π‘₯𝑦 𝑑π‘₯ 𝑑𝑦 = ࢱ𝑦=0

2

𝑦 ΰΆ±π‘₯=0

1

π‘₯ 𝑑π‘₯ 𝑑𝑦 = ࢱ𝑦=0

2

𝑦π‘₯2

20

1

𝑑𝑦 = ࢱ𝑦=0

2

𝑦1

2𝑑𝑦

ࢱ𝑦=0

2

𝑦1

2𝑑𝑦 =

𝑦2

4𝑦=0

2

= 1 βˆ’ 0 = 1

1. Evaluate inside integral by treating 𝑦 as a constant:

2. Evaluate remaining (single) integral:

Yes, 𝑔 π‘₯, 𝑦 is a valid joint PDF

because it integrates to 1.

0. Set up integral:

Lisa Yan, CS109, 2020

Marginal distributions

Suppose 𝑋 and π‘Œ are continuous randomvariables with joint PDF:

The marginal density functions (marginal PDFs) are therefore:

𝑓𝑋 π‘Ž = ΰΆ±βˆ’βˆž

∞

𝑓𝑋,π‘Œ π‘Ž, 𝑦 𝑑𝑦 π‘“π‘Œ 𝑏 = ΰΆ±βˆ’βˆž

∞

𝑓𝑋,π‘Œ π‘₯, 𝑏 𝑑x

14

𝑓𝑋 π‘₯ΰΆ±βˆ’βˆž

∞

ΰΆ±βˆ’βˆž

∞

𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑𝑦 𝑑π‘₯ = 1

Lisa Yan, CS109, 2020

Back to darts!

Match 𝑋 and π‘Œ to their respective marginal PDFs:

15

(top-down)

(side view)

πŸ€”

Lisa Yan, CS109, 2020

Back to darts!

Match 𝑋 and π‘Œ to their respective marginal PDFs:

16

pixel x pixel y

(top-down)

(side view)

Lisa Yan, CS109, 2020

Extra slides

If you want more practice with double integrals,

I’ve included two exercises at the end of this lecture.

17

Joint CDFs

18

16b_joint_cdfs

Lisa Yan, CS109, 2020

An observation: Connecting CDF to PDF

For a continuous random variable 𝑋 with PDF 𝑓, the CDF (cumulative distribution function) is

𝐹 π‘Ž = 𝑃 𝑋 ≀ π‘Ž = ΰΆ±βˆ’βˆž

π‘Ž

𝑓 π‘₯ 𝑑π‘₯

The density 𝑓 is therefore the derivative of the CDF, 𝐹:

𝑓 π‘Ž =𝑑

π‘‘π‘ŽπΉ π‘Ž

19

(Fundamental Theorem

of Calculus)

Lisa Yan, CS109, 2020

Joint cumulative distribution function

For two random variables 𝑋 and π‘Œ, there can be a joint cumulative distribution function 𝐹𝑋,π‘Œ:

𝐹𝑋,π‘Œ π‘Ž, 𝑏 = 𝑃 𝑋 ≀ π‘Ž, π‘Œ ≀ 𝑏

20

For continuous 𝑋 and π‘Œ:

𝐹𝑋,π‘Œ π‘Ž, 𝑏 = ΰΆ±βˆ’βˆž

π‘Ž

ΰΆ±βˆ’βˆž

𝑏

𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑𝑦 𝑑π‘₯

𝑓𝑋,π‘Œ π‘Ž, 𝑏 =πœ•2

πœ•π‘Ž πœ•π‘πΉπ‘‹,π‘Œ π‘Ž, 𝑏

For discrete 𝑋 and π‘Œ:

𝐹𝑋,π‘Œ π‘Ž, 𝑏 =

π‘₯β‰€π‘Ž

𝑦≀𝑏

𝑝𝑋,π‘Œ(π‘₯, 𝑦)

Lisa Yan, CS109, 2020

Single variable CDF, graphically

21

limπ‘₯β†’βˆ’βˆž

𝐹X π‘₯ = 0

limπ‘₯β†’+∞

𝐹𝑋 π‘₯ = 1

𝐹𝑋 π‘₯ = 𝑃 𝑋 ≀ π‘₯𝑓𝑋 π‘₯

Review

Lisa Yan, CS109, 2020

Joint CDF, graphically

22

limπ‘₯,π‘¦β†’βˆ’βˆž

𝐹𝑋,π‘Œ π‘₯, 𝑦 = 0

limπ‘₯,𝑦→+∞

𝐹𝑋,π‘Œ π‘₯, 𝑦 = 1

𝐹𝑋,π‘Œ π‘₯, 𝑦 = 𝑃 𝑋 ≀ π‘₯, π‘Œ ≀ 𝑦𝑓𝑋,π‘Œ π‘₯, 𝑦

Independent Continuous RVs

23

16c_indep_cont_rvs

Lisa Yan, CS109, 2020

Independent continuous RVs

Two continuous random variables 𝑋 and π‘Œ are independent if:

𝑃 𝑋 ≀ π‘₯, π‘Œ ≀ 𝑦 = 𝑃 𝑋 ≀ π‘₯ 𝑃 π‘Œ ≀ 𝑦

Equivalently:

𝐹𝑋,π‘Œ π‘₯, 𝑦 = 𝐹𝑋 π‘₯ πΉπ‘Œ 𝑦𝑓𝑋,π‘Œ π‘₯, 𝑦 = 𝑓𝑋 π‘₯ π‘“π‘Œ 𝑦

Proof of PDF:

24

𝑓𝑋,π‘Œ π‘₯, 𝑦 =πœ•2

πœ•π‘₯ πœ•π‘¦πΉπ‘‹,π‘Œ π‘₯, 𝑦 =

πœ•2

πœ•π‘₯ πœ•π‘¦πΉπ‘‹ π‘₯ πΉπ‘Œ 𝑦

=πœ•

πœ•π‘₯

πœ•

πœ•π‘¦πΉπ‘‹ π‘₯ πΉπ‘Œ 𝑦

= 𝑓𝑋 π‘₯ π‘“π‘Œ 𝑦

=πœ•

πœ•π‘₯𝐹𝑋 π‘₯

πœ•

πœ•π‘¦πΉπ‘Œ 𝑦

βˆ€π‘₯, 𝑦

βˆ€π‘₯, 𝑦

Lisa Yan, CS109, 2020

Independent continuous RVs

Two continuous random variables 𝑋 and π‘Œ are independent if:

𝑃 𝑋 ≀ π‘₯, π‘Œ ≀ 𝑦 = 𝑃 𝑋 ≀ π‘₯ 𝑃 π‘Œ ≀ 𝑦

Equivalently:

𝐹𝑋,π‘Œ π‘₯, 𝑦 = 𝐹𝑋 π‘₯ πΉπ‘Œ 𝑦𝑓𝑋,π‘Œ π‘₯, 𝑦 = 𝑓𝑋 π‘₯ π‘“π‘Œ 𝑦

More generally, 𝑋 and π‘Œ are independent if joint density factors separately:

𝑓𝑋,π‘Œ π‘₯, 𝑦 = 𝑔 π‘₯ β„Ž 𝑦 , where βˆ’βˆž < π‘₯, 𝑦 < ∞

25

Lisa Yan, CS109, 2020

Pop quiz! (just kidding)

Are 𝑋 and π‘Œ independent in the following cases?

26

independent

𝑋 and π‘Œ

𝑓𝑋,π‘Œ π‘₯, 𝑦 = 𝑔 π‘₯ β„Ž 𝑦 ,

where βˆ’βˆž < π‘₯, 𝑦 < ∞

1. 𝑓𝑋,π‘Œ π‘₯, 𝑦 = 6π‘’βˆ’3π‘₯π‘’βˆ’2𝑦

where 0 < π‘₯, 𝑦 < ∞

2. 𝑓𝑋,π‘Œ π‘₯, 𝑦 = 4π‘₯𝑦where 0 < π‘₯, 𝑦 < 1

3. 𝑓𝑋,π‘Œ π‘₯, 𝑦 = 24π‘₯𝑦where 0 < π‘₯ + 𝑦 < 1

πŸ€”

Lisa Yan, CS109, 2020

Pop quiz! (just kidding)

Are 𝑋 and π‘Œ independent in the following cases?

27

1. 𝑓𝑋,π‘Œ π‘₯, 𝑦 = 6π‘’βˆ’3π‘₯π‘’βˆ’2𝑦

where 0 < π‘₯, 𝑦 < ∞

2. 𝑓𝑋,π‘Œ π‘₯, 𝑦 = 4π‘₯𝑦where 0 < π‘₯, 𝑦 < 1

3. 𝑓𝑋,π‘Œ π‘₯, 𝑦 = 24π‘₯𝑦where 0 < π‘₯ + 𝑦 < 1

𝑔 π‘₯ = 3π‘’βˆ’3π‘₯

β„Ž 𝑦 = 2π‘’βˆ’2𝑦

𝑔 π‘₯ = 2π‘₯β„Ž 𝑦 = 2𝑦

Cannot capture constraint on π‘₯ + 𝑦into factorization!

❌

βœ…

βœ…

independent

𝑋 and π‘Œ

𝑓𝑋,π‘Œ π‘₯, 𝑦 = 𝑔 π‘₯ β„Ž 𝑦 ,

where βˆ’βˆž < π‘₯, 𝑦 < ∞

Separable functions:

Separable functions:

If you can factor densities over all of the

support, you have independence.

Bivariate Normal Distribution

28

16d_bivariate_normal

Lisa Yan, CS109, 2020

Bivariate Normal Distribution

𝑋1 and 𝑋2 follow a bivariate normal distribution if their joint PDF 𝑓 is

𝑓 π‘₯1, π‘₯2 =1

2πœ‹πœŽ1𝜎2 1 βˆ’ 𝜌2π‘’βˆ’

12 1βˆ’πœŒ2

π‘₯1βˆ’πœ‡12

𝜎12 βˆ’

2𝜌 π‘₯1βˆ’πœ‡1 π‘₯2βˆ’ πœ‡2𝜎1𝜎2

+π‘₯2βˆ’πœ‡2

2

𝜎22

Can show that 𝑋1~𝒩 πœ‡1, 𝜎12 , 𝑋2~𝒩 πœ‡2, 𝜎2

2

Often written as: 𝑿~𝒩(𝝁, 𝚺)β€’ Vector 𝑿 = 𝑋1, 𝑋2

β€’ Mean vector 𝝁 = πœ‡1, πœ‡2 , Covariance matrix: 𝚺 =𝜎12 𝜌𝜎1𝜎2

𝜌𝜎1𝜎2 𝜎22

29

We will focus on understanding the

shape of a bivariate Normal RV.Recall correlation: 𝜌 =

Cov 𝑋1,𝑋2

𝜎1𝜎2

(Ross chapter 6, example 5d)

Lisa Yan, CS109, 2020

Back to darts

30

(top-down)

(side view)

These darts were actually thrown according

to a bivariate normal distribution:

𝝁 = 450, 600

𝚺 =9002/4 0

0 9002/25𝑋, π‘Œ ~𝒩 𝝁, 𝚺

pixel x pixel y

Marginal

PDFs:𝑋~𝒩 450,

9002

4π‘Œ~𝒩 600,

9002

25

Lisa Yan, CS109, 2020

A diagonal covariance matrix

Let 𝑿 = 𝑋1, 𝑋2 follow a bivariate normal distribution 𝑿~𝒩(𝝁, 𝚺), where

𝝁 = πœ‡1, πœ‡2 , 𝚺 =𝜎12 0

0 𝜎22

Are 𝑋1 and 𝑋2 independent?

31

βœ…

𝑓 π‘₯1, π‘₯2 =1

2πœ‹πœŽ1𝜎2 1 βˆ’ 𝜌2π‘’βˆ’

12 1βˆ’πœŒ2

π‘₯1βˆ’πœ‡12

𝜎12 βˆ’

2𝜌 π‘₯1βˆ’πœ‡1 π‘₯2βˆ’ πœ‡2𝜎1𝜎2

+π‘₯2βˆ’πœ‡2

2

𝜎22

=1

2πœ‹πœŽ1𝜎2π‘’βˆ’12

π‘₯1βˆ’πœ‡12

𝜎12 +

π‘₯2βˆ’πœ‡22

𝜎22

(Note covariance: 𝜌𝜎1𝜎2 = 0)

=1

𝜎1 2πœ‹π‘’βˆ’ π‘₯1βˆ’πœ‡1

2/2𝜎12 1

𝜎2 2πœ‹π‘’βˆ’ π‘₯2βˆ’πœ‡2

2/2𝜎22

𝑋1 and 𝑋2 are independent

with marginal distributions

𝑋1~𝒩 πœ‡1 𝜎12 , 𝑋2~𝒩(πœ‡2 𝜎2

2)

(live)16: Continuous Joint Distributions (I)Slides by Lisa Yan

July 24, 2020

32

Lisa Yan, CS109, 2020

Jointly continuous RVs

𝑋 and π‘Œ are jointly continuous if they have a joint PDF:

𝑓𝑋,π‘Œ π‘₯, 𝑦 such that ΰΆ±βˆ’βˆž

∞

ΰΆ±βˆ’βˆž

∞

𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑𝑦 𝑑π‘₯ = 1

Most things we’ve learned about discrete joint distributions translate:

33

Marginal

distributions𝑓𝑋 π‘Ž = ΰΆ±

βˆ’βˆž

∞

𝑓𝑋,π‘Œ π‘Ž, 𝑦 𝑑𝑦

Independent RVs 𝑝𝑋,π‘Œ π‘₯, 𝑦 = 𝑝𝑋 π‘₯ π‘π‘Œ 𝑦 𝑓𝑋,π‘Œ π‘₯, 𝑦 = 𝑓𝑋 π‘₯ π‘“π‘Œ 𝑦

𝑝𝑋 π‘Ž =

𝑦

𝑝𝑋,π‘Œ π‘Ž, 𝑦

Expectation

(e.g., LOTUS)𝐸 𝑔 𝑋, π‘Œ =

π‘₯

𝑦

𝑔 π‘₯, 𝑦 𝑝𝑋,π‘Œ π‘₯, 𝑦 𝐸 𝑔 𝑋, π‘Œ = ΰΆ±βˆ’βˆž

∞

ΰΆ±βˆ’βˆž

∞

𝑔 π‘₯, 𝑦 𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑𝑦 𝑑π‘₯

…etc.

Review

ThinkSlide 35 has a question to go over by yourself.

Post any clarifications here!

https://us.edstem.org/courses/109/discussion/60584

Think by yourself: 2 min

34

πŸ€”(by yourself)

Lisa Yan, CS109, 2020

Warmup exercise

𝑋 and π‘Œ have the following joint PDF:

1. Are 𝑋 and π‘Œ independent?

2. What is the marginalPDF of 𝑋? Of π‘Œ?

3. What is 𝐸 𝑋 + π‘Œ ?

35

πŸ€”(by yourself)

𝑓𝑋,π‘Œ π‘₯, 𝑦 = 3π‘’βˆ’3π‘₯

where 0 < π‘₯ < ∞, 1 < 𝑦 < 2

Lisa Yan, CS109, 2020

Warmup exercise

𝑋 and π‘Œ have the following joint PDF:

1. Are 𝑋 and π‘Œ independent?

2. What is the marginalPDF of 𝑋? Of π‘Œ?

3. What is 𝐸 𝑋 + π‘Œ ?

36

𝑔 π‘₯ = 3πΆπ‘’βˆ’3π‘₯ , 0 < π‘₯ < βˆžβ„Ž 𝑦 = 1/𝐢, 1 < 𝑦 < 2

𝐢 is a

constantβœ…

𝑓𝑋,π‘Œ π‘₯, 𝑦 = 3π‘’βˆ’3π‘₯

where 0 < π‘₯ < ∞, 1 < 𝑦 < 2

π‘₯𝑦

𝑓 𝑋,π‘Œπ‘₯,𝑦

Lisa Yan, CS109, 2020

Warmup exercise

𝑋 and π‘Œ have the following joint PDF:

1. Are 𝑋 and π‘Œ independent?

2. What is the marginalPDF of 𝑋? Of π‘Œ?

3. What is 𝐸 𝑋 + π‘Œ ?

37

𝑓𝑋,π‘Œ π‘₯, 𝑦 = 3π‘’βˆ’3π‘₯

where 0 < π‘₯ < ∞, 1 < 𝑦 < 2

𝑔 π‘₯ = 3πΆπ‘’βˆ’3π‘₯ , 0 < π‘₯ < βˆžβ„Ž 𝑦 = 1/𝐢, 1 < 𝑦 < 2

𝐢 is a

constantβœ…

Breakout Rooms

Check out the question on the next slide. Post any clarifications here!

https://us.edstem.org/courses/667/discussion/94992

Breakout rooms: 4 min. Introduce yourself!

39

πŸ€”

Lisa Yan, CS109, 2020

The joy of meetings

Two people set up a meeting time. Each arrives independently at a time uniformly distributed between 12pm and 12:30pm.

Define 𝑋 = # minutes past 12pm that person 1 arrives. 𝑋~Unif 0, 30π‘Œ = # minutes past 12pm that person 2 arrives. π‘Œ~Unif 0, 30

What is the probability that the first to arrive waits >10 mins for the other?

Compute: 𝑃 𝑋 + 10 < π‘Œ + 𝑃 π‘Œ + 10 < 𝑋 = 2𝑃 𝑋 + 10 < π‘Œ

1. What is β€œsymmetry” here?

2. How do we integrate to compute this probability?

40

πŸ€”

(by symmetry)

Lisa Yan, CS109, 2020

The joy of meetings

Two people set up a meeting time. Each arrives independently at a time uniformly distributed between 12pm and 12:30pm.

Define 𝑋 = # minutes past 12pm that person 1 arrives. 𝑋~Unif 0, 30π‘Œ = # minutes past 12pm that person 2 arrives. π‘Œ~Unif 0, 30

What is the probability that the first to arrive waits >10 mins for the other?

Compute: 𝑃 𝑋 + 10 < π‘Œ + 𝑃 π‘Œ + 10 < 𝑋 = 2𝑃 𝑋 + 10 < π‘Œ

42

(by symmetry)

= 2 β‹… ΰΆ΅

π‘₯+10<𝑦

𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑π‘₯𝑑𝑦 = 2 β‹… ΰΆ΅

π‘₯+10<𝑦,0≀π‘₯,𝑦,≀30

1/30 2𝑑π‘₯𝑑𝑦

=2

302ΰΆ±10

30

ΰΆ±0

π‘¦βˆ’10

𝑑π‘₯𝑑𝑦

(independence)

=2

302ΰΆ±10

30

𝑦 βˆ’ 10 𝑑𝑦 = β‹― =4

9

Interlude for jokes/announcements

43

Lisa Yan, CS109, 2020

Announcements

44

Problem Set 5 out tonight

Due: Monday 8/3 1pm

Covers: Up to Wed’s lecture (16)

Mid-quarter feedback form

Link (Stanford account login)

Open until: Wednesday

Problem Set 4 due soon

Due: Monday 7/27 1pm

Grades

Pset 3 by: Tonight

Midterm by: End of weekend

Lisa Yan, CS109, 2020

Even when you shift the probability far left or far

right, the opposing candidate still gets some wins.

That doesn’t mean a forecast was wrong. That’s just

randomness and uncertainty at play. The probability

estimates the percentage of times you get an

outcome if you were to do something multiple times.

Interesting probability news

46

https://flowingdata.com/2016/07/28/

what-that-election-probability-means/

What That Election Probability Means

Lisa Yan, CS109, 2020

Ethics in probability: Utilization and Fairness under Uncertainty

47

β€œSuppose there is a remote stretch of coastline with two

small villages, A and B, each with a small number of

houses.”

β€œIn any particular week, the probability distribution over the

number of houses C impacted by power outages in each

village is as follows:”

https://dl.acm.org/doi/abs/10.1145/3351095.3372847 ACM FAT* Best Paper Award 2020

Suppose you are trying to assign generators to these villages permanently.

Utilization: E[# of generators that are actually used]

Fairness: E[village A houses in need get generators] ~= E[village B houses in need get generators]

How do you choose an allocation that optimizes utilization subject to our fairness constraint?

=> With probability :-)

Lisa Yan, CS109, 2020

Bivariate Normal Distribution

The bivariate normal distribution of 𝑿 = 𝑋1, 𝑋2 :

𝑿~𝒩(𝝁, 𝚺)β€’ Mean vector 𝝁 = πœ‡1, πœ‡2

β€’ Covariance matrix: 𝚺 =𝜎12 𝜌𝜎1𝜎2

𝜌𝜎1𝜎2 𝜎22

β€’ Marginal distributions: 𝑋1~𝒩 πœ‡1, 𝜎12 , 𝑋2~𝒩 πœ‡2, 𝜎2

2

β€’ For bivariate normals in particular, Cov 𝑋1, 𝑋2 = 0 implies 𝑋1, 𝑋2 independent.

48

We will focus on understanding the

shape of a bivariate Normal RV.

Cov 𝑋1, 𝑋2 = Cov 𝑋2, 𝑋1 = 𝜌𝜎1𝜎2

Review

Breakout Rooms

Check out the question on the next slide. Post any clarifications here!

https://us.edstem.org/courses/667/discussion/94992

Breakout rooms: 3 min. Introduce yourself!

49

πŸ€”

Lisa Yan, CS109, 2020

𝑋, π‘Œ Matching (all have 𝝁 = 0, 0 )

50

πŸ€”

x

y

PD

F

x

y

1.

x

y

PD

F

x

y

3.

x

y

PD

F

x

y

2.

x

y

PD

F

x

y

4.

A.1 00 1

B.1 00 2

C.1 0.50.5 1

D.1 βˆ’0.5

βˆ’0.5 1

Lisa Yan, CS109, 2020

𝑋, π‘Œ Matching (all have 𝝁 = 0, 0 )

51

x

y

PD

F

x

y

1.

x

y

PD

F

x

y

3.

x

y

PD

F

x

y

2.

x

y

PD

F

x

y

4.

A.1 00 1

B.1 00 2

C.1 0.50.5 1

D.1 βˆ’0.5

βˆ’0.5 1

Lisa Yan, CS109, 2020

Note strict inequalities; these properties hold

for both discrete and continuous RVs.

Probabilities from joint CDFs

52

Recall for a single RV 𝑋 with CDF 𝐹𝑋:

CDF: 𝑃 𝑋 ≀ π‘₯ = 𝐹𝑋 π‘₯

𝑃 π‘Ž < 𝑋 ≀ 𝑏 = 𝐹𝑋 𝑏 βˆ’ 𝐹(π‘Ž)

For two RVs 𝑋 and π‘Œ with joint CDF 𝐹𝑋,π‘Œ:

Joint CDF: 𝑃 𝑋 ≀ π‘₯, π‘Œ ≀ 𝑦 = 𝐹𝑋,π‘Œ π‘₯, 𝑦

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

Lisa Yan, CS109, 2020

Probabilities from joint CDFs

53

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

π‘Ž2π‘Ž1

𝑏2𝑏1

π‘₯

𝑦

𝑦

𝑏2

𝑏1

π‘Ž2π‘Ž1π‘₯

Lisa Yan, CS109, 2020

Probabilities from joint CDFs

54

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

𝑦

𝑏2

𝑏1

π‘Ž2π‘Ž1π‘₯

Lisa Yan, CS109, 2020

Probabilities from joint CDFs

55

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

𝑦

𝑏2

𝑏1

π‘Ž2π‘Ž1π‘₯

Lisa Yan, CS109, 2020

Probabilities from joint CDFs

56

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

𝑦

𝑏2

𝑏1

π‘Ž2π‘Ž1π‘₯

Lisa Yan, CS109, 2020

Probabilities from joint CDFs

57

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

𝑦

𝑏2

𝑏1

π‘Ž2π‘Ž1π‘₯

Lisa Yan, CS109, 2020

Probabilities from joint CDFs

58

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

𝑦

𝑏2

𝑏1

π‘Ž2π‘Ž1π‘₯

Lisa Yan, CS109, 2020

Probabilities from joint CDFs

59

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

𝑦

𝑏2

𝑏1

π‘Ž2π‘Ž1π‘₯

Lisa Yan, CS109, 2020

Probability with Instagram!

60

In image processing, a Gaussian blur is the result of blurring an

image by a Gaussian function. It is a widely used effect in

graphics software, typically to reduce image noise.

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

(for next

time)

Lisa Yan, CS109, 2020

Gaussian blur

In a Gaussian blur, for every pixel:β€’ Weight each pixel by the probability that 𝑋

and π‘Œ are both within the pixel bounds

β€’ The weighting function is a Bivariate Gaussian (Normal) standard deviation parameter 𝜎

Gaussian blurring with 𝜎 = 3:

𝑓𝑋,π‘Œ π‘₯, 𝑦 =1

2πœ‹ β‹… 32π‘’βˆ’ π‘₯2+𝑦2 /2β‹…32

What is the weight of the center pixel?

Center pixel: (0, 0)

Pixel bounds:

βˆ’0.5 < π‘₯ ≀ 0.5βˆ’0.5 < 𝑦 ≀ 0.5

61

𝑃 π‘Ž1 < 𝑋 ≀ π‘Ž2, 𝑏1 < π‘Œ ≀ 𝑏2 =

𝐹𝑋,π‘Œ π‘Ž2,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž1,𝑏2 βˆ’ 𝐹𝑋,π‘Œ π‘Ž2,𝑏1 + 𝐹𝑋,π‘Œ π‘Ž1,𝑏1

Weight matrix:

𝑃 βˆ’0.5 < 𝑋 ≀ 0.5,βˆ’0.5 < π‘Œ ≀ 0.5 =

= 0.206

β†’ Independent 𝑋~𝒩 0, 32 , π‘Œ~𝒩 0, 32

β†’ Joint CDF: 𝐹𝑋,π‘Œ π‘₯, 𝑦 = Ξ¦π‘₯

3Ξ¦

𝑦

3

Next time: More Cont. Joint and Central Limit Theorem

63

Extra

64

16f_extra

Lisa Yan, CS109, 2020

1. Integral practice

Let 𝑋 and π‘Œ be two continuous random variables with joint PDF:

What is 𝑃 𝑋 ≀ π‘Œ ?

65

𝑃 𝑋 ≀ π‘Œ = ΰΆ΅

π‘₯≀𝑦,0≀π‘₯,𝑦≀1

4π‘₯𝑦 𝑑π‘₯ 𝑑𝑦 = ΰΆ±

𝑦=0

1

ΰΆ±

π‘₯≀𝑦

4π‘₯𝑦 𝑑π‘₯ 𝑑𝑦 = ΰΆ±

𝑦=0

1

ΰΆ±

π‘₯=0

𝑦

4π‘₯𝑦 𝑑π‘₯ 𝑑𝑦

= ΰΆ±

𝑦=0

1

4𝑦π‘₯2

20

𝑦

𝑑𝑦 = ΰΆ±

𝑦=0

1

2𝑦3𝑑𝑦 =2

4𝑦4

0

1

=1

2

𝑓 π‘₯, 𝑦 = α‰Š4π‘₯𝑦 0 ≀ π‘₯, 𝑦 ≀ 10 otherwise

Lisa Yan, CS109, 2020

2. How do you integrate over a circle?

66

𝑃 π‘₯2 + 𝑦2 ≀ 102 = ࢱࢱ𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑𝑦 𝑑π‘₯

π‘₯2 + 𝑦2 ≀ 102

P(dart hits within π‘Ÿ = 10 pixels of center)?

Let’s try an example that doesn’t

involve integrating a Normal RV

☺

Lisa Yan, CS109, 2020

2. Imperfection on Disk

You have a disk surface, a circle of radius 𝑅. Suppose you have a single point imperfection uniformly distributed on the disk.

What are the marginal distributions of 𝑋 and π‘Œ? Are 𝑋 and π‘Œ independent?

67

𝑓𝑋,π‘Œ π‘₯, 𝑦 = ቐ1

πœ‹π‘…2π‘₯2 + 𝑦2 ≀ 𝑅2

0 otherwise

𝑓𝑋 π‘₯ = ΰΆ±βˆ’βˆž

∞

𝑓𝑋,π‘Œ π‘₯, 𝑦 𝑑𝑦 =1

πœ‹π‘…2ΰΆ±

π‘₯2+𝑦2≀𝑅2

𝑑𝑦

=1

πœ‹π‘…2ΰΆ±

𝑦=βˆ’ 𝑅2βˆ’π‘₯2

𝑅2βˆ’π‘₯2

𝑑𝑦

where βˆ’π‘… ≀ π‘₯ ≀ 𝑅

=2 𝑅2 βˆ’ π‘₯2

πœ‹π‘…2

π‘“π‘Œ 𝑦 =2 𝑅2 βˆ’ 𝑦

πœ‹π‘…2where βˆ’π‘… ≀ 𝑦 ≀ 𝑅, by symmetry

No, 𝑋 and π‘Œ are dependent.

𝑓𝑋,π‘Œ π‘₯, 𝑦 β‰  𝑓𝑋 π‘₯ π‘“π‘Œ 𝑦

top related