Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Monte Carlo Simulation Technique: Random Number Generators

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

26-10-2020

Monte Carlo Simulation Technique


• This technique is used to estimate the
probability of failure of a performance
function.
• A simple and straight forward approach
• Based on generation of random numbers
• ‘N’ Random numbers are generated for a
variable based on its probabilistic
characteristics (mean, standard deviation,
and distribution)

Random number generators


• Random number vs. pseudo-random
number
• U(0,1) – Uniformly distributed continuous
RV between 0 and 1.
• Uniform random-number generators
• Transformation technique to generate
random numbers following other
distributions

1
26-10-2020

Uniform random number


generators
• Arithmetic generators are commonly used
– Employ sequential methods
• Each number is determined by one or several of its
predecessors according to a fixed mathematical
formula
– Carefully designed generators can produce
number that appear to be independent
random variates.
• Sequential numbers are not truly random, being
derived from previous numbers in some
deterministic fashion – Pseudo-random numbers

Uniform random number


generators
• Properties of a good arithmetic uniform
random number generator:
– numbers generated should be appear to be
independent and uniformly distributed
– should be fast and not require large amounts
of storage
– should have the ability to reproduce a given
stream of random numbers exactly.
– should have a very long period

2
26-10-2020

Reproducing the random


numbers
• Useful when attempting to compare the
responses of two different designs

Arithmetic generators
• Linear congruential generators (LCGs)
– Introduced by Lehmer (1951)
– A sequence of integers Z1, Z2, … are defined
by the recursive formula:
• Zi=(aZi-1+c)(mod m)
• Where m is the modulus, a is a multiplier, c is an
increment, and all three parameters are positive
integers.
• =(aZi-1+c)(mod m) means the whole remainder of
(aZi-1+c) after dividing it by m
• 15 mod 4=3 & 17 mod 5=2
• Zi is an integer and varies between 0 and m-1.

3
26-10-2020

Linear Congruential Generators


• The sequence starts with Z0 is a positive
integer, a seed
• Ui=Zi/m
• Ui can have 0, 1/m, 2/m, …, (m-1)/m
• m should be a large number, to generate
continuous uniform distributed random
numbers
• Z1 is obtained from Z0, Z2 from Z1, …

Linear Congruential Generators


• For fixed values of multiplier, a, increment,
c, and modulus, m, the same sequence of
Zi values is produced for same seed value,
Z0.
• So long as the seed value is known, the
recursive formula produces a given stream
of pseudo-random numbers exactly.
• Sequence of Ui is independent and
uniformly distributed if a,c, and m are
correctly selected.

4
26-10-2020

Periodicity
• If Z0=3 produces Z1=746, then whenever
Zi-1=3, then Zi=746.
– This property is called periodicity
– {83,83,83,…} – periodicity=1
– {94,4832,325,94,4832,325,..} – Periodicity=3
– Undesirable and common random-number
generators suffer from this.
• Generate random numbers with the
following values: Z0=21, a=25, c=55, and
m=96.

Periodicity
• Generate random numbers with the
following values: Z0=21, a=25, c=55, and
m=96.
– 21,4,59,90,1, …
– Uniformly distributed random numbers
between 0 &1 [0,1):
4/96=0.042, 59/96=0.614, 90/96=0.9375,
• Maximum periodicity of LCG is m, and will
occur only if a,c, and m are selected
carefully. This is called full periodicity.

5
26-10-2020

Periodicity of a generator
• A generator has full period if its period is
m.
• A generator which is full period will
produce exactly one of each possible
values, {0,1, …., m-1), in each cycle.
• If the generator is good, all of these
possible values will appear to occur in
random order.

Selection of a,c & m


• LCG has full period if the following three
conditions are fulfilled.
– The only positive integer that exactly divides
both m and c is 1
– If q is a prime number (divisible only by itself
and 1) that exactly divides m, then q exactly
divides (a-1). This must be true for all prime
factors of m; example: m=96, a=25.
– If 4 exactly divides m, then 4 exactly divides
(a-1)

6
26-10-2020

Example
• Is Zi=(25Zi-1+55) (mod 96) is a full period
generator?

Minimal standard generator


• Minimal standard (MS) generator with
constants:
A=75, c=0 & M=231-1, has a periodicity of m-1 or
about 2 x 109, with requirement that the seed 0
must never be used.
Once Zi=0 – generator will return zeros.
This form of the LCG with c=0 is called a
multiplicative LCG.
Zi+1=aZi (mod m)
Suffer from serial correlation, some correlation
between successive values.

7
26-10-2020

Inverse transform method


• Generate u ~ U(0,1)
• Return x=F-1(u)

Example
• Generate 10 uniformly distributed random
numbers between 20 and 50.

8
26-10-2020

Monte Carlo Simulation


• If X is N(m,s), then random numbers for X are
generated as:

Where F-1 is the inverse of the CDF of a standard normal variable

Monte Carlo Simulation


• If the random varibale, X, is lognormal
distributed with parameters lX and zX, then
random numbers for X are generated as:

9
26-10-2020

Inverse Transformation
FU(u) FX(x)

1.0 1.0

0.5 0.5

0.0 0.0
U fU(u) fX(x) X

U 1 ui 0 xi X

Example – Normal RV
• Generate 2 random variates for bearing
capacity following normal distribution with
mean 500 kPa and standard deviation 5
kPa, using inverse transformation
technique.

10
26-10-2020

Example – Lognormal RV
• Generate 2 random variates for bearing
capacity following lognormal distribution
with mean 500 kPa and standard deviation
5 kPa, using inverse transformation
technique.

Radial transformation method


• Box and Muller (1958)
– Useful to generate random numbers following
distributions which have no simple closed-
form solutions, such as normal.
– Exact
– Simple to use

11
26-10-2020

Box-Muller (1958)
• If X is a normally distributed with mean mX
and standard deviation sX, then
realizations of X can be generated as:
1. Generate u1~U(0,1) and u2 ~U(0,1)
2. Form g1=sqrt(-2lnu1) cos(2pu2) and
g2= sqrt(-2lnu1) sin(2pu2)
3. Form x1=mX+sXg1 and x2= mX+sXg2
This method generates realizations of X1
and X2, which are independent normal
random variates.

Example
• Generate two random variates following
normal distribution with mean 12 and
standard deviation 4, using the following
two uniformly distributed random numbers
between 0 and 1. Use Box-Muller method.
• u1=0.89362
• u2=0.42681

12
26-10-2020

Example
To estimate the settlement due to consolidation of a
homogeneous saturated soil deposit, the information on the
coefficient of consolidation, cv is a very important. It can be
calculated as:
𝑘
𝑐𝑣 =
𝑚𝑣 𝛾𝑤
Where, k is the hydraulic conductivity, mv is the coefficient
of volume compressibility, and gw is the unit weight of water.
Assume k and mv are statistically independent lognormal
random variables with means of 1.3 x 10-7 m/min and
0.0011 m2/kN, respectively. Both have coefficients of
variation of 10%. Using the above data, estimate P(cv>1.2 x
10-5 m2/min).

13

You might also like