You are on page 1of 51

Modeling and Simulation

Statistical Models

2010
Goals for Today

 Review of the most common statistical models


 Understand how to determine the empirical distribution
from a statistical sample

2
2
Topics
Discrete Probability Distributions
• Binomial Distribution
• Bernoulli Distribution
• Geometric Distribution
• Discrete Poisson Distribution/Poisson Process
Continuous Probability Distribution
• Uniform
• Exponential
• Normal
Empirical Distributions
3
3
Discrete and Continuous
Random Variables

4
Discrete versus Continuous Random Variables
Discrete Random Variable Continuous Random Variable

Finite Sample Space Infinite Sample Space


e.g. {0, 1, 2, 3} e.g. [0,1], [2.1, 5.3]

Probability Mass Function (PMF) Probability Density Function (PDF)


( x i ) P=
p= (X x i ) f (x )
1. f ( x) ≥ 0 , for all x in R X
1. p (x i ) ≥ 0, for all i
2. ∑ i =1 p (x i ) = 1
∞ 2. ∫ f ( x)dx = 1
RX

3. f ( x) = 0, if x is not in RX

Cumulative Distribution Function (CDF) p ( X ≤ x )


∑x
p (X ≤ x ) = p (X=
≤x) (t ) dt 0
x

i ≤x
p (x i ) ∫ f=−∞

p (a ≤ X ≤b) =∫a f ( x ) dx
b

5
Expectation

E(X): The expected value (the mean) of X

• Discrete E ( x) = ∑ xi p ( xi )
all i


• Continuous E ( x) = ∫ xf ( x)dx
−∞

Var(X) : The variance of X


2
• Discrete V ( X )=
n


 n

  n

( x i − µx ) ⋅ p ( x i )=  ( x i ) ⋅ p ( x i )  −  x i ⋅ p ( x i
2 2 
) 
=i 1 =  i 1=  i 1 
+∞  +∞ 
• Continuous ∫ ∫
V ( X ) = ( x − µx ) ⋅ f ( x ) dx =  x 2 ⋅ f ( x ) dx
2
 − µx2
 
−∞  −∞ 
6
Statistical Models: Properties
Context of applications

Probability distribution (PMF, PDF)

Cumulative Distribution Function (CDF)

Mean/Expected Value

Variance and Standard Deviation

7
Discrete Probability Distributions

 Bernoulli Trials
 Binomial Distribution
 Geometric Distribution
 Poisson Distribution
 Poisson Process 8
Modeling of Random Events with
Two-States
 Bernoulli Trials
 Binomial Distribution

9
Bernoulli Trials
 Context: Random events with two possible values
 Two events:Yes/No, True/False, Success/Failure
 Two possible values: 1 for success, 0 for failure.
 Example: Tossing a coin, Packet Transmission Status,
 An experiment comprises n trial.
 Probability Mass Function (PMF): Probability in one trial
p, =
x j 1,= j 1, 2,..., n

PMF: p ( one trial ) = p (x j ) = 1 − p = q , x j = 0 , j = 1, 2 ,..., n
0,
 otherwise

Expected Value: E  X j  = p Variance :V  X j  = σ 2 = p ⋅ (1 − p )

 Bernoulli Process: n trials


p ( X 1 , X 1 ,..., X n , ) = p ( X 1 ) ⋅ p ( X 2 ) ⋅ ... p ( X n )
10
Binomial Distribution
 Context: Number of successes in a series of n trials.
 Example: the number of 'heads' occurring when a coin is tossed 50 times.
 The number of successful transmissions of 100 packets
 Probability Mass Function (PMF)
 Binomial distribution with parameters n and p, X ~ B(n,p)
Probability of having k successes in n trial

n  k n −k n  n!
P ( X = k ) =   p ⋅ (1 − p ) with   =
k   k  k ! ( n − k )!
 where
 k = 0, 1, 2, ......., n k: number of success
 n = 1, 2, 3, ....... n: number of trials
 0<p<1 p = success probability

Expected Value: E [ X ]= n ⋅ p Variance :V [ X ] = σ 2 = n ⋅ p ⋅ (1 − p )

11
Binomial Distribution
Probability of k=2 successes in n=3 trials?
E1: 1 1 0 P(E1)= p(1 and 1 and 0) = p p (1-p) = p2 (1-p)
or
E2: 1 0 1 P(E2)= p(1 and 0 and 1) = p (1-p) p = p2 (1-p)
or
E3: 0 1 1 P(E3)= p(1 and 1 and 0) = p p (1-p) = p2 (1-p)

Probability of k=2 successes in n=3 trials?


p ( X = 2 ) = p ( E 1) + p ( E 2 ) + p ( E 3) = 3 ⋅ p 2 ⋅ (1 − p )
3! 6 2
= ) p ⋅ (1 − p )
⋅ p 2 ⋅ (1 − p=
2! ( 3 − 2 ) ! 2
n  n!
  =
 k  k ! ( n − k )!
12
Modeling of Discrete Random
Time
 Geometric Distribution

13
Geometric Distribution
 Context: the number of Bernoulli trials until achieving the
FIRST SUCCESS.
 It is used to represent random time until a first transition occurs.
PMF

 q k −1 p , k = 0,1, 2,..., n
PMF: p (X= k=
) 
0, otherwise

CDF: F ( X ) =p ( X ≤ k ) =1 − (1 − p )
k

1
Expected Value : E [ X ] =
p k

q 1− p
Variance :V [ X=] σ= 2
=
p2 p2
14
Modeling of Random Number of
Arrivals/Events
 Poisson Distribution
 Poisson Process

15
Poisson Distribution
 Context: number of events occurring in a fixed period of time
 Events occur with a known average rate and are independent
 Possion distribution is characterized by the average rate λ
 The average number of arrival in the fixed time period.

 Examples
 The number of cars passing a fixed point in a 5 minute
interval. Average rate: λ = 3 cars/5 minutes
 The number of calls received by a switchboard during a
given period of time. Average rate: λ =3 call/minutes
 The number of message coming to a router per second
 The number of travelers arriving to the airport for flight
registration

16
Poisson Distribution
 The Poisson distribution with the average rate parameter λ

λk the probability that there are


 exp ( −λ ) for k =
PMF: p ( k=
) P ( X= k=)  k ! 0,1, 2, .... exactly k arrivals in a certain
period of time.
0,
 otherwise
the probability that there are at least k arrivals
λi
k
CDF: F ( k )= p ( X ≤ k )= ∑ i ! ⋅ exp ( −λ )
i =0
in a certain period of time.

Expected value: E [ X ] = λ PMF

Variance: V [ X ] = λ
CDF

17
Example: Poisson Distribution

 The number of cars that enter the parking follows a Poisson


distribution with a mean rate equal to λ = 20 cars/hour

 The probability of having exactly 15 cars entering the parking in one hour:
2015
p (15 ) = P ( X = 15 ) = ⋅ exp ( −20 ) = 0.051649
15!
or
p (15 ) = F (15 ) − F (14 ) = 0.156513 − 0.104864 = 0.051649

 The probability of having more than 3 cars entering the parking in one hour:
p ( X > 3) =1 − p ( X ≤ 3) =1 − F ( 3)
= 1 −  p ( 0 ) + p (1) + p ( 2 ) + p ( 3) 
USE EXCEL/MATLAB
= 0.9999967 FOR COMPUTATIONS
18
Example: Poisson Distribution

Probability Mass Function Cumulative Distribution Function


Poisson (λ = 20 cars/hour) Poisson (λ = 20 cars/hour)

20k
p ( X =k ) = ⋅ exp ( −20 )
k
20i
k! F ( k )= p ( X ≤ k )= ∑
i =0
i!
⋅ exp ( −20 )

19
Modeling of Random Number of
Arrivals/Events
 Poisson Distribution
 Poisson Process

20
Poisson Process

 Process N(t)
 random variable N that depends on time t
 Poisson Process: a Process that has a Poisson Distribution
 N(t) is called a counting poisson process
 There are two types:
 Homogenous Poisson Process: constant average rate
 Non-Homogenous Poissoon Process: variable average rate

21
What is “Stochastic Process”?
State Space = {SUNNY,
RAINNY}
X (day i ) = "S " or " R " : RANDOM VARIABLE that varies with the DAY
X (day 2 ) = "S " X (day 4 ) = "S " X (day 6 ) = "S "

X (day 1) = "S " X (day 3) = " R " X (day 5 ) = " R " X (day 7 ) = "S "

Day
Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7
THU FRI SAT SUN MON TUE WED

X (day i ) IS A STOCHASTIC PROCESS


X(dayi): Status of the weather observed each DAY
22
Examples of using Poisson Process

 The number of web page requests arriving at a server may be


characterized by a Poisson process except for unusual
circumstances such as coordinated denial of service attacks.
 The number of telephone calls arriving at a switchboard, or at an
automatic phone-switching system, may be characterized by a
Poisson process.
 The arrival of "customers" is commonly modelled as a Poisson
process in the study of simple queueing systems.
 The execution of trades on a stock exchange, as viewed on a tick by
tick basis, is a Poisson process.

23
(Homogenous) Poisson Process

 Formally, a counting process {N (τ ) ,τ ≥ 0} is a (homogenous)


Poisson process with constant average rate λ if:
for t ≥ 0 and n =
0,1, 2,...
(λ ⋅ τ ) n
PMF: p  N (t + τ ) − N (t ) = n  = p [ N (τ ) = n ] = exp ( −λ ⋅τ )
n!
N (τ ) N (θ )
t τ t+τ t+τ+θ

 N (t + τ ) − N (t )
describes the number of events in time interval (t , t + τ ]
 The mean and the variance are equal
E  N (τ ) = V  N (τ ) = λ ⋅τ
24
(Homogenous) Poisson Process
 Properties of Poisson process
 Arrivals occur one at a time (not simultaneous)
 {N (τ ) ,τ ≥ 0} has stationary increments, which
means N (t ) − N ( s ) =N (t − s )

The number of arrivals in time s to t is also Poisson-


distributed with mean λ ⋅ (t − s )
 {N (τ ) ,τ ≥ 0} has independent increments

25
CDF of Exponential distribution

Inter-Arrival Times of a Poisson Process


 Inter-arrival time: time between two consecutive arrivals
 The inter-arrival times of a Poisson process are random.
What is its distribution?
 Consider the inter-arrival times of a Poisson process (A1, A2, …), where Ai is
the elapsed time between arrival i and arrival i+1

 The first arrival occurs after time t MEANS that there are no
arrivals in the interval [0,t], As a consequence:
p ( A1 > t ) = p ( N (t ) = 0 ) = exp ( −λ ⋅ t )

p ( A1 ≤ t ) =1 − p ( A1 > t ) =1 − exp ( −λ ⋅ t )

26
The Inter-arrival times of a Poisson process are
exponentially distributed and independent with mean 1/λ
26
Splitting and Pooling

 Splitting
λp N1(t) ~ Poi[λp]
N(t) ~ Poi(λ) λ

λ(1-p) N2(t) ~ Poi[λ(1-p)]

 Pooling
N1(t) ~ Poi[λ1] λ1
λ1 + λ2
N(t) ~ Poi(λ1 + λ2)
N2(t) ~ Poi[λ2] λ2

27
Modeling of Random Number of
Arrivals/Events
 Poisson Distribution
 Non Homogenous Poisson Process

28
Non Homogenous (Non-stationary) Poisson Process
(NSPP)

 The non homogeneous Poisson process is


characterized by a VARIABLE rate parameter λ(t),
the arrival rate at time t. In general, the rate parameter
may change over time.
λ1 λ2 λ3
 The stationary increments, property is not satisfied
∃s , t : N (t ) − N ( s ) ≠ N (t − s )
 The expected number of events (e.g. arrival)
between time s and time t is
t
λs ,t
= ∫s
λ(u) ⋅ du
29
Example: Non-stationary Poisson Process
(NSPP)

 The number of cars that cross the intersection of King Fahd Road and Al-
Ourouba Road is distributed according to a non homogenous Poisson process
with a mean λ(t) defined as follows:
80 cars/mn if 8 am ≤ t ≤ 9am

60 cars/mn if 9am ≤ t ≤ 11pm
λ (t ) = 
50 car/mn if 11am ≤ t ≤ 15 pm
70 car/mn if 15 pm ≤ t ≤ 17 pm

 Let us consider the time 8 am as t=0.
 Q1. Compute the average arrival number of cars at 11H30?
 Q2. Determine the equation that gives the probability of having only 10000 car
arrivals between 12 pm and 16 pm.
 Q3. What is the distribution and the average (in seconds) of the inter-arrival time
of two cars between 8 am and 9 am?
30
Example: Non-stationary Poisson Process
(NSPP)

 Q1. Compute the average arrival number of cars at 11H30?


11:30
λ8:00,11:30
= ∫8:00
λ(u) ⋅ du
9:00 11:00 11:30
= ∫8:00
λ(u) ⋅ du + ∫
9:00
λ(u) ⋅ du + ∫
11:00
λ(u) ⋅ du
= (80cars/mn ⋅ 60mn ) + ( 60cars/mn ⋅120mn ) + ( 50cars/mn ⋅ 30mn
= ) 13500 cars
 Q2. Determine the equation that gives the probability of having only 10000 car
arrivals between 12 pm and 16 pm.
We know that the number of cars between 12 pm and 16 pm, i.e.  N (16 ) − N (12 ) 
 
follows a Poisson distribution. During 12 pm and 16pm, the average number of
cars is λ
12:00 →16:00 = 180 ⋅ 50 + 60 ⋅ 70 = 13200 cars
Thus,
(13200 )
10000

p  N (16 ) − N (12= ) 10000= ⋅ exp ( −13200 )


10000!
 Q3. What is the distribution and the average (in seconds) of the inter-arrival time
of two cars between 8 am and 9 am? (Homework) 31
Continuous Probability Distributions

 Uniform Distribution
 Exponential Distribution
 Normal (Gaussian) Distribution

32
Uniform Distribution

33
Continuous Uniform Distribution
 The continuous uniform distribution is a family of probability
distributions such that for each member of the family, all intervals of
the same length on the distribution's support are equally probable
 A random variable X is uniformly distributed on the interval [a,b],
U(a,b), if its PDF and CDF are:

0, x a
 1 x −a
 , a ≤ x ≤b 
PDF: f (x ) = b − a =
CDF: F (x )  , a ≤x b
0,  b − a
otherwise
1, x ≥b

Expected value: E [ X ] =
a +b ( a + b )2
Variance: V [ X ] =
2 12

34
Uniform Distribution

PDF

 Properties
 p ( x 1 ≤ X ≤ x 2 )is proportional to the
length of the interval

X 2 −X1
F (X 2 ) − F (X 1 ) =
b −a

CDF
 Special case: a standard
uniform distribution U(0,1).
 Very useful for random number
generators in simulators

35
Exponential Distribution

 Modeling Random Time

36
Exponential Distribution

 The exponential distribution describes the times between


events in a Poisson process, in which events occur continuously
and independently at a constant average rate.
 A random variable X is exponentially distributed with
parameter µ=1/λ > 0 if its PDF and CDF are:
1  x 
λ ⋅ exp ( −λ ⋅ x ) , x ≥0  ⋅ exp  − , x ≥0
PDF: f (x ) =  f (x ) =  µ  µ
0, otherwise 0,
 otherwise

0, x <0 0, x <0


CDF: F (x ) =  x − λt 
F (x ) =   x 
 ∫0 λe dt =
1 − e −λx , x ≥ 0
1 − exp  − , x ≥0
  µ

1
Variance: V [ X=]
1
Expected value: E [ X =
] = µ = µ 2
λ λ 2 37
Exponential Distribution

µ=20 µ=20

1  x  0, x <0
 ⋅ exp  − , x ≥0 
f (x ) =  20  20  F (x ) =   x 
0, 1 − exp  − , x ≥0
 otherwise   20 

38
Exponential Distribution
 The memoryless property: In probability theory, memoryless is a
property of certain probability distributions: the exponential distributions
and the geometric distributions, wherein any derived probability from a set
of random samples is distinct and has no information (i.e. "memory") of earlier
samples.
 Formally, the memoryless property is:
For all s and t greater or equal to 0:
s ) p (X > t )
p (X > s + t | X > =

 This means that the future event do not depend on the past event, but only on
the present event
 The fact that Pr(X > 40 | X > 30) = Pr(X > 10) does not mean that the events X > 40 and X
> 30 are independent; i.e. it does not mean that
Pr(X > 40 | X > 30) = Pr(X > 40).

39
Exponential Distribution

 The memoryless property: can be read as “the probability that


you will wait more than s+t minutes given that you have already
been waiting s minutes is equal to the probability that you will wait
t minutes.”
 In other words “The probability that you will wait s more minutes
given that you have already been waiting t minutes is the same as
the probability that you had wait for more than s minutes from the
beginning.”

p (X > s + t | X > =
s ) p (X > t )
 The fact that Pr(X > 40 | X > 30) = Pr(X > 10) does not mean that the
events X > 40 and X > 30 are independent; i.e. it does not mean that
Pr(X > 40 | X > 30) = Pr(X > 40).

40
Example: Exponential Distribution

 The time needed to repair the engine of a car is exponentially


distributed with a mean time equal to 3 hours.
 The probability that the car spends more than 3 hours in reparation
  3 
p ( X > 3) =1 − p ( X ≤ 3) =1 − F ( 3) =1 − 1 − exp  −   =0.368
  3 
 The probability that the car repair time lasts between 2 to 3 hours is:

p ( ≤ X ≤ 3=
) F ( 3) − F ( 2=) 0.145
 The probability that the repair time lasts for another hour given it has been
operating for 2.5 hours:
Using the memoryless property of the exponential distribution, we have:

 1
p ( X > ( 2.5 + 1) | X > 2.5 ) =p ( X > 1) =1 − p ( X ≤ 1) =exp  −  =0.717
 3
41
Normal (Gaussian) Distribution

42
Normal Distribution

 The Normal distribution, also called the Gaussian


distribution, is an important family of continuous probability
distributions, applicable in many fields.
 Each member of the family may be defined by two parameters,
location and scale: the mean ("average", μ) and variance
(standard deviation squared, σ2) respectively.
 The importance of the normal distribution as a model of
quantitative phenomena in the natural and behavioral sciences
is due in part to the Central Limit Theorem.
 It is usually used to model system error (e.g. channel error), the
distribution of natural phenomena, height, weight, etc.

43
Normal or Gaussian Distribution

 A continuous random variable X, taking all real values in the


range (-∞,+∞) is said to follow a Normal distribution with
parameters µ and σ if it has the following PDF and CDF:
1  1  x − µ 2 
PDF: f ( x=
) ⋅ exp  −   
σ ⋅ 2π  2  σ  
x
1   x − µ  where
∫ ( )
2
CDF: F ( x ) = ⋅ 1 + erf    Error Function: erf ( x ) = ⋅ exp −t 2
2   σ ⋅ 2  π 0

 The Normal distribution is denoted asX ~ N ( µ , σ 2 )


 This probability density function (PDF) is
 a symmetrical, bell-shaped curve,
 centered at its expected value µ.
 The variance is σ2.
44
Normal distribution
 Example
 The simplest case of the normal distribution, known as the Standard
Normal Distribution, has expected value zero and variance one. This is
written as N(0,1).

45
Normal Distribution
 Evaluating the distribution:
 Independent of µ and σ, using the standard normal distribution:
Z ~ N ( 0,1) z 1 −t 2 / 2
, where Φ ( z ) = ∫ e dt
−∞

X −µ
 Transformation of variables: let Z =
σ

 x−µ 
F ( x ) = P ( X ≤ x ) = P Z ≤ 
 σ 
( x−µ ) /σ 1 −z2 / 2
=∫ e dz
−∞

( x−µ ) /σ
=∫ φ ( z )dz = Φ ( xσ− µ )
−∞
46
Normal Distribution
 Example: The time required to load an oceangoing vessel, X, is
distributed as N(12,4)
 The probability that the vessel is loaded in less than 10 hours:
 10 − 12 
F (10) = Φ  = Φ (−1) = 0.1587
 2 
 Using the symmetry property, Φ(1) is the complement of Φ (-1)

47
Empirical Distribution

48
Empirical Distributions

 An Empirical Distribution is a distribution whose


parameters are the observed values in a sample of data.
 May be used when it is impossible or unnecessary to establish
that a random variable has any particular parametric
distribution.
 Advantage: no assumption beyond the observed values in the
sample.
 Disadvantage: sample might not cover the entire range of
possible values.

49
Empirical Distributions
 In statistics, an empirical distribution function is a cumulative
probability distribution function that concentrates probability
1/n at each of the n numbers in a sample.
 Let X1, X2, …, Xn be iid random variables in with the CDF equal to
F(x).
 The empirical distribution function Fn(x) based on sample X1, X2, …,
Xn is a step function defined by
n
number of element in the sample ≤ x
∑ I (X
1
Fn ( x )
= = i ≤x)
n n i =1
1 if ( X i ≤ x )
where I(A) is the indicator of event A.I ( X i ≤ x ) =
0 otherwise
 For a fixed value x, I(Xi≤x) is a Bernoulli random variable with
parameter p=F(x), hence nFn(x) is a binomial random variable
with mean nF(x) and variance nF(x)(1-F(x)).
50
End
51

You might also like