You are on page 1of 136

MEE2013 Modeling and Simulation

of Manufacturing Systems

L2.4 Discrete distribution review and Continuous


distribution, Problems based on Examples

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Discrete Distributions
Discrete random variables are used to describe random phenomena in which
only integer values can occur.
We have learned about:
• Bernoulli trials and Bernoulli distribution
• Binomial distribution
• Poisson distribution
Bernoulli trials: Consider an experiment consisting of n trials, each can be a
success or a failure.

where mean E(Xj) = p and variance V(Xj) = p(1-p) = pq

18.03.2021 Dr. Ashish Kumar Saxena 2


Discrete Distributions
Binomial: The number of successes in n Bernoulli trials, X, has a binomial
distribution.

The mean, E(x) = p + p + … + p = n×p


The variance V(X) = pq + pq+ + pq = n×pq
18.03.2021 Dr. Ashish Kumar Saxena 3
Discrete Distributions
Negative Binomial Distribution
The number of Bernoulli trials, X, until the k-th success

If X is a negative binomial distribution with parameters p and k, then:

E(X) = k/p and V(X) = kq/p2

18.03.2021 Dr. Ashish Kumar Saxena 4


Discrete Distributions
Poisson distribution: describes many random processes quite well and is
mathematically quite simple.

18.03.2021 Dr. Ashish Kumar Saxena 5


Problems example 1
Example: A computer repair person is “beeped” each time there is a call for
service. The number of beeps per hour Poisson(α = 2 per hour).
Solution

The probability of three beeps in the next hour:

The probability of two or more beeps in an 1-hour period:

18.03.2021 Dr. Ashish Kumar Saxena 6


Continuous distribution
Continuous random variables can be used to describe random phenomena in
which the variable can take on any value in some interval.

In this section common distributions are


• Uniform
• Exponential
• Gamma
• Weibull
• Normal
• Lognormal

18.03.2021 Dr. Ashish Kumar Saxena 7


Continuous distribution

18.03.2021 Dr. Ashish Kumar Saxena 8


Continuous distribution

18.03.2021 Dr. Ashish Kumar Saxena 9


Continuous distribution

18.03.2021 Dr. Ashish Kumar Saxena 10


Exponential distribution
Exponential distribution
For a random variable x, the probability density function defined as
Exponential PDF
𝒇 𝒙 = 𝝀𝒆−𝝀𝒙
𝝀 =1
• Decreasing function with x
• Maximum value at x=0, i.e. 

Applicability of exponential distribution


• To model the events, when arrival time is completely random and to
model the service time, that is highly variable
• To model the lifetime of components, that fails catastrophically

18.03.2021 Dr. Ashish Kumar Saxena 11


Properties of exponential distribution
Properties
• The mean of function = 1/
• Variance of the function =1/2
• The cumulative distribution function

• One of most important property of exponential distribution that it is a


memoryless function
• For all s and t greater or equal to 0:
𝑃(𝑋 > 𝑠 + 𝑡)
𝑃 𝑋 >𝑠+𝑡 𝑋 >𝑠 =
𝑃(𝑋 > 𝑠)
𝑒 −𝜆(𝑠+𝑡)
=
𝑒 −𝜆𝑡
= 𝑃(𝑋 > 𝑡)
18.03.2021 Dr. Ashish Kumar Saxena 12
Exponential distribution
Let us consider an industrial lamp, whose life is exponentially distributed with service life
3000 hours. Then find out the probability of industrial lamp survive more than 3000 hour.

Solution: As given service life 3000 hours, failure rate =1/3000,


As we know
Probability of failure of bulb in 3000hours + Probability of failure of bulb after 3000 hours =1
P(X<3000) + P(X>3000) = 1
From cumulative distribution function for exponential function
F(X<3000) = 1 − 𝑒 −𝜆𝑥 , Where X=3000,
3000
−3000
Thus F(X<3000) = 1 − 𝑒 = 1 − 𝑒 −1
But as we have P(X<3000) + P(X>3000) = 1
(1 − 𝑒 −1 ) + P(X>3000) = 1
P(X>3000) = 𝑒 −1
P(X>3000) = 𝟎. 𝟑𝟔𝟖

18.03.2021 Dr. Ashish Kumar Saxena 13


Memoryless property of Exponential distribution
For all s and t greater or equal to 0:
𝑃 𝑋 > 𝑠 + 𝑡 𝑋 > 𝑠 = 𝑃(𝑋 > 𝑡)

Example A lamp failure rate is 1/3 per hour, that mean on average 1 failure per 3 hours

The probability that the lamp will last more than its mean life is
P(X>3)= 1 – P(X<3)
−3
=1 – (1 - 𝑒 ) = e-1= 0.368
3

The probability that the lamp will lasts more than 2 hours but less than 3 hours is:
P(2≤X≤3)= F(3) - F(2)
−3 −2
= (1 − 𝑒 ) − (1 − 𝑒 )=0.148
3 3

The probability that the lamp will lasts for 1 more hour , it is given that the lamp is
already operated 2.5 hours :
−1
P(X<3.5| X>2.5) = P(X>1)=𝑒 =0.717 3

18.03.2021 Dr. Ashish Kumar Saxena 14


Problems example
A component can be manufactured by either of two manufacturing processes A &
B. The process ‘A’ cost of INR 100/- and ‘B’ costs 150/-. Components have
exponential time to failure. Component manufactured by ‘A’ have failure rate of
1/200 per hour and ‘B’ have failure rate of 1/300 failures per hour. As of warranty
clause, the company pays replaces the component if it fails before 400 hours.
Decide the economical manufacturing process.

18.03.2021 Dr. Ashish Kumar Saxena 15


Solution
As per question,
The rate of failure of component A (𝜆𝐴 )= 1/200 per hour, Cost of component A = 100/-
The rate of failure of component B (𝜆𝐵 )= 1/300 per hour, Cost of component B = 150/-
Now warranty clause provide the replacement until 400 hours
Now we need to calculate the probability of failure of component A and B until 400 hours
As per question, component have Exponential time to failure and
We also from exponential failure principle
Probability of surviving component with in mean life is given by F(X≥0) =1 − 𝑒 −𝜆𝑥 𝑓𝑜𝑟 𝑥 ≥ 0
Probability of surviving outside mean service life of component =𝑒 −𝜆𝑥
Thus,
𝑥 400
Probability of surviving component A until 400 hours =𝑒 − Τ200 = 𝑒 − Τ200 = 𝑒 −2 =0.1353
Similarly,
𝑥 400
Probability of surviving component B until 400 hours = 𝑒 − Τ300 = 𝑒 − Τ300 = 𝑒 −1.33 = 0.2636

Relative cost of component A to provide replacement until 400 hours


𝐶𝑜𝑠𝑡 𝑜𝑓 𝑜𝑛𝑒 𝐴 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 100
= = = 739.09
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑜𝑓 𝑠𝑢𝑟𝑣𝑖𝑣𝑖𝑛𝑔 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝐴 𝑢𝑛𝑡𝑖𝑙𝑙 400 ℎ𝑜𝑢𝑟𝑠 0.1353
Relative cost of component B to provide replacement until 400 hours
𝐶𝑜𝑠𝑡 𝑜𝑓 𝑜𝑛𝑒 𝐵 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 150
= = = 569.04
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑜𝑓 𝑠𝑢𝑟𝑣𝑖𝑣𝑖𝑛𝑔 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛t 𝐵 𝑢𝑛𝑡𝑖𝑙𝑙 400 ℎ𝑜𝑢𝑟𝑠 0.2636

Thus for manufacturer the economical way to produce is Component B production


18.03.2021 Dr. Ashish Kumar Saxena 16
Any Question ?

18.03.2021 Dr. Ashish Kumar Saxena 17


MEE2013 Modeling and Simulation
of Manufacturing Systems

L2.5 Continuous distribution Examples

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Continuous distribution
Continuous random variables can be used to describe random phenomena in
which the variable can take on any value in some interval.

In this section common distributions are


• Uniform
• Exponential
• Gamma
• Weibull
• Normal
• Lognormal

17.03.2021 Dr. Ashish Kumar Saxena 2


Weibull distribution
• A random variable X has a Weibull distribution if its PDF has the
form:

• It has 3 parameters:
• Location parameter: , (- <  <  )
• Scale parameter: β, (β>0)
• Shape parameter: , (>0)

• Example:  =0 and  = 1:

17.03.2021 Dr. Ashish Kumar Saxena 3


Weibull distribution
• Weibull distribution

• For β = 1, = 0

17.03.2021 Dr. Ashish Kumar Saxena 4


Normal distribution
 A random variable X is Normal distributed if has the PDF:

• Mean: - <  < 


• Variance: σ2 > 0
• Denoted as X ~ N (, σ2 )
 Normal distribution has following properties:
• lim 𝑓 𝑥 = 0 𝑎𝑛𝑑 lim 𝑓 𝑥 = 0
𝑥→−∞ 𝑥→∞
• 𝑓 𝜇 − 𝑥 = 𝑓 𝜇 + 𝑥 ; the PDF is symmetric about .
• The maximum value of the PDF occurs at x-
the mean and mode are equal

17.03.2021 Dr. Ashish Kumar Saxena 5


Normal distribution
 Evaluating Normal distribution:
• Use numerical method (no closed form)
• Independent of  and σ, using the standard normal distribution
ZN(0,1)
• Transformation of variables:
𝑋−𝜇
𝑍=
𝜎
𝑋−𝜇
𝐹 𝑥 = 𝑃(𝑋 ≤ 𝑥) = 𝑃 ቆ𝑍 ≤ ቇ
𝜎

17.03.2021 Dr. Ashish Kumar Saxena 6


Example on Normal distribution
 The time required to an oceangoing vessel, X is distributed as
N(12, 4):  = 12, σ = 2

• Find out the probability that the vessel is loaded in less than 10
hours
10 − 12
𝐹 10 = ϕ ቆ ቇ = ϕ −1 = 1 − ϕ 1
2
=0.1587

• Using the symmetry property, ϕ 1 is he complement of ϕ −1 ,


i.e. ϕ −𝑥 = 1 − ϕ 𝑥

17.03.2021 Dr. Ashish Kumar Saxena 7


Normal distribution

Why is the normal distribution important?


• The most commonly used distribution in data analysis
• The sum of n independent normal variates is a normal variate.
• The sum of a large number of independent observations from any
distribution has a normal distribution.

17.03.2021 Dr. Ashish Kumar Saxena 8


Lognormal distribution
 A random variable X has a Lognormal distribution if its PDF has the
form:

2
𝜇+𝜎 ൗ2
• Mean: E(X)= 𝑒
𝜎2 2
• Variance: V(X) = 𝑒 2𝜇+ ൗ2 (𝑒 𝜎 − 1)

 Relationship with Normal distribution :


• When 𝑌~ 𝑁 𝜇, 𝜎 2 , then 𝑋 = 𝑒 𝑌 ~𝑙𝑜𝑔𝑛𝑜𝑟𝑚𝑎𝑙 𝜇, 𝜎 2 ,
• Parameters  and σ2 are not the mean and variance of the
lognormal random variable X

17.03.2021 Dr. Ashish Kumar Saxena 9


Empirical distributions
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.

17.03.2021 Dr. Ashish Kumar Saxena 10


Empirical distributions: Example
• Customers arrive in groups from 1 to 8 persons
• Observation of the last 300 groups has been reported
• Summary in the table below

17.03.2021 Dr. Ashish Kumar Saxena 11


Empirical distributions: Example

17.03.2021 Dr. Ashish Kumar Saxena 12


Any Question ?

17.03.2021 Dr. Ashish Kumar Saxena 13


MEE2013 Modeling and Simulation
of Manufacturing Systems
Module 3 Random-Number Generation
L3.1 Random numbers, Properties of random numbers

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Random numbers generation - Overview

• Random number and Properties


• Pseudo random numbers
• Techniques for generating random numbers
• Linear Congruential Method
• Combined Linear Congruential generators
• Testing of random numbers

19.03.2021 Dr. Ashish Kumar Saxena 2


Random numbers and Properties
A random number is number generated by a process, such that outcome
is always unpredictable and cannot be sequentially reproduced.

There are important and expected statistical properties of random


numbers :
• Uniform over defined interval or set
• Independent so that future values can not be predicted

Random numbers are important in statistical analysis and probability


theory.

The most common set from which random numbers are derived is the
set of double digit decimal number. {0,0.11,0.82,0.63,0.44,0.65,
0.36,0.27,0.18,0.99}

Other set is all possible real number between 0 to 1


19.03.2021 Dr. Ashish Kumar Saxena 3
Properties of random numbers
Independent means if R1, R2,……… are the random numbers, they must
be independent samples chosen from continuous uniform statistical
distribution.
1, 0 ≤ 𝑥 ≤ 1
i.e. 𝑓 𝑥 = ቊ
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

• The mean value E(R)= ½


1 1
𝑥2 1
𝐸 𝑥 = න 𝑥𝑑𝑥 = =
0 2 0
2

• The variance is E(x2)- E(x)2= (1/12)


1 2 1
1 𝑥3 1 1
𝑉𝐴𝑅 𝑥 = න 𝑥 2 𝑑𝑥 − = − =
0 2 3 0
4 12

19.03.2021 Dr. Ashish Kumar Saxena 4


Expected properties of random numbers

• Uniformity
• If the interval [0,1] is divided into n classes, or subintervals
of equal length, the expected number of observations in
each interval is N/n, Where N is the total number of
observations

• Independence
• The probability of observing a value in a particular interval
is independent of previous values drawn

19.03.2021 Dr. Ashish Kumar Saxena 5


Pseudo random numbers

• Random number are needed for simulation


• It is also need machines that can generate Random numbers
• These machine use algorithms

• If someone is following a logical pattern, than it is not random


number, but known as Pseudo Random Numbers

19.03.2021 Dr. Ashish Kumar Saxena 6


Limitation of Pseudo random numbers
• The generated numbers are not uniformly distributed
• The generated numbers might be discrete valued instead of
continuous valued
• The mean of the generated numbers might be too high or too low
• The variance of the generated numbers might be too high or too low
• There might be dependence like
• Autocorrelation between numbers
• Numbers successively higher or lower than adjacent numbers
• Several numbers above the mean followed by several numbers
below the mean

19.03.2021 Dr. Ashish Kumar Saxena 7


Congruential/Residue Method

First the simplest of all methods [Proposed by Lehmer(1951)]: Can


produce sequence of integers between 0 and m-1, as per following
relationship
𝑅𝑖+1 = 𝑎𝑅𝑖 + 𝑐 mod𝑢𝑙𝑜 𝑚, 𝑓𝑜𝑟 𝑖 = 0,1,2,3 … … .

Here 𝑅0  𝑆𝑒𝑒𝑑, 𝑎𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑒𝑟, 𝑐𝑖𝑛𝑐𝑟𝑒𝑚𝑒𝑛𝑡,


𝑚 𝑚𝑜𝑑𝑢𝑙𝑜 (meaning remainder after division)

If a=1, 𝑅𝑖+1 = 𝑅𝑖 + 𝑐 mod𝑢𝑙𝑜 𝑚 additive type method,


If c=0, 𝑅𝑖+1 = 𝑎𝑅𝑖 mod𝑢𝑙𝑜 𝑚 multiplicative type,
If c  0, mixed congruential method
So choice of 𝑅0 , 𝑎, c and m are very crucial

Problem 1 Generate the Random numbers with the following initial


values. 𝑅0 = 45, 𝑎 = 32, 𝑐 = 52, 𝑚 = 100
19.03.2021 Dr. Ashish Kumar Saxena 8
Any Question ?

19.03.2021 Dr. Ashish Kumar Saxena 9


MEE2013 Modeling and Simulation
of Manufacturing Systems

L3.2 Linear Congruential Method Choice of initial values

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Expected properties of random numbers

• Uniformity
• If the interval [0,1] is divided into n classes, or subintervals
of equal length, the expected number of observations in
each interval is N/n, Where N is the total number of
observations

• Independence
• The probability of observing a value in a particular interval
is independent of previous values drawn

24.03.2021 Dr. Ashish Kumar Saxena 2


Linear Congruential/Residual Method

It can produce sequence of integers between 0 and m-1, as per


following relationship
𝑋𝑖+1 = 𝑎𝑋𝑖 + 𝑐 mod𝑢𝑙𝑜 𝑚, 𝑓𝑜𝑟 𝑖 = 0,1,2,3 … … .

Here 𝑋0  𝑆𝑒𝑒𝑑, 𝑎𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑒𝑟, 𝑐𝑖𝑛𝑐𝑟𝑒𝑚𝑒𝑛𝑡,


𝑚 𝑚𝑜𝑑𝑢𝑙𝑜 (meaning remainder after division)

If a=1, 𝑋𝑖+1 = 𝑋𝑖 + 𝑐 mod𝑢𝑙𝑜 𝑚 additive type method,


If c=0, 𝑋𝑖+1 = 𝑎𝑋𝑖 mod𝑢𝑙𝑜 𝑚 multiplicative type,
If c  0, mixed congruential method

So choice of 𝑿𝟎 , 𝒂, c and m are very crucial

24.03.2021 Dr. Ashish Kumar Saxena 3


Example
Problem 1 Generate the Random numbers with the following initial
values. 𝑋0 = 45, 𝑎 = 32, 𝑐 = 52, 𝑚 = 100
Solution:
𝑋1 = 𝑎𝑋0 + 𝑐 𝑚𝑜𝑑 𝑚 = 32 ∗ 45 + 52 𝑚𝑜𝑑 100
=(1440+52) mod 100 = 1492 mod 100= 92/100
=0.92
𝑋2 = 𝑎𝑋1 + 𝑐 𝑚𝑜𝑑 𝑚 = 32 ∗ 92 + 52 𝑚𝑜𝑑 100
=(2944+52) mod 100 = 2996 mod 100= 96/100
=0.96
𝑋3 =0.24
𝑋4 = 0.20
Similar way the other random numbers 0.92, 0.96, 0.24, 0.20

24.03.2021 Dr. Ashish Kumar Saxena 4


Effect of seed (X0)
Continue with same problem
𝑎 = 32, 𝑐 = 52, 𝑚 = 100 𝑿𝟎 = 𝟒𝟓, 65, 87, 13

In this case (for


same set of a, c
and m values)..

Seed number X0
is not making
any difference in
terms of increase
in the numbers
of distinct
random numbers
generation

24.03.2021 Dr. Ashish Kumar Saxena 5


Effect of Increment (c)
Continue with same problem
𝑋0 = 43, 𝑎 = 32, 𝑚 = 100 𝒄 = 𝟓𝟐, 55, 67, 83

In this case (for


same set of 𝑋0 , a
and m values)..

Increment is Not
making much
difference in
most cases in
terms of increase
in the numbers
of distinct
random numbers
generation

24.03.2021 Dr. Ashish Kumar Saxena 6


Effect of Multiplier (a)
Continue with same problem
𝑋0 = 43, 𝑐 = 52, 𝑚 = 100 𝒂 = 𝟑𝟐, 35, 31, 33

In this case (for


same set of 𝑋0 , c
and m values)..

Multiplier a is
making much
difference in
terms of increase
in the numbers
of distinct
random numbers
generation

24.03.2021 Dr. Ashish Kumar Saxena 7


Effect of Modulo (m)
Continue with same problem
𝑋0 = 43, 𝑎 = 31, 𝑐 = 52, 𝒎 = 𝟏𝟎, 𝟒𝟕, 𝟕𝟐, 𝟏𝟎𝟎

In this case (for


same set of 𝑋0 , c
and c values)..

Modulo m is
making much
difference in
terms of increase
in the numbers
of distinct
random numbers
generation

24.03.2021 Dr. Ashish Kumar Saxena 8


Additional properties of random stream
The question comes up in our mind

How closely the generated numbers 𝑋1 , 𝑋2 , 𝑋3 , …….. ,


approximate to uniformity and independence ?

• Maximum density
• Numbers are generated only from the set {0 , 1/m, 2/m, 3/m, …..
(m-1)/m}, because each 𝑋𝑖 is an integer in the set of {0,1,2….m-1}
• The difference between two successive numbers determine the
density, always try to keep maximum
• to obtain maximum density, m should be very large integer,

• Maximum period
• Recurrence of the same sequence after certain number of values
• Period can be maximum by proper selection of a, c, m and 𝑋0
24.03.2021 Dr. Ashish Kumar Saxena 9
Few methods to maximise density and period
• For m a power of 2, say 𝑚 = 2𝑏 and c0, the longest possible period
is P= 𝑚 = 2𝑏 , this can be achieved, if c is relatively prime to m and
a=1+4k

• For m a power of 2, say 𝑚 = 2𝑏 and c=0, the longest possible period


is P=𝑚/4 = 2𝑏−2 , this can be achieved, if 𝑋0 is odd and multiplier
a=3+8k or a=5+8k

• For m a prime number and c=0, the longest possible period is


P=𝑚 − 1, which can be achieved when multiplier a has such that
(𝑎𝑚−1 −1) is divisible by m

24.03.2021 Dr. Ashish Kumar Saxena 10


Periodicity of random number
• For m a power of 2, say 𝑚 = 2𝑏 and c0, the longest possible period
is P= 𝑚 = 2𝑏 , this can be achieved, if c is relatively prime to m and
a=1+4k
Example 2: Generate random number with m=24, c= 3 & 5, a=5, X0=6 & 7

24.03.2021 Dr. Ashish Kumar Saxena 11


Periodicity of random number
• For m a power of 2, say 𝑚 = 2𝑏 and c=0, the longest possible period is
P=𝑚/4 = 2𝑏−2 , this can be achieved, if 𝑋0 is odd and multiplier
a=3+8k or a=5+8k
Example 3: Generate the random number with m=26 , c=0 and X0=1 & 3
and a=11, 13

24.03.2021 Dr. Ashish Kumar Saxena 12


Periodicity of random number
• For m a prime number and c=0, the longest possible period is P=𝑚 − 1
which can be achieved, when multiplier a has such that (𝑎𝑚−1 −1) is
divisible by m
Example 4: Generate the random number with a=13, m=13, c=0 and
X0=1,2,3 &4

24.03.2021 Dr. Ashish Kumar Saxena 13


Any Question ?

24.03.2021 Dr. Ashish Kumar Saxena 14


MEE2013 Modeling and Simulation
of Manufacturing Systems

L3.3 Mid square method, Testing of generated random


numbers

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Few methods to maximise density and period
• For m a power of 2, say 𝑚 = 2𝑏 and c0, the longest possible period
is P= 𝑚 = 2𝑏 , this can be achieved, if c is relatively prime to m and
a=1+4k

• For m a power of 2, say 𝑚 = 2𝑏 and c=0, the longest possible period


is P=𝑚/4 = 2𝑏−2 , this can be achieved, if 𝑋0 is odd and multiplier
a=3+8k or a=5+8k

• For m a prime number and c=0, the longest possible period is


P=𝑚 − 1, which can be achieved when multiplier a has such that
(𝑎𝑚−1 −1) is divisible by m

26.03.2021 Dr. Ashish Kumar Saxena 2


Other method for generating Random number
Mid square method
• Take any four digit number (as seed) X0
• Find its square
• Get central four digits X1
• Again get square of X1
• Get central four digits X2
• ..
• …..
Example
Lets have seed X0 = 3546
X0 square =12574116=> 12574116 => X1=5741
X1 square = 32959081 => 32959081 => X2=9590
X2 square = 91968100 => 91968100 => X3=9681
X3 square = 93721761 => 93721761=> X4=7217

26.03.2021 Dr. Ashish Kumar Saxena 3


Test for Random number
• Frequency test:

This test uses the Kolmogorov-Smirnov or the Chi-square test to


compare the distribution of the set of numbers generated to a
uniform distribution

• Autocorrelation test:

It test the correlation between numbers and compares the sample


correlation to the expected correlation, zero

26.03.2021 Dr. Ashish Kumar Saxena 4


Test for Random number
• Uniformity test : The hypotheses are as follows
H0 :Ri  U[0,1]
H1 :Ri ≁ U[0,1]

Null hypothesis H0 , reads that the numbers are distributed


uniformly on the interval [0,1]

Failure to reject the null hypothesis means that evidence of non


uniformity has been detected by this test.

This test does not imply that further testing of the generator for
uniformity is unnecessary.

26.03.2021 Dr. Ashish Kumar Saxena 5


Test for Random number
• Independence test : The hypotheses are as follows
H0 :Ri  independently
H1 :Ri ≁ independently

Null hypothesis H0 , reads that the numbers are independent

Failure to reject the null hypothesis means that evidence of


independence has not been detected on the basis of this test.

This test does not imply that further testing of the generator for
independence is unnecessary.

26.03.2021 Dr. Ashish Kumar Saxena 6


Frequency tests
A basic test that should be performed to validate a new generator is test
for uniformity.

There are two most common methods to test uniformity:


• Kolmogorov-Smirnov Test
• Chi-square test

Basic aim of test to measure :


“How much degree of agreement between the distribution of a
sample of generated random numbers and theoretical uniform
distribution”

Both tests are based on null hypothesis of no significant difference


between the sample distribution and theoretical distribution

26.03.2021 Dr. Ashish Kumar Saxena 7


Kolmogorov-Smirnov Test
Compare continuous cdf F(x), of the uniform distribution with the
empirical cdf SN(x) of the sample of N observations
As we know from definition
𝐹 𝑥 = 𝑥, 0≤𝑥≤1

If the sample from the random number generator is R1, R2, ………. RN
then the empirical cdf SN(x) is defined by
𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑅1 , 𝑅2 ………….𝑅𝑁 ,𝑤ℎ𝑖𝑐ℎ 𝑎𝑟𝑒 ≤𝑥
𝑆𝑁 𝑥 =
𝑁

As N becomes larger, SN(x) should become a better approximation to


F(x) Provided that the null hypothesis is true

This test is based on the largest absolute deviation between F(x) and
SN(x) over the range of variables. i.e.
𝐷 = 𝑚𝑎𝑥 𝐹 𝑥 − 𝑆𝑁 (𝑥)
The26.03.2021
sampling distribution of DDr.isAshish
known and is tabulated as function 8of N
Kumar Saxena
Kolmogorov-Smirnov Test
Procedural steps:
Step 1: Rank the data from smallest to large. Let 𝑅(𝑖) denote the ith
smallest observation so that
𝑅(1) ≤ 𝑅 2 ≤ 𝑅 3 ≤ ⋯ … … … … … … … … … … … … . ≤ 𝑅(𝑁)
Step 2: Compute
+
𝑖
𝐷 = 𝑚𝑎𝑥1≤𝑖≤𝑁 { − 𝑅(𝑖) }
𝑁

𝑖−1
𝐷 = 𝑚𝑎𝑥1≤𝑖≤𝑁 {𝑅 𝑖 − }
𝑁
Step 3: Compute D = max(𝐷 , 𝐷 ) + −

Step 4: Determine the critical value of 𝐷𝛼 from the table for specified
significance level  and given sample size
Step 5: If the sample statistic D is greater than the critical value 𝐷𝛼 , the
null hypothesis that data are sample from a uniform distribution is
rejected
If D≤𝐷𝛼 , Conclude as No difference has been detected between the true
distribution
26.03.2021 of {𝑅1 , 𝑅2 ,……𝑅𝑁 } Dr.
and Ashishthe
Kumaruniform
Saxena distribution. 9
Kolmogorov-Smirnov
critical values Table

26.03.2021 Dr. Ashish Kumar Saxena 10


Example
The sequence of numbers 0.44, 0.81, 0.14, 0.05 and 0.93 have been
generated. Use Kolmogorov-Smirnov test with  = 0.05 to determine if
the hypothesis that number are uniformly distributed on the interval
[0,1] can be rejected
Solution:
Step 1 𝑅(𝑖) 0.05 0.14 0.44 0.81 0.93
𝑖
Step 2 0.20 0.40 0.60 0.80 1.00
𝑁
𝑖
− 𝑅(𝑖) 0.15 0.26 0.16 ----- 0.07
𝑁
𝑖−1
0.00 0.20 0.40 0.60 0.80
𝑁
𝑖−1
𝑅(𝑖) − 0.05 ------ 0.04 0.21 0.13
𝑁
𝑖 𝑖−1
𝐷+ = 𝑚𝑎𝑥1≤𝑖≤𝑁 −𝑅 𝑖 = 0.26 𝐷− = 𝑚𝑎𝑥1≤𝑖≤𝑁 𝑅 𝑖 − = 0.21
𝑁 𝑁

Step 3 D = max{𝐷+ , 𝐷− }= 0.26


26.03.2021 Dr. Ashish Kumar Saxena 11
Example (continue)
Step 4: The critical value of 𝐷 from the table for given value of
significant =0.05 and Sample of observation N= 5 is 0.56327

The computed value (=0.26) < Tabulated critical value(=0.56327)

Thus the hypothesis of no difference between true distribution of the


generated numbers and the uniform distribution is not rejected

26.03.2021 Dr. Ashish Kumar Saxena 12


Kolmogorov-Smirnov
critical values Table

26.03.2021 Dr. Ashish Kumar Saxena 13


Any Question ?

26.03.2021 Dr. Ashish Kumar Saxena 14


MEE2013 Modeling and Simulation
of Manufacturing Systems

L3.4 Chi-square test, Autocorrelation test

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Test for Random number
• Frequency test:

This test uses the Kolmogorov-Smirnov or the Chi-square test to


compare the distribution of the set of numbers generated to a
uniform distribution

• Autocorrelation test:

It test the correlation between numbers and compares the sample


correlation to the expected correlation, zero

26.03.2021 Dr. Ashish Kumar Saxena 2


Kolmogorov-Smirnov Test
Procedural steps:
Step 1: Rank the data from smallest to large. Let 𝑅(𝑖) denote the ith
smallest observation so that
𝑅(1) ≤ 𝑅 2 ≤ 𝑅 3 ≤ ⋯ … … … … … … … … … … … … . ≤ 𝑅(𝑁)
Step 2: Compute
+
𝑖
𝐷 = 𝑚𝑎𝑥1≤𝑖≤𝑁 { − 𝑅(𝑖) }
𝑁

𝑖−1
𝐷 = 𝑚𝑎𝑥1≤𝑖≤𝑁 {𝑅 𝑖 − }
𝑁
Step 3: Compute D = max(𝐷 , 𝐷 ) + −

Step 4: Determine the critical value of 𝐷𝛼 from the table for specified
significance level  and given sample size
Step 5: If the sample statistic D is greater than the critical value 𝐷𝛼 , the
null hypothesis that data are sample from a uniform distribution is
rejected
If D≤𝐷𝛼 , Conclude as No difference has been detected between the true
distribution
26.03.2021 of {𝑅1 , 𝑅2 ,……𝑅𝑁 } Dr.
and Ashishthe
Kumaruniform
Saxena distribution. 3
Chi-Square Test
The Chi-square test uses the sample statistic
𝑛
(𝑂𝑖 − 𝐸𝑖 )2
0 2 =෍
𝐸
𝑖=1

Where 𝑂𝑖 = Observed number in the ith class


𝐸𝑖 = Expected number in the ith class
n= Number of classes

For the uniform distribution, 𝐸𝑖 , the expected number in each class is


𝑁
𝐸𝑖 = ( 𝑓𝑜𝑟 𝑒𝑞𝑢𝑎𝑙𝑙𝑦 𝑠𝑝𝑎𝑐𝑒𝑑 𝑐𝑙𝑎𝑠𝑠𝑒𝑠)
𝑛
N is the total number of observations

• Chi-square test uses frequency interval rather than all individual values
• Chi-square test can be suitable for testing large stream of numbers

26.03.2021 Dr. Ashish Kumar Saxena 4


Chi-Square Test

Procedural steps:
Step 1: Divide the range into equally spaced subranges

Step 2: Find the frequency of occurrence

Step 3: Find the expected frequency

(𝑂−𝐸)2
Step 4: Determine the chi square statistic 0 = 2 σ
𝐸

Step 5: If calculated value is less than the chi-square value in the table
accept the null hypothesis (i.e.) The sequence is random

26.03.2021 Dr. Ashish Kumar Saxena 5


Chi-Square Table

26.03.2021 Dr. Ashish Kumar Saxena 6


Example
Use chi square test with = 0.05 to test whether the data shown below are uniformly
distributed.

0.34 0.90 0.25 0.89 0.87 0.44 0.12 0.21 0.46 0.67
0.83 0.76 0.79 0.64 0.70 0.81 0.94 0.74 0.22 0.74
0.96 0.99 0.77 0.67 0.56 0.41 0.52 0.73 0.99 0.02
0.47 0.30 0.17 0.82 0.56 0.05 0.45 0.31 0.78 0.05
0.79 0.71 0.23 0.19 0.82 0.93 0.65 0.37 0.39 0.42
0.99 0.17 0.99 0.46 0.05 0.66 0.10 0.42 0.18 0.49
0.37 0.51 0.54 0.01 0.81 0.28 0.69 0.34 0.75 0.49
0.72 0.43 0.56 0.97 0.30 0.94 0.96 0.58 0.73 0.05
0.06 0.39 0.84 0.24 0.40 0.64 0.40 0.19 0.79 0.62
0.18 0.26 0.97 0.88 0.64 0.47 0.60 0.11 0.29 0.78

Take n=10 interval of equal length namely [0.0, 0.1), [0.1, 0.2), [0.2, 0.3), [0.3, 0.4), [0.4,
0.5), [0.5, 0.6), [0.6, 0.7), [0.7, 0.8), [0.8, 0.9) and [0.9, 1.0)

26.03.2021 Dr. Ashish Kumar Saxena 7


Solution using chi –square test

Interval 𝑂𝑖 𝑬𝑖 𝑂𝑖 -𝑬𝑖 (𝑂𝑖 -𝑬𝑖 )2 (𝑂𝑖 -𝑬𝑖 )2/E

0.0 – 0.1 8 10 -2 4 0.4


0.1 – 0.2 8 10 -2 4 0.4
0.2 – 0.3 10 10 0 0 0
0.3 – 0.4 9 10 -1 1 0.1
0.4 – 0.5 12 10 +2 4 0.4
0.5 – 0.6 8 10 -2 4 0.4
0.6 – 0.7 10 10 0 0 0
0.7 – 0.8 14 10 +4 16 1.6
0.8 – 0.9 10 10 0 0 0
0.9 - 1.0 11 10 +1 1 0.1
100 100 3.4

The observed value of 2 is 3.4 this is compared with the critical value 2 0.05,10 = 18.31, Since
2 is much smaller than the tabulated value of 2 0.05,10 ,
Thus, the null hypothesis of uniform distribution is not rejected

26.03.2021 Dr. Ashish Kumar Saxena 8


Chi-Square Table

26.03.2021 Dr. Ashish Kumar Saxena 9


Autocorrelation test

• Autocorrelation is concerned with the dependence between


numbers in a sequence
• The test is used to test the dependence between numbers in given
sequence
• The test looks for correlation between numbers and compares the
sample correlation to expected Zero correlation

26.03.2021 Dr. Ashish Kumar Saxena 10


Test for Autocorrelation
• Testing autocorrelation between every given (m) numbers, which is
starting from ith number.
• The autocorrelation (i,m )between numbers Ri, Ri+m, Ri+2m, Ri+3m,
…….. Ri+(M+1)m, is required to
• The value M is the largest number such that i+(M+1)m ≤ N

• Hypothesis: A nonzero auto correlation implies a lack of


independence, thus hypothesis can be formulated as
H0 :i,m = 0 if the numbers are independent
H1 : i,m 0 if the numbers are dependent

• If the values are uncorrelated:


• For large values of M, the distribution of estimator i,m denoted,
𝜌ෞ
𝑖,𝑚 is approximately normal.

26.03.2021 Dr. Ashish Kumar Saxena 11


Test for Autocorrelation
• Test statistic is :
𝜌ො𝑖,𝑚
𝑍0 =
𝜎ො𝜌 𝑖,𝑚
𝑍0 is distributed normally with mean 0 and variance 1 and

𝑀
1
𝜌ෞ
𝑖,𝑚 = ෍ 𝑅𝑖+𝑘𝑚 𝑅𝑖+ 𝑘+1 𝑚 − 0.25
𝑀+1
𝑘=0

13𝑀 + 7
𝜎ො𝜌 𝑖,𝑚 =
12(𝑀 + 1)

• After computing
Analyse 𝑍0 , if −𝑧𝛼/2 ≤ 𝑍0 ≤ 𝑧𝛼/2 , it do not reject the hypothesis of independence

26.03.2021 Dr. Ashish Kumar Saxena 12


Test for Autocorrelation

• If 𝜌𝑖,𝑚 > 0, the subsequence has positive autocorrelation


• High random numbers tend to be followed by high ones, and
vice versa

• If 𝜌𝑖,𝑚 < 0, the subsequence has negative autocorrelation


• Low random numbers tend to be followed by high ones, and
vice versa

26.03.2021 Dr. Ashish Kumar Saxena 13


Any Question ?

26.03.2021 Dr. Ashish Kumar Saxena 14


MEE2013 Modeling and Simulation
of Manufacturing Systems

L3.5 Autocorrelation method, Procedural steps, and


Problems

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Test for Random number
• Frequency test:

This test uses the Kolmogorov-Smirnov or the Chi-square test to


compare the distribution of the set of numbers generated to a
uniform distribution

• Autocorrelation test:

It test the correlation between numbers and compares the sample


correlation to the expected correlation, zero

31.03.2021 Dr. Ashish Kumar Saxena 2


Test for Autocorrelation
• Autocorrelation is concerned with the dependence among numbers
in a sequence
• This test looks for correlation between Random numbers and
compares the sample correlation to expected Zero correlation

• Testing autocorrelation between every given (m) numbers, which is


starting from ith number.
• The autocorrelation (i,m )between numbers Ri, Ri+m, Ri+2m, Ri+3m,
…….. Ri+(M+1)m, is required to
• The value M is the largest number such that i+(M+1)m ≤ N

• Hypothesis: A nonzero auto correlation implies a lack of


independence, thus hypothesis can be formulated as
H0 :i,m = 0 if the numbers are independent
H1 : i,m 0 if the numbers are dependent
31.03.2021 Dr. Ashish Kumar Saxena 3
Test for Autocorrelation
Procedural steps:
Step 1: Define the hypothesis for independence as
H0 :i,m = 0  Numbers are independent
H1 : i,m 0  Numbers are not independent

Step 2: Find the value of i and lag m. i is the sequence of first number is
given Random number data set and m is interval of numbers in
tested data sequence

Step 3: By using i, m, N, find out the value of M, which is largest integer


obtained by equation 𝑖 + 𝑀 + 1 𝑚 ≤ 𝑁

Step 4: Determine estimator using


𝑀
1
𝜌ෞ
𝑖,𝑚 = ෍ 𝑅𝑖+𝑘𝑚 𝑅𝑖+ 𝑘+1 𝑚 − 0.25
𝑀+1
𝑘=0
31.03.2021 Dr. Ashish Kumar Saxena 4
Test for Autocorrelation
Step 5: Find the standard deviation of estimator using following equ.
13𝑀 + 7
𝜎ො𝜌 𝑖,𝑚 =
12(𝑀 + 1)

ෝ 𝑖,𝑚
𝜌
Step 6: Obtain the value of 𝑍0 = ෝ 𝜌 𝑖,𝑚
𝜎

Step 7: Determine 𝑍𝛼/2 and −𝑍𝛼/2

Step 8: If 𝑍0 value is such that


−𝑍𝛼/2 ≤ 𝑍0 ≤ 𝑍𝛼/2
If condition is satisfied above condition, the null Hypothesis is not
rejected and Random numbers in given data set are independent.

31.03.2021 Dr. Ashish Kumar Saxena 5


Example: Test whether the 3rd , 8th …. and so on, numbers in the
sequence are auto correlated using =0.05, and 𝑍0.025 = 1.96
0.12 0.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.93
0.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.88

Solution: 0.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87

Step1: Independence hypothesis can be stated as


H0 :i,m = 0  Numbers are independent
H1 : i,m 0  Numbers are not independent
Step 2: As given in problem =0.05, i=3, m=5, N=30

Step 3: Obtain value of M [largest integer such that 𝑖 + 𝑀 + 1 𝑚 ≤ 𝑁]


3 + 𝑀 + 1 5 ≤ 30
27
𝑀+1 ≤  𝑀 ≤ 4.4
5
The possible values of M are {4,3,2,1, 0}
But M is largest integer i.e. M=4
31.03.2021 Dr. Ashish Kumar Saxena 6
Step 4: Determine estimator 𝜌𝑖,𝑚 but for case of big data set it is
denoted by cap
𝑀
1
𝜌ෞ
𝑖,𝑚 = ෍ 𝑅𝑖+𝑘𝑚 𝑅𝑖+ 𝑘+1 𝑚 − 0.25
𝑀+1
𝑘=0
1
𝜌ෞ
3,5 = 4+1 0.23 0.28 + 0.28 0.33 + 0.33 0.27 + 0.27 0.05 + 0.05 0.36 −
0.25
= - 0.1945
13𝑀+7 13(4)+7
Step 5: 𝜎ො𝜌 𝑖,𝑚 = = = 0.128
12(𝑀+1) 12(4+1)

ෝ 𝑖,𝑚
𝜌 −0.1945
Step 6: 𝑍0 = = = −1.516
ෝ 𝜌 𝑖,𝑚
𝜎 0.1280

Step 7: As mentioned in the problem itself 𝑍0.025 =1.96


Step 8: Since -1.96≤𝒁𝟎 =-1.516≤1.96,
the null hypothesis is not rejected and number are independent
31.03.2021 Dr. Ashish Kumar Saxena 7
Any Question ?

31.03.2021 Dr. Ashish Kumar Saxena 8


Example: Test whether the 3rd , 8th …. and so on, numbers in the
sequence are auto correlated using =0.05, and 𝑍0.025 = 1.96
0.12 0.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.93
0.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.88
0.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87

Solution:
Here =0.05, i=3, m=5, N=30 and M=4 (largest integer such that
3+(M+1)5≤30)
1 𝑀
𝜌ෞ
𝑖,𝑚 = σ 𝑘=0 𝑅𝑖+𝑘𝑚 𝑅𝑖+ 𝑘+1 𝑚 − 0.25
𝑀+1
1
𝜌ෞ
3,5 = 0.23 0.28 + 0.28 0.33 + 0.33 0.27 + 0.27 0.05 + 0.05 0.36 −
4+1
0.25
= - 0.1945
13𝑀+7 13(4)+7
𝜎ො𝜌 𝑖,𝑚 = = = 0.128
12(𝑀+1) 12(4+1)
ෝ 𝑖,𝑚 −0.1945
𝜌
𝑍0 = ෝ = = −1.516
𝜎𝜌 𝑖,𝑚 0.1280
𝑍0.025 =1.96
31.03.2021 Dr. Ashish Kumar Saxena 9
Since -1.96≤𝑍0 =-1.516≤1.96, the hypothesis is not rejected
Test for Autocorrelation
• Correlation at lag j
𝐶𝑗
𝜌𝑗 =
𝐶𝑜
𝐶𝑗 = 𝐶𝑜𝑣 𝑋𝑖 , 𝑋𝑖+1 = 𝐸 𝑋𝑖 , 𝑋𝑖+𝑗 − 𝐸 𝑋𝑖 𝐸(𝑋𝑖+𝑗 )
𝐶0 = 𝐶𝑜𝑣 𝑋𝑖 , 𝑋𝑖 = 𝐸 𝑋𝑖 , 𝑋𝑖 − 𝐸 𝑋𝑖 𝐸 𝑋𝑖 = 𝐸 𝑋𝑖2 − [𝐸(𝑋𝑖 )]2
= 𝑉𝑎𝑟(𝑋𝑖 )
𝐸 𝑋𝑖 , 𝑋𝑖+𝑗 − 𝐸 𝑋𝑖 𝐸(𝑋𝑖+𝑗 )
𝜌𝑗 =
𝑉𝑎𝑟(𝑋𝑖 )

Assume 𝑋𝑖 = 𝑈𝑖
1 1
𝐸 𝑈𝑖 = and 𝑉𝑎𝑟 𝑈𝑖 =
2 12
1
𝐸 𝑈𝑖 , 𝑈𝑖+𝑗 −
𝜌𝑗 = 4 = 12𝐸 𝑈 , 𝑈
1 𝑖 𝑖+𝑗 − 3
12
31.03.2021 Dr. Ashish Kumar Saxena 10
Any Question ?

31.03.2021 Dr. Ashish Kumar Saxena 11


MEE2013 Modeling and Simulation
of Manufacturing Systems
Module 4 Random-Variate Generation
L4.1 Random-Variate and its generation, Inverse transform
technique

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Random variate generation - Overview

• Random Variate
• Inverse transform technique
• To generate Exponential, Uniform, Triangular and
Weibull distribution
• Acceptance Rejection techniques
• Convolution method

31.03.2021 Dr. Ashish Kumar Saxena 2


Random Variate and Generation
• Earlier module we discussed about the generation of Uniformly
distributed random number.

• Now if we required a series of Random numbers which follows a


particular distribution pattern, that process of generation of
random number is known as Random Variate generation.

• These particular distribution may be some continuous distributions


or discrete distributions.

• There are three common techniques, which can be used for


random variate generation
• Inverse Transform Technique
• Acceptance Rejection Technique
• Convolution Technique
31.03.2021 Dr. Ashish Kumar Saxena 3
Inverse Transform Technique
Inverse Transform Technique (ITT) is used to generate sample of few
following continuous distribution
• Exponential distribution
• Uniform distribution
• Triangular distribution
• Weibull distribution

And ITT also used for sampling wide variety of discrete distributions

This method straight forward but not always most efficient computation
technique

31.03.2021 Dr. Ashish Kumar Saxena 4


ITT to generate Exponentially distributed random number
The probability distribution function of a random variable x, which is
exponentially distributed is given by
𝜆𝑒 −𝜆𝑥 , 𝑥 ≥ 0
𝑓 𝑥 =ቊ
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Where  is number occurrence per unit x
1
Mean of the function 𝐸 𝑥 =
𝜆
1
Variance of the function 𝑉 𝑥 = 2
𝜆
The Cumulative probability Function is given by
0, 𝑥 < 0
𝐹 𝑥 =ቊ
1 − 𝑒 −𝜆𝑥 , 𝑥 ≥ 0
Example:
Lets consider an event have X1, X2, X3……. Interarrival time (which follows
exponential distribution) and  is mean numbers of arrival time unit.
1
Thus, for any value of i, the mean inter-arrival time 𝐸 𝑥𝑖 =
𝜆
31.03.2021 Dr. Ashish Kumar Saxena 5
ITT to generate Exponentially distributed random number
Objective: Develop a procedure for generating Random number
values X1, X2, X3……. , such that they all follow exponential distribution.

Procedural steps:
Step 1: Compute the cdf function of desired random variable
For exponential distribution the cdf function is 𝐹 𝑥 = 1 − 𝑒 −𝜆𝑥 , 𝑥 ≥ 0

Step 2: Set 𝐹 𝑋 = 𝑅 on the range of X


thus exponential distribution 1 − 𝑒 −𝜆𝑋 = 𝑅, 𝑓𝑜𝑟 𝑥 ≥ 0

Step 3: 1 − 𝑒 −𝜆𝑋 = 𝑅
 𝑒 −𝜆𝑋 = 1 − 𝑅  −𝜆𝑋 = ln 1 − 𝑅
1
 𝑋 = − ln 1 − 𝑅
𝜆
 𝑋 = 𝐹 −1 𝑅

31.03.2021 Dr. Ashish Kumar Saxena 6


ITT to generate Exponentially distributed random number

Step 4: Generate uniform random numbers 𝑅1 , 𝑅2 , 𝑅3 … … … … . and


compute desired variates
𝑋𝑖 = 𝐹 −1 𝑅𝑖
1
𝑋𝑖 = − ln 1 − 𝑅𝑖
𝜆

1
𝑋𝑖 = − ln 𝑅𝑖
𝜆

This alternatively justified by the fact that both 𝑅𝑖 and 1-𝑅𝑖 are
uniformly distributed in range [0,1]

31.03.2021 Dr. Ashish Kumar Saxena 7


Example to generate Exponentially distributed random variate
Generation of exponential variates Xi with mean 1, for given random
numbers Ri
i 1 2 3 4 5
Ri 0.1306 0.0422 0.6597 0.7965 0.7696

1
Solution: As we have 𝑋𝑖 = − 𝜆 ln 1 − 𝑅𝑖 , = 1/mean=1
1
𝑋1 = − ln 1 − 𝑅1  𝑋1 = − ln 1 − 0.1306 = 0.13995
𝜆
1
𝑋2 = − ln 1 − 𝑅2  𝑋2 = − ln 1 − 0.0422 = 0.04311
𝜆
1
𝑋3 = − ln 1 − 𝑅3  𝑋3 = − ln 1 − 0.6597 = 1.0779
𝜆
1
𝑋4 = − ln 1 − 𝑅4  𝑋4 = − ln 1 − 0.7965 = 1.5921
𝜆
1
𝑋5 = − ln 1 − 𝑅5  𝑋5 = − ln 1 − 0.7696 = 1.4679
𝜆
i 1 2 3 4 5
Xi 0.13995 0.04311 1.0779 1.5921 1.4679

31.03.2021 Dr. Ashish Kumar Saxena 8


ITT to generate Uniformly Distributed random numbers
Let us consider a random variate X, which is uniformly distributed on the
interval [a,b]. The probability distribution function is given by
1
𝑓 𝑥 = ቐ𝑏 − 𝑎 , 𝑎≤𝑥≤𝑏

Procedural steps: 0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒


Step 1: Compute the cdf function of desired random variable
For uniform distribution the cdf function is
0, 𝑥<𝑎
𝑥−𝑎
𝐹 𝑥 = , 𝑎≤𝑥<𝑏
𝑏−𝑎
1, 𝑥≥𝑏
𝑥−𝑎
Step 2: Set 𝐹 𝑥 = = 𝑅 in the given range of x
𝑏−𝑎

Step 3: After solving for x in terms of R yield


𝑋 =𝑎+ 𝑏−𝑎 𝑅
31.03.2021 Dr. Ashish Kumar Saxena 9
Example to generate Uniformly distributed random variate
Generate 10 random numbers that are uniformly distributed with in
the range [5,7]
Solution: Random Random
Step 1: The cdf function of uniform distribution is No variate=
𝑅𝑖 𝟓 + 𝟐 𝑅𝑖
0, 𝑥<𝑎
𝑥−5 0.263 5.526
𝐹 𝑥 = , 5≤𝑥<7 0.340 5.680
2
1, 𝑥≥7 0.197 6.394
𝑥−5 0.349 5.698
Step 2: 𝐹 𝑥 = = 𝑅 for range 0 ≤ R ≤ 1
2 0.530 6.060
Step 3: 𝑋 = 5 + 2𝑅, for 0 ≤ R ≤ 1 0.805 6.610
0.223 5.446
0.819 6.638
0.996 6.992
0.507 6.014
0.263 5.526
31.03.2021 Dr. Ashish Kumar Saxena 10
Any Question ?

31.03.2021 Dr. Ashish Kumar Saxena 11


MEE2013 Modeling and Simulation
of Manufacturing Systems

L4.2 Use of Inverse transform technique to generate


Triangular and Weibull Random Variate

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Random Variate and Generation
• Now if we required a series of Random numbers which follows a
particular distribution pattern, that process of generation of
random number is known as Random Variate generation.

• There are three common techniques, which can be used for


random variate generation
• Inverse Transform Technique
• Acceptance Rejection Technique
• Convolution Technique

Inverse Transform Technique (ITT) is used to generate sample of few


following continuous distribution
• Exponential distribution
• Uniform distribution
• Triangular distribution
• Weibull distribution
02.04.2021 Dr. Ashish Kumar Saxena 2
ITT to generate Triangular Distributed random numbers
Let us consider a random variate X, which is triangularly distributed in
the interval [a,b]. The probability distribution function is given by
2(𝑥 − 𝑎)
, 𝑓𝑜𝑟 𝑎 ≤ 𝑥 ≤ 𝑐
(𝑏 − 𝑎)(𝑐 − 𝑎)
𝑓 𝑥 =
2(𝑏 − 𝑥)
, 𝑓𝑜𝑟 𝑐 < 𝑥 ≤ 𝑏
(𝑏 − 𝑎)(𝑏 − 𝑐)
Procedural steps:
Step 1: Compute the cdf function of desired random variable
For Triangular distribution the cdf function is
(𝑥 − 𝑎)2
, 𝑓𝑜𝑟 𝑎 ≤ 𝑥 ≤ 𝑐
(𝑏 − 𝑎)(𝑐 − 𝑎)
𝐹 𝑥 =
𝑏−𝑥 2
1− , 𝑓𝑜𝑟 𝑐 < 𝑥 ≤ 𝑏
𝑏−𝑎 𝑏−𝑐

02.04.2021 Dr. Ashish Kumar Saxena 3


ITT to generate Triangular Distributed random numbers
(𝑥−𝑎)2
Step 2: Set 𝐹 𝑥 = = 𝑅 in the range 𝑎 ≤ 𝑥 ≤ 𝑐
(𝑏−𝑎)(𝑐−𝑎)

𝑏−𝑥 2
𝐹 𝑥 =1− = 𝑅 in the range 𝑐 < 𝑥 ≤ 𝑏
𝑏−𝑎 𝑏−𝑐

Step 3: After solving for x, for the range 𝑎 ≤ 𝑥 ≤ 𝑐


it comes out to be
𝑥 = 𝑎 + 𝑅(𝑏 − 𝑎)(𝑐 − 𝑎)

After solving for x, for the range 𝑐 < 𝑥 ≤ 𝑏


it comes out to be
𝑥 = 𝑏 − (1 − 𝑅)(𝑏 − 𝑎)(𝑏 − 𝑐)

02.04.2021 Dr. Ashish Kumar Saxena 4


Example to generate Triangular distributed random variate
Generate random variate for following a triangular distribution with
range [0,5] and mode 3
Solution: As we have a= 0, b=5, c= 3
Step 1: We know cdf for triangular random variate
(𝑥 − 𝑎)2
, 𝑓𝑜𝑟 𝑎 ≤ 𝑥 ≤ 𝑐
(𝑏 − 𝑎)(𝑐 − 𝑎)
𝐹 𝑥 =
𝑏−𝑥 2
1− , 𝑓𝑜𝑟 𝑐 < 𝑥 ≤ 𝑏
𝑏−𝑎 𝑏−𝑐
Step 2:
For 0 ≤ R ≤ 0.6, 𝑥 = 𝑎 + 𝑅(𝑏 − 𝑎)(𝑐 − 𝑎)  𝑥 = 15𝑅

For 0.6 < R ≤ 1, 𝑥 = 𝑏 − (1 − 𝑅)(𝑏 − 𝑎)(𝑏 − 𝑐)


 𝑥 = 5 − 10(1 − 𝑅)

02.04.2021 Dr. Ashish Kumar Saxena 5


Example to generate Triangular distributed random variate
Step 3:
For 0 ≤ R ≤ 0.6, 𝑥 = 15𝑅 Random Random variate
For 0.6 < R ≤ 1, 𝑥 = 5 − 10(1 − 𝑅) No
5 − 10(1 − 𝑅𝑖 )
𝑅𝑖 15𝑅𝑖

0.263 1.986
0.340 2.258
0.697 3.259
0.349 2.288
0.530 2.820
0.805 3.604
0.223 1.829
0.819 3.655
0.996 4.800
0.507 2.758
0.263 1.986

02.04.2021 Dr. Ashish Kumar Saxena 6


Weibull distribution
• It is generalisation of the exponential distribution
• Weibull distribution was introduced as a model for time to failure for
machine and electronic components
• This function is popular in reliability and survival analysis
• Probability Density function
1 𝛽−1 −( 1 𝑥)𝛽
𝑓 𝑥 =ቐ 𝛼 𝛽 𝛽
𝑥 𝑒 𝛼 , 𝑓𝑜𝑟 0 < 𝑥
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Here 1/ is scale parameter (also known as ) while β is shape parameter
• Exponential distribution is one of the special case, when β=1

• The cumulative distribution of this function is given by


0, 𝑓𝑜𝑟 𝑥 ≤ 0
𝐹 𝑥 =ቐ 1 𝛽
− 𝑥
1−𝑒 𝛼 , 𝑓𝑜𝑟 𝑥 > 0
. 02.04.2021 Dr. Ashish Kumar Saxena 7
ITT to generate Weibull Distributed random numbers
Let us consider a random variate X, which is used to model the time to
failure of machines and electronic components.
The Weibull probability distribution function is given by following
relationship.
𝛽 𝛽−1 −(𝑥 )𝛽
𝑓 𝑥 = ቐ𝛼 𝛽
𝑥 𝑒 𝛼 , 𝑓𝑜𝑟 0 < 𝑥
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Procedural steps:
Step 1: Compute the cdf function of desired random variable
For Weibull distribution the cdf function is
𝑥
−(𝛼)𝛽
𝐹 𝑥 =1−𝑒 , X≥0
𝑥
−(𝛼)𝛽
Step 2: Let 𝐹 𝑥 = 1 − 𝑒 = 𝑅 in the given range of X≥0

Step 3: After solving for X in terms of R yield


𝑋 = 𝛼[−𝑙𝑛 1 − 𝑅 ] −1/𝛽 or 𝑋 = 𝛼[−𝑙𝑛 𝑅 ] −1/𝛽
02.04.2021 Dr. Ashish Kumar Saxena 8
Example to generate Weibull distributed random variate
Generate random variate for following a Weibull distribution with range
for which =2 and shape parameter β= 4
Solution: We have =2 and shape parameter Random Random
No variate=
β= 4 𝑅𝑖 2[−𝑙𝑛 𝑅𝑖 ] −1/4
As we know from earlier expression for 0.263 1.860
Weibull distribution 0.340 1.962
𝑋 = 𝛼[−𝑙𝑛 𝑅 ] −1/𝛽 0.197 2.580
For current case of generating ith Random 0.349 1.974
variate, which follow Weibull distribution is 0.530 2.241
given as
0.805 2.931
𝑋𝑖 = 2[−𝑙𝑛 𝑅𝑖 ] −1/4 0.223 1.807
0.819 2.992
0.996 7.949
0.507 2.203
2[−𝑙𝑛 𝑅𝑖 ] −1/4
0.263 1.860
02.04.2021 Dr. Ashish Kumar Saxena 9
Comparing Weibull & Exponential distribution
1
Exponential Variate :𝑋 = − ln(1 − 𝑅)
𝜆
Weibull Variate : 𝑋 = 𝛼[− ln 1 − 𝑅 ]1/𝛽

• Comparing the two function:


• If X is a Weibull variate then 𝑋𝛽 is an exponential variate with
mean 𝛼 𝛽
• Conversely if Y is an exponential variate with mean µ, then 𝑌1/𝛽 is
a Weibull variate with shape parameter β and scale parameter
𝛼 = 𝜇 1𝛽

02.04.2021 Dr. Ashish Kumar Saxena 10


Problem on generating Exponential distributed random
variate
Generate 10 random numbers that are exponentially distributed with
=2 also draw the frequency histogram for 100 random numbers.
Random Random
Solution No variate=
𝑅𝑖 1
− 𝜆 ln 𝑅𝑖
0.263 0.6671
0.340 0.5399
0.197 0.8126
0.349 0.5270
0.530 0.3171
0.805 0.1085
0.223 0.7514
0.819 0.0996
0.996 0.0018
0.507 0.3393
02.04.2021
0.263 0.6671 Dr. Ashish Kumar Saxena 11
Weibull distribution plot

Probability Distribution Function


𝛽 𝛽−1 −(𝑥 )𝛽
𝑓(𝑥) = 𝛽 𝑥 𝑒 𝛼
𝛼

1
Where = 𝜆 and 𝛽=𝜅
𝛼

02.04.2021 Dr. Ashish Kumar Saxena 12


Any Question ?

02.04.2021 Dr. Ashish Kumar Saxena 13


MEE2013 Modeling and Simulation
of Manufacturing Systems

L4.3 Acceptance Rejection technique to generate


Random Variate

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Random Variate and Generation
• There are three common techniques, which can be used for
random variate generation
• Inverse Transform Technique
• Acceptance Rejection Technique
• Convolution Technique

Inverse Transform Technique (ITT) is used to generate sample of few


following continuous distribution
• Exponential distribution
• Uniform distribution
• Triangular distribution
• Weibull distribution

09.04.2021 Dr. Ashish Kumar Saxena 2


Random variate generation by using
Acceptance Rejection Techniques
Suppose we required to device a method for generating random variates X, uniformly
distributed in the range [0.2, 0.8].

Generate uniform random numbers, one should accept random numbers, which fall in
required interval and reject those random numbers which are outside the required
interval

We should follow following steps


Step 1: Generate random number R
Step 2a: If R ≥ 0.2 accept X=R, than go to step 3
Step 2b: If R  0.2, reject R, and return to step 1
Step 3: If another uniform random variate on [0.2, 0.8] is needed, repeat the
procedure beginning at step 1. if not stop

Each time step 1 is executed a new random number R must be generated. Step 2a is an
“Acceptance” and step 2b is a “rejection” in this acceptance rejection technique.

09.04.2021 Dr. Ashish Kumar Saxena 3


Example to use acceptance-rejection technique
Problem: To develop uniformly distributed random variate in the range
[0.2, 0.8]

Solution

0.123 0.526 0.200 0.894 0.250 0.550 0.210 0.627


0.489 0.762 0.681 0.204 0.677 0.351 0.677 0.870
0.840 0.535 0.603 0.118 0.859 0.414 0.912 0.928
0.849 0.692 0.960 0.700 0.117 0.703 0.653 0.141
0.200 0.737 0.039 0.159 0.279 0.202 0.776 0.214
0.121 0.058 0.514 0.255 0.893 0.408 0.763 0.878

All rejected values are red coloured

09.04.2021 Dr. Ashish Kumar Saxena 4


Poisson Distribution
A Poisson random variable N with mean >0 is defined as
𝑛
𝜆𝜆
𝑝 𝑛 =𝑃 𝑁=𝑛 = 𝑒 ,𝑛 = 0,1,2, …
𝑛!

• Here N can interpreted as the number of arrivals from a Poisson


arrival process in one unit of time.
• To generate these N, there is no closed form solution by inverse
transform technique
• If the inter arrival times A1, A2, A3,….. of successive customers is
exponentially distributed with rate  (i.e.  mean rate of arrival in
unit time);
1
• The closed solution exists in the form of 𝑋 = − ln(𝑅),
𝜆
• In addition to that there is a relationship between the (discrete)
Poisson and (continuous) exponential distribution:
09.04.2021 Dr. Ashish Kumar Saxena 5
Poisson Distribution
• The relationship is the relation between number of arrivals in unit
time and inter-arrival time, i.e.
• If A1+A2+A3+………are inter-arrival time, and exactly ‘n’ arrivals
happen in 1 unit of time then
A1+A2+A3+………+An ≤ 1 ≤ A1+A2+A3+………+An+An+1
• This means that exactly ‘n’ arrivals happened in time 1, while the
(n+1)th arrival happen after time 1
• Proceed now by generating exponential inter-arrival times until some
arrival, lets say n+1 arrival happen after time 1
• For efficient generation purpose using above inequality
𝑛 𝑛+1
1 1
෍ − ln(𝑅) ≤ 1 ≤ ෍ − ln(𝑅)
𝜆 𝜆
𝑖=1 𝑖=1
• Now replacing  by 

09.04.2021 Dr. Ashish Kumar Saxena 6


Poisson Distribution
• Now replacing  by 
𝑛 𝑛 𝑛+1 𝑛+1
1 1
𝑙𝑛 ෑ 𝑅𝑖 = ෍ − ln(𝑅𝑖 ) ≤ 1 ≤ ෍ − ln(𝑅𝑖 ) = 𝑙𝑛 ෑ 𝑅𝑖
𝜆 𝜆
𝑖=1 𝑖=1 𝑖=1 𝑖=1
Where
𝑛

ෑ 𝑅𝑖 = 𝑅1 + 𝑅1 𝑅2 + 𝑅1 𝑅2 𝑅3 + ⋯ + 𝑅1 𝑅2 𝑅3 . . 𝑅𝑛
𝑖=1
• Finally we have
𝑛 𝑛+1

𝑙𝑛 ෑ 𝑅𝑖 ≥ −𝜆 ≥ 𝑙𝑛 ෑ 𝑅𝑖
𝑖=1 𝑖=1
𝑛 𝑛+1

ෑ 𝑅𝑖 ≥ 𝑒 −𝜆 ≥ ෑ 𝑅𝑖
𝑖=1 𝑖=1
So we have to find n that satisfies the above relation and n will follow a
Poisson distribution
09.04.2021 Dr. Ashish Kumar Saxena 7
Use acceptance-rejection technique for Generation
Procedural Steps: of Poisson Distribution
Step 1 Set n=0, P=1

Step 2 Generate random number 𝑅𝑛+1 and replace P by 𝑃𝑅𝑛+1

Step 3 if P < 𝑒 −𝜆 then accept N=n, otherwise reject the current n,


increase n by one and return to step 2
The basic idea of rejection technique is again exhibited; if 𝑃 ≥ 𝑒 −𝜆 in
step 3, then n is rejected and generation process must proceed through
at one more trial

Now question come up: How many random numbers will be required on
average to generate one Poisson variate N?
If N=n then n+1 random numbers are required so the average number is
given by E(n+1)=+1
09.04.2021 Dr. Ashish Kumar Saxena 8
Use acceptance-rejection technique for Generation
of Poisson Distribution
Generate three Poisson variate with mean  (or )=0.5 and 𝑒 −0.5 =
0.6065 and initial value of P=1
n Ri Accept / Poisson
𝑷 = ෑ𝒏+𝟏
Reject Variate
0 1*R1 A N=0
0.526 1*0.526
0 0.210 1*0.210 A N=0
0 1*R1 R
0.870 1*0.870
1 R1*R2 R
0.859 0.870*0.859=
0.7473
2 R1*R2*R3 A N=2
0.692 0.870*0.859*
0.692=0.5171

09.04.2021 Dr. Ashish Kumar Saxena 9


Limitation

• If the value of  (or ) is large, then there will be lot of rejections

• If we require m random variates following Poisson distribution, we


roughly require m X(+1) random numbers

• This is the inherent inefficiency of the method, When  ≥ 15,


rejection method becomes very much lengthy and we need to shift
to another method by using normal distribution

09.04.2021 Dr. Ashish Kumar Saxena 10


Any Question ?

09.04.2021 Dr. Ashish Kumar Saxena 11


MEE2013 Modeling and Simulation
of Manufacturing Systems

L4.4 Convolution Method, Examples on Acceptance


Rejection technique

Dr. Ashish Kumar Saxena,


Assistant Professor, CIMR
ashishkumar@vit.ac.in
Random Variate and Generation
• There are three common techniques, which can be used for
random variate generation
• Inverse Transform Technique
• Acceptance Rejection Technique
• Convolution Technique

09.04.2021 Dr. Ashish Kumar Saxena 2


Convolution Method
• The probability distribution of a sum of two or more independent
random variables is called a convolution of the distribution of the
original variables.
• Thus it refer to adding together two or more variables to obtain a
new random variables with desired distribution

• This technique is used to generate Erlang variates and binomial


variates

09.04.2021 Dr. Ashish Kumar Saxena 3


Erlang Distribution example

An Erlang random variable X with parameter (k, ) can be shown as


sum of k independent exponential random variables Xi, i= 1,2,3…. k,
each having mean 1/kθ.
𝑘

𝑋 = ෍ 𝑋𝑖
𝑖=1
The convolution approach is to generate 𝑋1 , 𝑋2 ,…. , 𝑋𝑘 . Then sum of
them is obtained to get X.
The 𝑋𝑖 is obtained by exponential random variate equation,
1 1 1
𝑋𝑖 = − ln(𝑅𝑖 ), where =
𝜆 𝜆 𝑘θ
From above expression
𝑘
1
𝑋 = ෍ − ln(𝑅𝑖 )
𝜆
𝑖=1
09.04.2021 Dr. Ashish Kumar Saxena 4
Erlang Distribution example

1
After putting value of in obtained expression
𝜆
𝑘
1
𝑋 = ෍− ln(𝑅𝑖 )
𝑘θ
𝑖=1
𝑘
1
𝑋 = − ln ෑ 𝑅𝑖
𝑘𝜃
𝑖=1

It is more efficient computationally to multiply all random numbers and then compute only
one logarithm

09.04.2021 Dr. Ashish Kumar Saxena 5


Erlang Distribution Problem
A truck arrives at warehouse in completely random model that is modelled as Poisson
process with arrival rate of 10 trucks per hour. A guard at the entrance send trucks
alternatively north and south docks.
An analyst has developed a model to study loading/unloading process at south docks
and need model of arrival process at south dock alone.
Solution:
An interarrival time X between successive arrivals at the south docks is equal to sum of
two inter arrival time at the entrance and thus it the sum of two exponential random
variables each having mean of 0.1 hour (6mins).

Thus, X has the Erlang distribution with k=2 and mean 1/=2/=0.2 hour
Now to generate random variate X, first obtain random number, then used Erlang
distribution expression

1 0.2
𝑋=− ln ς𝑘𝑖=1 𝑅𝑖  𝑋 = − ln ς2𝑖=1 𝑅𝑖  𝑋 =-0.1ln(R1*R2)
𝑘𝜃 2

R1=0.896, R2=0.235; X= 0.1558 hours

09.04.2021 Dr. Ashish Kumar Saxena 6


Random variate Problem for Practice
A bus is arrive to a stop follows Poisson process with mean of one bus per 15 min. Generate the
random variate N, which represents number of arriving buses during 1 hour of time
Solution:
Now N is Poisson distributed with mean of 4 buses per hour, determine 𝑒 −4 = 0.0183
n Ri Accept (A)/ Poisson
𝑷 = ෑ𝒏 + 𝟏
Reject (R) Variate
0 0.848 0.848 P ≥ 𝑒 −4 ; R
1 0.465 0.394 P ≥ 𝑒 −4 ; R
2 0.535 0.211 P ≥ 𝑒 −4 ; R
3 0.014 0.003 P ≤ 𝑒 −4 ; A 3
0 0.734 0.734 P ≥ 𝑒 −4 ; R
1 0.199 0.146 P ≥ 𝑒 −4 ; R
2 0.589 0.086 P ≥ 𝑒 −4 ; R
3 0.126 0.011 P ≤ 𝑒 −4 ; A 3

09.04.2021 Dr. Ashish Kumar Saxena 7


Example
Pallet arrive to a station following a Poisson process with a mean of 3 pallets every
minute, =3. Generate the number of pallets arriving for next 5 minutes. Given that
𝑒 −3 = 0.0498
Solution
n Ri Accept / Poisson
𝑷 = ෑ𝒏+𝟏
Reject Variate
0 0.151 0.151 R
1 0.573 0.086 R
2 0.448 0.038 A 2
0 0.314 0.314 R
1 0.812 0.255 R
2 0.148 0.038 A 2
0 0.698 0.698 R
1 0.571 0.398 R
2 0.782 0.311 R
3 0.065 0.020 A 3
09.04.2021 Dr. Ashish Kumar Saxena 8
Any Question ?

09.04.2021 Dr. Ashish Kumar Saxena 9

You might also like