0% found this document useful (0 votes)
8 views26 pages

Lecture Set 5

Uploaded by

berkeal260
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views26 pages

Lecture Set 5

Uploaded by

berkeal260
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Lecture Set 5

DNSC 6311
Stochastic Foundations: Probability

Korel Gundem

The George Washington University


Department of Decision Sciences

1 / 26
Lecture Outline

1. Other related distributions to Binomial model.

2. Geometric and Negative Binomial models and applications.

3. Sampling without replacement and hypergeometric model.

4. Multivariate extension: Multinomial distribution.

5. Poisson model and applications.

6. Continuous random variables and probability models.

7. Uniform model.

2 / 26
Models Related to Bernoulli Trials
We can define other RVs from the Bernoulli trials.
For example, what is the distribution of number of down days
before a particular stock is up ?

Relative Frequencies of No. of Down Days Before GE is Up

0.5
0.4
Relative Frequency

0.3
0.2
0.1
0.0

0 2 4 6 8

Days

3 / 26
Distribution of Number of Failures Before the First Success
▶ Note that the random variable, X , number of failures (down
days) before the first success (up day ), can take values,
x = 0, 1, 2, . . .
▶ The random variable X will have a geometric distribution with
parameter p,

Pr (X = x) = P(x) = (1 − p)x p where x = 0, 1, . . .

The probabilities will sum to 1



X ∞
X ∞
X
x
P(x) = (1 − p) p = p (1 − p)x = 1
x=0 x=0 x=0

Note that

X
(1 − p)x = 1/p.
x=0
(geometric series)
4 / 26
Back to the GE Data
How does the geometric distribution fit to the GE data on number
down days before the first up day ?
We can evaluate the geometric probabilities using R function
dgeom(x,p);dgeom(0,0.4854)=0.4854.
Relative Frequencies of No. of Down Days Before GE is Up
0.5
0.4
Relative Frequency

0.3
0.2
0.1
0.0

0 2 4 6 8

Days

5 / 26
Properties of the Geometric Distribution

▶ We can obtain the mean of the geometric RV as

1−p
E [X ] =
p
which is an intuitive result.

▶ Also, its variance is given by

1−p
V [X ] = .
p2

6 / 26
R Computations with Geometric Model

Let X denote the number of down days in the market before GE stock goes up.

▶ What is the probability that GE stock will be down more than 4 days before it
goes up?
P(X ≥ 5) = 1 − pgeom(4, 0.4854) = 0.0361.
▶ What is the probability that GE stock will be down at most 2 days before it
goes up?
P(X ≤ 2) = pgeom(2, 0.4854) = 0.8637.
▶ What is the expected number of down days until the first up day ?

1−p 1 − 0.4854
E [X ] = = = 1.06
p 0.4854

▶ What is the median of the distribution ?

median(X ) = qgeom(0.5, 0.4854) = 1

7 / 26
Negative Binomial Distribution
▶ What about the RV, number of downs before the rth up day ?

We obtain the generalization of the geometric distribution


which is the negative binomial distribution.

▶ Note that for the negative binomial RV X to take a specific


value x, we need to have r + x trials with the restriction that
the last trial should be a success (e.g. up day in the market).
We still have independent trials where the first (r + x − 1)
trials can have (r − 1) successes in any order and the last trial
is a success, that is,
 
r +x −1 r
Pr (X = x) = P(x) = p (1−p)x where x = 0, 1, . . . .
r −1

If r = 1 then we obtain the geometric distribution.

8 / 26
Properties of the Negative Binomial Distribution

▶ If Y1 , Y2 , . . . , Yr are independent random variables each


having a geometric distribution with p then X = rk=1 Yk
P
will have a negative binomial distribution.
Note that when you have independent Bernoulli trials with
probability p then we have this satisfied.

▶ Using this result we can show that E [X ] = r (1 − p)/p and


V [X ] = r (1 − p)/p 2 . Why ?

▶ We can compute negative binomial probabilities in R using:

dnbinom(x, r, p) and pnbinom(x, r, p).

9 / 26
Sampling Without Replacement
▶ Hypergeometric Experiment (DS Section 5.3)
- A random sample of size n is selected from N items without replacement.
- K of the N items can be classified as successes and (N − K ) are classified as
failures.
▶ The distribution of X = Number of successes in the (hypergeometric)
experiment is given by

K  N−K 
x n−x
P(X = x) = N
, x = 0, 1, . . . , n.
n

We can show that


K
E [X ] = n .
N
▶ Finite population and sampling without replacement; we can think of this as
dependent Bernoulli trials.
▶ What is the probability of having 2 hearts when a 5 card-hand is dealt from a 52
deck ?
dhyper (x, K , N − K , n) = dhyper (2, 13, 39, 5) = 0.2743.

10 / 26
Multivariate Extension of Binomial: Trinomial Distribution
▶ Consider an extension of the binomial experiment where each
of the n independent trials has three P3possible outcomes with
probabilities p1 , p2 , p3 , such that i=1 pi = 1.
▶ Note that the probabilities are constant across the trials and
we are interested in Xi ,P number of outcomes of type i,
i = 1, . . . , 3, such that 3i=1 Xi = n.
▶ Then the joint distribution of (X1 , X2 , X3 ) is a trinomial
distribution
n!
p(x1 , x2 , x3 ) = p1x1 p2x2 p3x3 ,
x1 ! x2 ! x3 !
P3 P3
where i=1 xi = n and i=1 pi = 1.
Since 3i=1 xi = n, this is a bivariate distribution.
P

▶ We can easily show that marginal distribution for each Xi is


binomial with n and pi .
11 / 26
Conditional Distributions in the Trinomial Model
▶ What are the conditional distributions ?
n! x1 x2 n−x1 −x2
x1 ! x2 ! (n−x1 −x2 )! p1 p2 p3
P(x1 |X2 = x2 ) = n! x2 n−x2
x2 ! (n−x2 )! p2 (1 − p2 )
 
n − x2  p1 x1  1 − p1 − p2 n−x1 −x2
P(x1 |X2 = x2 ) =
x1 1 − p2 1 − p2

▶ Thus, we obtain
 
n − x2  p1 x1  p1 n−x1 −x2
P(x1 |X2 = x2 ) = 1− ,
x1 1 − p2 1 − p2

which is binomial with (n − x2 ) and p1 /(1 − p2 ).


pi
▶ In general, (Xi |Xj = xj ) ∼ Binom(n − xj , 1−p
j
) and
Cov (Xi , Xj ) = −npi pj .
12 / 26
Multinomial Distribution
▶ r possible outcomes in a trial with probabilities p1 , . . . , pr ;
Pr
i=1 pi = 1

▶ Xi =number of outcomes of type i in n trials; ri=1 Xi = n.


P

▶ Joint distribution of (X1 , X2 , . . . , Xr ) is a multinomial


distribution which is a (r − 1) dimensional distribution and
r = 2 ⇒binomial distribution. (DS Section 5.3)
▶ Joint probability mass function:
n!
Pr [X1 = x1 , . . . Xr = xr ] = p1x1 p2x2 · · · prxr
x1 ! x2 ! · · · xr !

▶ All the marginal distributions of Xi ’s are binomial with (n, pi )


and all bivariate distributions are trinomial with
Cov (Xi , Xj ) = −npi pj .
▶ R command: dmultinom(x = c(2, 1, 1), p = c(0.5, 0.3, 0.2)).
13 / 26
Modeling Counts
▶ Binomial, geometric and negative binomial distributions can
be used to model counts data, but they are restricted to
certain contexts (discrete time).
▶ For dealing with number of occurrences over a period of time
it is more appropriate to use a Poisson model.
▶ Consider data on a household’s number of weekly shopping
trips to grocery store.
Relative Frequencies of Number of Weekly Trips
0.5
0.4
0.3
relfreq

0.2
0.1
0.0

0 1 2 3 4 5 6 7

14 / 26
Poisson Model
▶ Related to the Poisson process (Poisson experiment).

X ≡Number of occurences of an event in a time interval or in


a region with rate λ.
Rate λ is the expected value if X , that is, E [X ] = λ.
Also, for the Poisson RV we have E [X ] = V [X ] = λ.
▶ Probability distribution of X with rate λ is given by

e −λ λx
Pr (X = x) = P(x) = , x = 0, 1, . . .
x!

▶ Why is this a proper probability (mass) function ?


∞ ∞ ∞
X X e −λ λx −λ
X λx
p(x) = =e = 1.
x! x!
x=0 x=0 x=0

15 / 26
Fitting A Poisson Model to Number of Shopping Trips
In fitting a Poisson model it is important to see the mean and the
variance are close to each other, that is, their ratio is closer to one.
We can check this in R via var(x) and mean(x) functions.
From the data, we can estimate λ by x and compute probabilities
in R via dpois(x,λ).
Poisson Fit to the Distribution of Number of Weekly Trips
0.5

Actual
Poisson
0.4
0.3
relfreq

0.2
0.1
0.0

0 1 2 3 4 5 6 7

N
16 / 26
Poisson Process (Experiment)
▶ RV X (t) denotes the number of occurrences of an outcome
during a time interval t such that
1. No. of occurrences in a time interval is independent of number
of occurrences in any other disjoint time interval.
2. Probability of an occurrence in any very short time interval is
proportional to the length of the time interval.
3. Probability that more than one outcome will occur in any very
short time interval is negligible.
▶ Based on these assumptions it can be shown that X (t) has a
Poisson distribution with rate λt, that is, the rate is
proportional to the length of the interval.
▶ What is the probability of 0 occurrences in a time interval t ?
e −λt λ0
Pr (X (t) = 0) = = e −λt .
0!
Note that ”0 occurrences in a time interval t” ⇐⇒ ”next
occurrence will be later than t”; exponential distribution.
17 / 26
Example: Poisson Experiment
▶ Assume that number of calls arriving to a call center is
Poisson with (mean) rate λ = 2 per minute during the period
of 9:00 am-12:00 noon.
This means that X (t) = Number of calls arriving to a call
center during a period of t minutes is Poisson with rate
λt = 2t, that is, E [X (t)] = λt = 2t.
▶ What is the probability of having more than 25 calls during
10:00-10:10 am ?
Expected number of calls during the ten minutes will be
2 × 10 = 20.

P(X (t) > 25) = 1 − ppois(25, 20) = 0.112.

What is the probability of 15 calls during 10:00-10:10 am ?

P(X (t) = 15) = dpois(15, 20) = 0.0516.


18 / 26
Number of Calls during 10:00-10:10
Number of calls during a 10 minute interval

0.08
0.06
Prob(calls)

0.04
0.02
0.00

0 10 20 30 40

calls

19 / 26
Example Cont’d
▶ What is the probability of having more than 18 calls during
10:00-10:10am and more than 24 calls during 10:20-10:35am?

▶ Let’s define I1 as the 10:00-10:10am interval and I2 as the


10:20-10:35am interval.

We are interested in P X (I1 ) > 18, X (I2 ) > 24 .

▶ Note that since the two intervals are non-overlapping


(disjoint) random variables X (I1 ) and X (I2 ), are independent;
thus we have
  
P X (I1 ) > 18, X (I2 ) > 24 = P X (I1 ) > 18 ×P X (I2 ) > 24

which can be obtained as

(1 − ppois(18, 20)) × (1 − ppois(24, 30)) = 0.5213.

20 / 26
Poisson Approximation to Binomial Distributions
The Poisson distribution with rate n × p can be obtained as a limiting case of the
binomial distribution when n is very large and p is very small.

Poisson Binomial

0.14

0.14
0.12

0.12
0.10

0.10
0.08

0.08
P(X=x)

P(X=x)
0.06

0.06
0.04

0.04
0.02

0.02
0.00

0.00
0 2 4 6 8 10 12 14 16 18 20 22 24 26 0 2 4 6 8 10 12 14 16 18 20 22 24 26

lambda=10 n=10000, p=0.001

Poisson Binomial
0.20

0.7
0.6
0.15

0.5
0.4
P(X=x)

P(X=x)
0.10

0.3
0.2
0.05

0.1
0.00

0.0
0 1 2 3 4 5 6 7 8 9 10 12 14 16 18 0 1 2 3 4 5 6

lambda=4.5 n=5,p=0.9

Example: Suppose that in a large population the proportion of people who have a
certain disease is 0.01. What is the probability that in a random group of 200 people
at least four people will have the disease? Compute the probability using the binomial
and Poisson mass functions.

21 / 26
Continuous Random Variables
▶ Random Variable (RV) X can take infinite (uncountable)
number of values.
P(X = x) = 0.
▶ A RV X is a continuous RV if there exists a nonnegative
function f (x) such that
Z b
P(a < X < b) = f (x)dx.
a

f (x) is referred to as the probability density function (pdf)


f (x)dx ≈ P(x < X < x + dx).

▶ Note that 0 ≤ f (x) and


Z
f (u)du = 1.
x
22 / 26
Computing Probabilities of Random Variables
▶ We can obtain the cumulative probability distribution function
as Z x
P(X < x) = F (x) = f (u)du.
-∞

▶ Also, for a continuous RV we have


P(a < X < b) = P(a < X ≤ b) = P(a ≤ X < b) = P(a ≤ X ≤ b)

P(X>1) P(−2<X<1) P(X>10)


0.4

0.4

0.10
0.3

0.3

0.08
0.06
density

density

density
0.2

0.2

0.04
0.1

0.1

0.02
0.00
0.0

0.0

−3 −2 −1 0 1 2 3 −3 −2 −1 0 1 2 3 0 10 20 30 40 50

x x x

23 / 26
Uniform Distribution
▶ Uniform distribution over (a, b)
1
f (x) = ,
b−a
1 x −a
Z x
F (x) = P(X < x) =
dy = .
b−a b−a a
▶ We can evaluate f (x) and F (x) using R statements:dunif (x, a, b) and
punif (x, a, b), respectively.
▶ For a = 0 and b = 1

Uniform Density Function Uniform Distribution Function


1.4

1.0
0.8
1.2

Cumulative Density

0.6
Density

1.0

0.4
0.8

0.2
0.6

0.0

0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0

x x

24 / 26
Expected Value of a Continuous RV
▶ For a continuous random variable X the expected value is
given by Z ∞
E (X ) = xf (x)dx.
-∞

▶ For uniform probability distribution over (a, b)


Z b
x b+a
E [X ] = dx = .
a b−a 2
▶ Higher moments of X
Z
E [X k ] = x k f (x)dx
x
▶ For uniform probability distribution over (a, b) we have
(b − a)2
V [X ] = E [X 2 ] − (E [X ])2 =
12
where E [X 2 ] = (a2 + b 2 + ab)/3.
25 / 26
Quantiles of Continuous Distributions
▶ Consider a RV X with cumulative distribution function F and
for each q, 0 < q < 1, define F −1 (q) as the smallest value x
such that F (x) ≥ q.
Then F −1 (q) is called the qth quantile of X (100q percentile)
▶ For a continuous RV X you can always find a unique value x
such that F (x) = q.
▶ Quantiles of uniform distribution

What is the 0.75 quantile of the uniform distribution ?


(x − a)
= 0.75
(b − a)
X0.75 = a + (b − a) × 0.75
Thus, for a = 2, b = 12 we have X0.75 = 9.5; in R:
qunif (0.75, 2, 12).
26 / 26

You might also like