20211230182358D4869 - Session 3 - 4 Monte Carlo Simulation - Edit
20211230182358D4869 - Session 3 - 4 Monte Carlo Simulation - Edit
20211230182358D4869 - Session 3 - 4 Monte Carlo Simulation - Edit
Stochastic Processes
Session 3 - 4
Monte Carlo Simulation
- DLW - 1
Learning Outcome
2
Outline
3
Introduction to Monte Carlo
Simulation
- DLW - 4
Introduction to Monte Carlo
Simulation
- DLW - 5
Introduction to Monte Carlo
Simulation
- DLW - 6
Simulation by Hand
Example 1
- DLW - 7
Simulation by Hand
Example 1
- DLW - 8
Simulation by Hand
Example 1
- DLW - 9
Simulation by Hand
Example 2
- DLW - 10
Exercise 1
- DLW - 11
Generation of Random Numbers
- DLW - 12
Generation of Random Numbers
- DLW - 13
The Multiplicative Congruential Linear
Method (MCLG)
- DLW - 15
The problems of MCLG
- DLW - 17
Multiple Recursive Generator (MRG)
- DLW - 18
Multiple Recursive Generator
- DLW - 19
Multiple Recursive Generator (MRG)
- DLW - 20
Composite Generators
- DLW - 21
Simulation by hand of a Single
Server Model using random number
generator
• The interarrival time of customers at HairKare Barbershop is
exponential with mean 15 minutes. The shop is operated by
only one barber, and it takes between 10 and 15 minutes,
uniformly distributed, to do a haircut. Customers are served
on a first-in, first-out (FIFO) basis. The objective of the
simulation is to compute the following measures of
performance:
1. The average utilization of the shop.
2. The average number of waiting customers.
3. The average time a customer waits in queue
- DLW - 22
Simulation by hand of a Single Server
Model using random number generator
Service Waiting
customer R1 Arrival (p) R2 (q) depart time
1 0 0.6733 13.3665 13.3665
2 0.0589 42.47871 0.9486 57.22171 57.22171
3 0.4799 53.49138 0.5933 70.18821 70.18821 3.730337
4 0.6139 60.81022 0.1782 81.07921 81.07921 9.377989
5 0.9341 61.8328 0.3473 92.81571 92.81571 19.24641
32.35474
average waiting
time 6.470948
- DLW - 23
Example 2/1
(using random number)
- DLW - 24
Example 2/2
To ensure that all the points in the square are equally probable, the
coordinates x and y of a point in the square are represented by the following
uniform distributions:
- DLW - 25
Example 2/3
- DLW - 26
Example 2/4
4
4
2
2
0
0 -6 -4 -2 0 2 4 6 8
-6 -4 -2 0 2 4 6 8
-2 -2
-4 -4
Consider the game in which two players, Jan and Jim, take turns
in tossing a fair coin. If the outcome is heads, Jim gets $10 from
Jan. Otherwise, Jan gets $10 from Jim.
(a) How is the game simulated as a Monte Carlo experiment?
(b) Run the experiment for 5 replications of 10 tosses each. Use
the first five columns of the 0-1 random numbers in Table
19.1, with each column corresponding to one replication
- DLW - 28
Monte Carlo Simulation
- DLW - 29
Confidence Interval for The Random
Variation
- DLW - 30
Confidence Interval for The Random
Variation
- DLW - 31
Random Number Generator in Excel
- DLW - 32
Types of simulation
- DLW - 33
Types of Simulation
- DLW - 34
Sampling from Probability Distribution
- DLW - 35
Inverse method
- DLW - 36
example
- DLW - 37
Example (Exponential Distribution)
R -1/λ*ln(1-R)
0.405526 0.2080316 Exponential simulation based
0.847353 0.75185156 on 25 random number
0.499018 0.27647395
0.738291 0.53620867
0.511282 0.28638806 λ 2.5
0.111864 0.04745238
0.938621 1.11627241
1/λ 0.4
0.878735 0.84391175
0.92389 1.03023282 mean 0.410468
0.3067 0.14651683 stdev 0.400547
0.374058 0.18739874
0.986411 1.71940232
0.180746 0.07974453
0.544565 0.31460083
0.561445 0.32970781
0.688797 0.46692336
0.405249 0.20784523
0.178243 0.07852403
0.420911 0.21851944
0.678146 0.4534633
0.303199 0.14450226
0.279909 0.13135096
0.495818 0.27392754
0.14872 0.06440545
0.581087 0.34803662
- DLW - 38
Convolution method.
- DLW - 39
Example (Erlang Distribution)
- DLW - 40
example
Erlang distribution simulation based
R1 R2 R3 R1R2R3 -1/λ*ln(R1*R2*R3) on 25 random number
0.114177 0.915382 0.230434 0.024084 0.931553464
0.112674
0.583917
0.325256
0.417054
0.300014
0.670039
0.010995 1.127580365
0.163171 0.453238681
m 3
0.560872 0.168264 0.320109 0.03021 0.87489446 λ 4
0.107231 0.166212 0.969218 0.017274 1.014632025 1/λ 0.25
0.099556 0.507562 0.042366 0.002141 1.536642363
0.910249 0.700342 0.625058 0.398465 0.230033776
0.695084 0.257076 0.575945 0.102915 0.568462641
0.108279 0.108317 0.872366 0.010232 1.145570259 mean 0.745131 m/λ 0.75
0.621014 0.945613 0.565244 0.331933 0.275705536 stdev 0.429218 m/λ2 0.433013
0.787341 0.44244 0.052866 0.018416 0.998636851
0.089052 0.219116 0.972678 0.018979 0.991099028
0.179666 0.156459 0.061528 0.00173 1.589969361
0.148784 0.181704 0.561884 0.01519 1.046772961
0.376506 0.042594 0.501646 0.008045 1.205681825
0.269691 0.519368 0.479651 0.067184 0.675079227
0.760984 0.726314 0.825967 0.456523 0.196028797
0.55771 0.94843 0.468979 0.248066 0.348515194
0.230469 0.865176 0.440455 0.087825 0.608101532
0.068932 0.166929 0.779257 0.008967 1.178557116
0.530892 0.744027 0.974999 0.385122 0.238548505
0.980351 0.360465 0.988422 0.349291 0.262962716
0.806792 0.4511 0.404722 0.147296 0.478827665
0.945452 0.992617 0.502904 0.471961 0.187714853
0.453002 0.616014 0.561293 0.156632 0.463464394
- DLW - 41
Example (Normal
Distribution)
- DLW - 42
Example (Normal
Distribution)
Normal distribution simulation based
on 25 random number
Y=µ+σ(
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 X (sum) X-6)
0.66 0.36 0.31 0.67 0.86 0.11 0.96 0.10 0.78 0.51 0.24 0.90 6.47 10.94 µ 10
0.88 0.78 0.42 0.48 0.06 0.12 0.38 0.61 0.54 0.37 0.39 0.97 6.01 10.01 σ 2
0.90 0.64 0.91 0.86 0.38 0.66 0.52 0.91 0.14 0.33 0.78 0.99 8.02 14.05
0.15 0.96 0.61 0.02 0.42 0.15 0.26 0.55 0.79 0.03 0.27 0.30 4.51 7.02
0.83 0.21 0.49 0.58 0.68 0.09 0.07 0.34 0.95 0.43 0.02 0.23 4.92 7.83
0.15 0.78 0.05 0.90 0.31 0.26 0.06 1.00 0.73 0.07 0.60 0.77 5.66 9.32
0.81 0.90 0.30 0.49 0.47 0.18 0.95 0.82 0.28 0.83 0.47 0.62 7.10 12.21 mean 10.02121
0.18 0.58 0.09 0.39 0.14 0.40 0.55 0.66 0.08 0.53 0.94 0.73 5.26 8.52 stdev 2.125818
0.03 0.69 0.58 0.82 0.26 0.82 0.80 0.43 0.98 0.49 0.81 0.89 7.59 13.19
0.29 0.17 0.02 0.06 0.83 0.88 0.67 0.55 0.77 0.92 0.45 0.51 6.11 10.21
0.24 0.22 0.07 0.03 0.12 0.59 0.22 0.83 0.54 0.95 0.93 0.55 5.30 8.60
0.38 0.38 0.81 0.46 0.09 0.06 0.57 0.71 0.16 0.17 0.86 0.31 4.97 7.94
0.94 0.86 0.36 0.12 0.89 0.67 0.01 0.98 0.64 0.81 0.75 0.24 7.25 12.51
0.74 0.87 0.19 0.04 0.68 0.67 0.56 0.26 0.73 0.52 0.61 0.71 6.56 11.13
0.86 0.37 0.57 0.61 0.85 0.86 0.03 0.17 0.33 0.95 0.90 0.91 7.40 12.80
0.25 0.72 0.19 0.02 0.69 0.93 0.29 0.08 0.40 0.40 0.02 0.31 4.30 6.60
0.55 0.98 0.37 0.84 0.29 0.85 0.42 0.83 0.01 0.78 0.50 0.11 6.53 11.06
0.19 0.55 0.03 0.75 0.81 0.37 0.11 0.74 0.70 0.61 0.46 0.85 6.18 10.37
0.46 0.04 0.21 0.18 0.23 0.16 0.41 0.49 0.16 0.97 0.26 0.34 3.92 5.83
0.24 0.14 0.92 0.29 0.92 0.98 0.51 0.13 0.45 0.55 0.44 0.39 5.96 9.92
0.93 0.65 0.40 0.65 0.42 0.69 0.44 0.18 0.28 0.41 0.67 0.68 6.41 10.82
0.31 0.86 0.70 0.31 0.15 0.44 0.84 0.73 0.72 0.38 0.30 0.06 5.79 9.59
0.54 0.16 0.34 0.65 0.27 0.55 0.76 0.51 0.98 0.45 0.08 0.54 5.83 9.66
0.74 0.49 0.20 0.10 0.57 0.37 0.66 0.45 0.28 0.98 0.29 0.04 5.16 8.32
0.95 0.96 0.17 0.74 0.94 0.44 0.46 0.77 0.56 0.17 0.66 0.21 7.04 12.08
- DLW - 43
Exercise 3
- DLW - 44
Thank You
- DLW - 45
Reference
46