+ All Categories
Home > Documents > 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal...

08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal...

Date post: 13-Aug-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
24
08: Poisson and More Lisa Yan and Jerry Cain September 30, 2020 1
Transcript
Page 1: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

08: Poisson and MoreLisa Yan and Jerry CainSeptember 30, 2020

1

Page 2: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Quick slide reference

2

3 Poisson 08a_poisson

11 Poisson, continued 08b_poisson_ii

17 Other Discrete RVs 08c_other_discrete

25 Exercises LIVE

33 Poisson approximation LIVE

Page 3: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Poisson RV

3

08a_poisson

Page 4: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Before we start

The natural exponent !:

https://en.wikipedia.org/wiki/E_(mathematical_constant)

4

lim!→#

1 − &'

!= )$%

Jacob Bernoulliwhile studying

compound interest in 1683

Page 5: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Algorithmic ride sharing

5

!

!

"

""

Probability of " requests from this area in the next 1 minute?On average, ! = 5 requests per minuteSuppose we know:

Page 6: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Algorithmic ride sharing, approximately

At each second:• Independent trial• You get a request (1) or you don’t (0).

Let # = # of requests in minute.% # = & = 5

6

Probability of " requests from this area in the next 1 minute?On average, ! = 5 requests per minute

0 0 1 0 1 … 0 0 0 0 1

1 2 3 4 5 60

# ~ Bin ) = 60, - = 5/60

Break a minute down into 60 seconds:

/ # = " =60"

5

60

!1 −

5

60

"#!

But what if there are two requests in the same second?!

Page 7: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Algorithmic ride sharing, approximately

At each millisecond:• Independent trial• You get a request (1) or you don’t (0).

Let # = # of requests in minute.% # = & = 5

7

Probability of " requests from this area in the next 1 minute?On average, ! = 5 requests per minute

Break a minute down into 60,000 milliseconds:

/ # = " =)"

&

)

!1 −

&

)

"#!

1 60,000

# ~ Bin ) = 60000, - = &/)

But what if there are two requests in the same millisecond?!

Page 8: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Algorithmic ride sharing, approximately

For each time bucket:• Independent trial• You get a request (1) or you don’t (0).

Let # = # of requests in minute.% # = & = 5

8

Probability of " requests from this area in the next 1 minute?On average, ! = 5 requests per minute

Break a minute down into infinitely small buckets:

/ # = " = lim"→%

)"

&

)

!1 −

&

)

"#!

Who wants to see some cool math?

OMG so small

1 ∞

# ~ Bin ), - = &/)

Page 9: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Binomial in the limit

9

/ # = " = lim"→%

)"

&

)

!1 −

&

)

"#!= lim"→$

'!)!(' − ))!

!%'%

1 − l'

"

1 − l'

%

lim!→#

1 − +,

!= .$%

= lim"→$'!

'%(' − ))!!%)!

1 − l'

"

1 − l'

%

Expand

Rearrange

= lim"→$'!

'%(' − ))!!%)!

./0

1 − l'

%Def natural

exponent

= lim"→$' ' − 1 ⋯ ' − ) + 1

'%' − ) !' − ) !

!%)!

./0

1 − l'

%Expand

= lim"→$'%'%

!%)!

./01

Limit analysis

+ cancel= !%)! .

/0Simplify

Page 10: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Algorithmic ride sharing

10

!

!

"

""

Probability of " requests from this area in the next 1 minute?On average, ! = 5 requests per minute

* + = , = &&,! )

$% Poisson distribution

Page 11: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Poisson, continued

11

08b_poisson_ii

Page 12: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Consider an experiment that lasts a fixed interval of time.def A Poisson random variable # is the number of successes over the

experiment duration, assuming the time that each success occurs isindependent and the average # of requests over time is constant.

Examples:• # earthquakes per year• # server hits per second• # of emails per day

Poisson Random Variable

12

1 End of interval

the time that each success occurs isindependent

Page 13: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Consider an experiment that lasts a fixed interval of time.def A Poisson random variable # is the number of successes over the

experiment duration, assuming the time that each success occurs isindependent and the average # of requests over time is constant.

Examples:• # earthquakes per year• # server hits per second• # of emails per day

Yes, expectation == variance for Poisson RV! More later.

Poisson Random Variable

13

* + = , = )$% &&

,!!~Poi($)Support: {0,1, 2, … }

PMF

% # = &Var # = &Variance

Expectation

Page 14: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Simeon-Denis Poisson

French mathematician (1781 – 1840)• Published his first paper at age 18• Professor at age 21• Published over 300 papers“Life is only good for two things: doing mathematics and teaching it.”

14

Page 15: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

EarthquakesThere are an average of 2.79 major earthquakes in the world each year, and major earthquakes occur independently.What is the probability of 3 major earthquakes happening next year?

15

& ' = )!" *#

'!

1. Define RVs

2. Solve

0

0.05

0.1

0.15

0.2

0.25

0.3

0 1 2 3 4 5 6 7 8 9 10

1(2

= 3)

Number of earthquakes, 3

,~Poi(*)0 , = *

Page 16: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Are earthquakes really Poissonian?

16

Page 17: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Other Discrete RVs

17

08c_other_discrete

Page 18: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Grid of random variables

18

Number of successes

Ber(/)One trial

Severaltrials

Intervalof time

Bin(', /)

Poi(&) (tomorrow)

One success

Severalsuccesses

Interval of time tofirst success

Time until success

1 = 1

Page 19: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Consider an experiment: independent trials of Ber(-) random variables.def A Geometric random variable # is the # of trials until the first success.

Examples:• Flipping a coin (7 heads = 8) until first heads appears• Generate bits with 7 bit = 1 = 8 until first 1 generated

Geometric RV

19

* + = , = 1 − / &$'/!~Geo(&)Support: {1, 2, … }

PMF

% # =34

Var # =3#44!

Variance

Expectation

Page 20: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Consider an experiment: independent trials of Ber(-) random variables.def A Negative Binomial random variable # is the # of trials until

7 successes.

Examples:• Flipping a coin until 945 heads appears• # of strings to hash into table until bucket 1 has 9 entries

Negative Binomial RV

20

/ # = " =" − 17 − 1

1 − - !#5-5!~NegBin(', &)Support: {9, 9 + 1,… }

PMF

% # =54

Var # =5 3#44!

VarianceExpectation

Geo 8 = NegBin(1, 8)

Page 21: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Grid of random variables

21

Number of successes

Ber(/)One trial

Severaltrials

Intervalof time

Bin(', /)

Poi(&)

Geo(/)

NegBin(2, /)

(tomorrow)

One success

Severalsuccesses

Interval of time tofirst success

Time until success

1 = 1 6 = 1

Page 22: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Catching PokemonWild Pokemon are captured by throwing Pokeballs at them.• Each ball has probability p = 0.1 of capturing the Pokemon.• Each ball is an independent trial.

What is the probability that you catch the Pokemon on the 5th try?

22

1. Define events/ RVs & state goal

A. #~Bin 5, 0.1B. #~Poi 0.5C. #~NegBin 5, 0.1D. #~NegBin 1, 0.1E. #~Geo 0.1F. None/other

2. Solve

#~some distribution

Want: 7 : = 5

!

Page 23: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

Wild Pokemon are captured by throwing Pokeballs at them.• Each ball has probability p = 0.1 of capturing the Pokemon.• Each ball is an independent trial.

What is the probability that you catch the Pokemon on the 5th try?

A. #~Bin 5, 0.1B. #~Poi 0.5C. #~NegBin 5, 0.1D. #~NegBin 1, 0.1E. #~Geo 0.1F. None/other

Catching Pokemon

23

1. Define events/ RVs & state goal

2. Solve

#~some distribution

Want: 7 : = 5

Page 24: 08: Poisson and More - Stanford University · Catching Pokemon 29 1.Define events/ RVs & state goal 2.Solve #~some distribution Want: :9=5. Lisa Yan, CS109, 2020 2.Solve Catching

Lisa Yan and Jerry Cain, CS109, 2020

2. Solve

Catching PokemonWild Pokemon are captured by throwing Pokeballs at them.• Each ball has probability p = 0.1 of capturing the Pokemon.• Each ball is an independent trial.

What is the probability that you catch the Pokemon on the 5th try?

24

1. Define events/ RVs & state goal

2. Solve

#~Geo 0.1

Want: 7 : = 5

,~Geo(&) & ' = 1 − & #!$&


Recommended