sanjoséstateuniversity math161a:appliedprobability&statistics€¦ · 10) prof. guangliang...

37
San José State University Math 161A: Applied Probability & Statistics Special discrete distributions (part 2) Prof. Guangliang Chen

Upload: others

Post on 08-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

San José State University

Math 161A: Applied Probability & Statistics

Special discrete distributions (part 2)

Prof. Guangliang Chen

Page 2: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Last lecture: Sections 3.4, 3.5

• Bernoulli

• Binomial

• HyperGeometric

This lecture: Sections 3.5, 3.6

• Geometric

• Negative Binomial

• Poisson

Page 3: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Review and overview

So far we have covered three discrete distributions:

• Bernoulli

• Binomial

• Hypergeometric

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 3/37

Page 4: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

They can be understood as counting successes in a fixed number of trials:

• Flip coins:

– Bernoulli (1 trial)

– Binomial (n trials)

• Draw balls from an urn with N balls, r of which are red :

– Bernoulli (one trial)

– Binomial (n trials with replacement)

– Hypergeometric (n trials without replacement)

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 4/37

Page 5: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Today we cover the following three new distributions:

• Geometric

• Negative Binomial

• Poisson

They can also be associated to the two experiments (flip coins, or drawballs), but they are performed indefinitely until a pre-specified number ofcertain outcome has been obtained.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 5/37

Page 6: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

• Flip coins for a fixed number of heads:

– Geometric (1 head)

– Negative Binomial (2+ heads)

• Draw balls with replacement from an urn with N balls (r ofwhich are red) until a fixed number of red balls are obtained:

– Geometric (1 red ball)

– Negative Binomial (2+ red balls)

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 6/37

Page 7: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

GeometricThe following two experiments are identical in nature:

Example 0.1. Consider the experiment of repeatedly flipping a coin untilthe first head appears. Let X = #flips needed to get a head.

1 2

T T T T H

X = #flips

b b b

Example 0.2. Consider the experiment of repeatedly drawing balls, withreplacement, from an urn containing N balls (r of which are red), untilthe first red ball has been selected. Let X = total # trials needed.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 7/37

Page 8: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

We make the following abstraction:

• The experiment consists of a sequence of repeated Bernoulli trials(i.e., each trial has only two outcomes: “success” and “failure”);

• The probability p of getting successes is always fixed

• The Bernoulli trials are all independent;

• The experiment is stopped as soon as one success has occurred;

• X denotes the total number of trials that have been performed.

In short, X counts the total number of independent trials (with fixedprobability of success) that are needed for the first success to occur.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 8/37

Page 9: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Def 0.1. We say that the previous random variable X has a geometricdistribution with parameter p, and write X ∼ Geom(p).

Remark. Binomial (fixed #trials), geometric (fixed #successes):

1 2 n (fixed)

T T T TH H HT

How many heads are there? (binomial)

1 2

T T HT

How many trials are there? (geometric)

T

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 9/37

Page 10: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Example 0.3. The following random variables both have geometric distri-butions:

• (Repeatedly flip a fair coin until the first head appears) X = totalnumber of flips needed. Geom(1

2)

• (Repeatedly draw balls with replacement from an urn containing 3red and 7 blue balls) X = #selections required to obtain a red ballfor the first time. Geom( 3

10)

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 10/37

Page 11: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Theorem 0.1. The pmf of of X ∼ Geom(p) is

f(x) = (1 − p)x−1p, x = 1, 2, . . .

Proof. See the following figure.

1 2

T T T T H

(1− p)x−1

b b b

x− 1 x

pb

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 11/37

Page 12: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Example 0.4. Suppose X has a geometric distribution with p = 12 . Find

P (X = 4) and F (X ≥ 4).

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 12/37

Page 13: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

0 2 4 6 8 10

x

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

f(x)

Geometric pmfs with different p

p=0.8

p=0.5

p=0.2

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 13/37

Page 14: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Infinitely many mathematicians walk into a bar.

The first says, “I’ll have a beer.”

The second says, “I’ll have half a beer.”

The third says, “I’ll have a quarter of a beer.”

The barman pulls out just two beers.

The mathematicians are all like, “That’s all you’re giving us? How drunkdo you expect us to get on that?”

The bartender says, “Come on guys. Know your limits.”

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 14/37

Page 15: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

An infinite number of mathematicians walk into a bar.

The first one orders a beer.

The second orders half a beer.

The third orders a third of a beer.

The bartender bellows, “Get the hell out of here, are you trying to ruinme?”

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 15/37

Page 16: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Theorem 0.2. Let X ∼ Geom(p). Then

E(X) = 1p, Var(X) = 1 − p

p2

Proof. We prove only the formula for expected value. By definition,

E(X) =∞∑x=1

x · (1 − p)x−1p = p∞∑x=1

x(1 − p)x−1

This series is of the form∑∞x=1 xa

x−1, which is equal to 1(1−a)2 . Applying

this formula gives that

E(X) = p · 1(1 − (1 − p))2 = 1

p.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 16/37

Page 17: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Negative BinomialBriefly speaking, negative binomial distributions are generalizations ofgeometric distributions by waiting for r > 1 successes.

Example 0.5. Consider the more general experiment of repeatedly tossinga coin until a total of r heads have been obtained. Let X = # flips neededto get the r heads. Then X follows a negative binomial distribution withparameters p and r. We denote it by X ∼ NB(p, r).

1

T H T H

X = #flips

T T

2

T T H

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 17/37

Page 18: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

The pmf of X is

fX(x) =(x− 1r − 1

)pr(1 − p)x−r, x = r, r + 1, r + 2, . . .︸ ︷︷ ︸

range

in which

• (x−1r−1): #ways of getting r − 1 heads in first x− 1 trials

• pr: probability of getting r heads (including last head)

• (1 − p)x−r: probability of getting x− r tails

1

T H T T H

x− 1 trials, r − 1 heads

T T

2 xx− 1

last head

T H

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 18/37

Page 19: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Example 0.6. Suppose X ∼ NB(p = 12 , r = 3). Find the following

probabilities:

• P (X = 2) =

• P (X = 3) =

• P (X = 4) =

• P (X = 5) =

• P (X ≥ 5) =

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 19/37

Page 20: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Answers:

• P (X = 2) = 0,

• P (X = 3) = 0.125

• P (X = 4) = 0.1875

• P (X = 5) = 0.1875

• P (X ≥ 5) = 0.6875.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 20/37

Page 21: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

0 5 10 15 20

x

0

0.1

0.2

0.3

0.4

0.5

0.6

f(x)

NB(p, r=3) pmfs

p=0.8

p=0.5

p=0.2

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 21/37

Page 22: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

0 5 10 15 20

x

0

0.1

0.2

0.3

0.4

0.5

f(x)

NB(p=0.5, r) pmfs

r=1

r=3

r=5

r=8

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 22/37

Page 23: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Theorem 0.3. Let X ∼ NB(p, r). Then

E(X) = r

p, Var(X) = r(1 − p)

p2

Proof. Let

1

T H T T HT T

2

T H

X1 Xrb b b+ +X =

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 23/37

Page 24: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Then each single Xi has a Geom(p) distribution:

E(Xi) = 1p, Var(Xi) = 1 − p

p2 , for all i = 1, . . . , r

By linearity (and independence),

E(X) = E(X1) + · · · + E(Xr) = 1p

+ · · · + 1p

= r

p

Var(X) = Var(X1) + · · · + Var(Xr) = 1 − p

p2 + · · · + 1 − p

p2 = r(1 − p)p2 .

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 24/37

Page 25: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Example 0.7. Find the expected value and variance of the X in the lastexample.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 25/37

Page 26: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

PoissonConsider the following random variables:

• #hurricanes that hit a region each year

• #earthquakes occurring in certain country in a year

• #car accidents on a certain highway per week

• #phone calls received by a call center per minute

• #customers arriving at a bank counter in every hour

• #typos on each page of certain book

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 26/37

Page 27: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

These examples have the following common characteristics:

• X counts the total number of certain event

• ... that is rare (with a small rate of occurrence λ)

• ... and occurs independently of each other

• ... over an fixed interval of time or space

| | | |b b b b b b b b b |

#occurences =?a fixed interval

Such random variables are modeled by Poisson distributions.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 27/37

Page 28: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Def 0.2 (X ∼ Pois(λ). We say that a discrete random variable has aPoisson distribution with parameter λ, if the pmf has the form

fX(x) = λx

x! e−λ, x = 0, 1, 2, . . .

Remark. The Poisson pmf is based on the following power series:

eλ =∞∑x=0

λx

x! = 10! + λ

1! + λ2

2! + λ3

3! + · · ·

which implies that

1 =∞∑x=0

λx

x! e−λ

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 28/37

Page 29: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Example 0.8. Suppose, on average, 2.2 hurricanes hit a region each year.Let X = # hurricanes next year. Find the following probabilities:

• P (X = 0) =

• P (X = 1) =

• P (X = 2) =

• P (X ≥ 2) =

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 29/37

Page 30: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Answers:

• P (X = 0) = e−2.2 = 0.1108

• P (X = 1) = 2.2e−2.2 = 0.2438

• P (X = 2) = 2.22

2 e−2.2 = 0.2681

• P (X ≥ 2) = 1 − 3.2e−2.2 = 0.6454

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 30/37

Page 31: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

0 5 10 15 20

x

0

0.1

0.2

0.3f(

x)

Pois( ) pmfs

=2.2

=6.6

=8.8

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 31/37

Page 32: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Theorem 0.4. If n is large and p is small, then B(n, p) ≈ Pois(λ = np).

Why this result is true: Consider the hurricane example again (where thenumber of hurricanes that hit a region in a year has a Poisson distributionwith rate λ). We divide a year into n equal subintervals of time (e.g., 12months, or 365 days).

| b b |b| | | | | | | | | | | | | | | ||||

When n is large, the number of hurricanes that occur in each subintervalis at most 1, thus a Bernoulli random variable with p = λ

n .

Therefore, the total number of hurricanes during the year is (approximately)binomial, with parameters n, p.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 32/37

Page 33: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Example 0.9. We have calculated that for X ∼ Pois(2.2), P (X = 2) =0.2681. In contrast, if X ∼ B(n = 365, p = 2.2

365), then P (X = 2) =0.2689.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 33/37

Page 34: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Example 0.10. The first draft of a probability textbook has 600 pages.Assume that the probability of any given page containing at least onetypographical error is 0.015 and the numbers of errors on all the pages aremutually independent. Let T be the total number of pages which have atleast one typographical error. Find the probability that T = 9.Answer: .1328 (exact), or .1318 (approx)

Solution. Each page of the textbook corresponds to a Bernoulli trial (thereare 600 repeated trials and they are independent by the assumption). Theexact distribution of T is T ∼ B(n = 600, p = 0.015). Using this, we getthat

P (T = 9) =(

6009

)0.0159(1 − 0.015)600−9 = .1328.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 34/37

Page 35: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Since this is a large n, small p setting, the binomial is approximatelyPoisson:

Tapprox∼ Pois(λ = np = 9).

Consequently, by the Poisson approximation, we have

P (T = 9) ≈ 99

9! e−9 = .1318

We can see that it is very close to the exact probability given by thebinomial distribution.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 35/37

Page 36: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Theorem 0.5. If X ∼ Pois(λ), then E(X) = λ and Var(X) = λ.

Proof. We only prove the formula for the expected value:

E(X) =∞∑x=0

x · λx

x! e−λ =

∞∑x=1

λx

(x− 1)!e−λ = λ

∞∑y=0

λy

y! e−λ = λ · 1 = λ.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 36/37

Page 37: SanJoséStateUniversity Math161A:AppliedProbability&Statistics€¦ · 10) Prof. Guangliang Chen | Mathematics & Statistics, San José State University10/37. Specialdiscretedistributions

Special discrete distributions (part 2)

Remark. We can also use the binomial approximation to understand whythis theorem is true. Treating Pois(λ) as B(n, p) for some large n (andsmall p = λ

n), we have

E(X) ≈ np = n · λn

= λ;

Var(X) ≈ np(1 − p) = n · λn

· (1 − λ

n) ≈ λ.

The above approximations become exact when n goes to infinity.

Prof. Guangliang Chen | Mathematics & Statistics, San José State University 37/37