You are on page 1of 17

Simulation Theory. Noted by Mỹ Dung.

Ref: Dr. PHTram, textbook (Jerry Bank)

CHAP 7: INPUT MODELLING Used to represent pollutant concentrations and precipitation quantities.

II. FITTED DISTRIBUTION Used to measure the time between the occurrence of events when the

Dự a và o histogram và context để chọ n distribution phù hợ p. event process is not completely random.
Conditions:
1. DISCRETE DISTRIBUTION - The number of possible occurrences in any unit of measurement is not
2. CONTINUOUS DISTRIBUTION
1.1. BINOMIAL: limited to a fixed number.
2.1, EXPONENTIAL:
Describes the number of times a particular event occurs in a fixed - The occurrences are independent.
Used to describe time between independent events (such as time
number of trails, such as the number of heads in 10 flips if a coin or the - The average number of occurrences must remain the same from unit to
between customer arrival, time between failures of electronic
number of defective items out of 50 items chosen. unit.
equipment).
Condition
- For each trial, only 2 outcomes are possible that are mutually exclusive.
- The trials are independent – what happens in the first trial does not
affect the next trial.
- The probability of an event occurring remains the same from trial to
trial.

2.2. BETA
2.4. WEIBULL:
Usage:
Describes data resulting from life and fatigue tests
- Commonly used to represent variability over a fixed range.
Usage:
- Used to represent the uncertainty in the probability of occurrence of an
1.2. GEOMETRIC: Compute number of failures required before the first - Commonly used to describe failure time in reliability studies as well as
event.
success occurs. the breaking strengths of materials in reliability and quality control tests.
- Used to describe empirical data and predict the random behavior of
1.3. NEGATIVE BINOMIAL: Compute number of failures before the xth - Also used to represent various physical quantities, such as wind speed
percentages and fractions, as the range of outcome is typically between
success occurs. time to failure for components
0 and 1.

1.4. POISSON:
# of independent events that occur in a fixed amount of time or space

2.5. UNIFORM:
All values fall between the minimum and maximum and occur with equal
likelihood (equal chance)
1.5. UNIFORM:
(Đọ c 2.5, khá c ở chỗ value củ a Discrete Uniform phả i là số nguyê n thô i)

2.3. GAMMA:
Model nonnegative random variable
Usage:
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

III.. PARAMETER ESTIMATION

Poisson

Exponential
2.6. TRIANGULAR:
A process for which only the minimum, most likely, and maximum values
are known

Beta

Thườ ng cô hỏ i Exponential
- Queuing system: interarrival time, service time: constant, normal (>0),
exponential, gamma, weibull
- Inventory & SC:
+ Number of demand: geometric, poisson, negative binomial
+ Lead time: gamma
- Reliability & maintainabilility:
+ Time to failure: weibull, exponential, normal

Example 1: (Question 1 Final 2022)

Weibull
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

IV. GOODNESS-OF-FIT TESTS 6 11.2 (6-0.5)/10 = 0.55 7.1+(19.2–7.1)x0.55 = 13.76


Giả sử đề hỏ i 25% quantile, 75% quantile of empirical distribution 7 13.2 (7-0.5)/10 = 0.65 7.1+(19.2–7.1)x0.65 = 14.97
4.1. Graphical approach:
8 13.9 (8-0.5)/10 = 0.75 7.1+(19.2–7.1)x0.75 = 16.18
Q-Q plot: graphs the quantiles of the fitted distribution vs the sample 25%: 0.53, 75%: 3.93
9 18.6 (9-0.5)/10 = 0.85 7.1+(19.2–7.1)x0.85 = 17.39
quantiles. Giả sử đề hỏ i 25% quantile, 75% quantile of theoretical distribution 10 19.2 (10-0.5)/10 = 0.95 7.1+(19.2–7.1)x0.95 = 18.03
25%: 0.68, 75%: 3.30
( j−0.5 )
y j ≈ F−1 Example 7.2 25% quantile, 75% quantile of empirical distribution
n
0.44, 0.53, 2.80, 0.04, 5.55, 3.93, 1.63, 1.46, 6.58, 0.64 UNIFORM 25%: 8.4, 75%: 13.9
Step 1: List j = 1 to n (xem như STT củ a value thô i)
Step 2: Sort data (from smallest to largest)
a=0.04 25% quantile, 75% quantile of theoretical distribution
25%: 9.98 75%: 15.73
Step 3: Calculate R=( j−0.5)/n b=6.58
j Value R=( j−0.5)/n Yj
R là quantile, ví dụ R = 0.25 nghĩa là 25% quantile of data
Empiricical thì nhìn cộ t 2 (Value) 1 0.04 (1-0.5)/10 = 0.05 0.04+(6.58–0.04)x0.05 = 0.37
2 0.44 (2-0.5)/10 = 0.15 0.04+(6.58–0.04)x0.15 = 1.02
Theoretical thì nhìn cộ t 4 (Y j ¿ 3 0.53 (3-0.5)/10 = 0.25 0.04+(6.58–0.04)x0.25 = 1.68
−1 4 0.64 (4-0.5)/10 = 0.35 0.04+(6.58–0.04)x0.35 = 2.33
Step 4: Find F ( j−0.5)/n (depend on the distribution) 5 1.46 (5-0.5)/10 = 0.45 0.04+(6.58–0.04)x0.45 = 2.98
6 1.63 (6-0.5)/10 = 0.55 0.04+(6.58–0.04)x0.55 = 3.64
X =a+ ( b−a ) R
7 2.80 (7-0.5)/10 = 0.65 0.04+(6.58–0.04)x0.65 = 4.29
Uniform a : min value 8 3.93 (8-0.5)/10 = 0.75 0.04+(6.58–0.04)x0.75 = 5.00
9 5.55 (9-0.5)/10 = 0.85 0.04+(6.58–0.04)x0.85 = 5.60
b : max value 10 6.58 (10-0.5)/10 = 0.95 0.04+(6.58–0.04)x0.95 = 6.25
−1
X= ln ( 1−R )
λ Giả sử đề hỏ i 25% quantile, 75% quantile of empirical distribution
Exponential
1 25%: 0.53, 75%: 3.93
With λ= ∧X is the meanvalue
X Giả sử đề hỏ i 25% quantile, 75% quantile of theoretical distribution
1 25%: 1.68, 75%: 5.00
X =α [ −ln (1−R ) ]
Weibull β

Example 7.3 (Question 2 Final 2022)


Example 7.1 Below is the data of processing time:
0.44, 0.53, 2.80, 0.04, 5.55, 3.93, 1.63, 1.46, 6.58, 0.64 EXPONENTIAL 7.1, 10.3, 11.2, 13.9, 8.4, 19.2, 7.5, 9.1, 18.6, 13.2
Mean: (0.44 + 0.53 + ... + 0.64)/10 = 2.36 a. What are the 25% and 75% quantile of
Lambda: 1/ 2.36 = 0.42 - the empirical distribution constructed from this data?
j Value R=( j−0.5)/n Yj - the theoretical distribution if we suspect a Uniform distribution?
1 0.04 (1-0.5)/10 = 0.05 -1/0.42 x ln(1-0.05) = 0.12 a :7.1
2 0.44 (2-0.5)/10 = 0.15 -1/0.42 x ln(1-0.15) = 0.39
3 0.53 (3-0.5)/10 = 0.25 -1/0.42 x ln(1-0.25) = 0.68 b : 19.2 Tui lỡ chọ n lộ n b hiuhiu
4 0.64 (4-0.5)/10 = 0.35 -1/0.42 x ln(1-0.35) = 1.03 j Value R=( Yj
j−0.5)/n
5 1.46 (5-0.5)/10 = 0.45 -1/0.42 x ln(1-0.45) = 1.42
1 7.1 (1-0.5)/10 = 0.05 7.1+(19.2–7.1)x0.05 = 7.71
6 1.63 (6-0.5)/10 = 0.55 -1/0.42 x ln(1-0.55) = 1.90
2 7.5 (2-0.5)/10 = 0.15 7.1+(19.2–7.1)x0.15 = 8.92
7 2.80 (7-0.5)/10 = 0.65 -1/0.42 x ln(1-0.65) = 2.50
3 8.4 (3-0.5)/10 = 0.25 7.1+(19.2–7.1)x0.25 = 10.13
8 3.93 (8-0.5)/10 = 0.75 -1/0.42 x ln(1-0.75) = 3.30
4 9.1 (4-0.5)/10 = 0.35 7.1+(19.2–7.1)x0.35 = 11.34
9 5.55 (9-0.5)/10 = 0.85 -1/0.42 x ln(1-0.85) = 4.52
5 10.3 (5-0.5)/10 = 0.45 7.1+(19.2–7.1)x0.45 = 12.55
10 6.58 (10-0.5)/10 = 0.95 -1/0.42 x ln(1-0.95) = 7.13
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

4.2. Statistical Test: Step 1: Hypothesis 2 2


If χ 0 > χ α →Reject H 0
Continuous data: data là số thự c H 0 : Ri is ¿ distributed
Discrete data: data toà n số nguyê n (integer) H 1 : R i is NOT ¿ distributed
4.2.a. Chi-square Test
Valid for large sample size and for both continuous and discrete data k: number of intervals
Step 2: Test statistic
Split the range of X into k adjacent intervals. 2
k
( Oi−Ei )
I i = [ a i−1 , ai ) = ith interval χ 20 =∑ Ei : expected number in
i=1 Ei
the i th interval, ¿ n pi
Oi= number of observations in interval i Oi: observed number in the i th interval, count
Ei = expected number of observations in interval i
Interva Range Oi Ei Oi−E i ( Oi−E i )2 / Ei
^
= n [F ( ai )− F^ ( ai−1 ) ] l
cdf
1 [0 - a 1 ¿ Count np

k : number of interval 2 [a 1 - a 2) Count np

s : number of parameters 3 [a 2 - a 3) Count np

Procedure: . . Count np
Example: UNIFORM (alpha = 5%)
Step 0: Determine number of intervals and intervals. k [a k−1 - Count np
88.3 40.7 36.3 27.3 36.8
n a 0=0 ∞)
91.7 67.3 7 45.2 23.3
k≤ 98.8 90.1 17.2 23.7 97.4
5 a k =∞ Total N N 0 Test statistic 32.4 87.8 69.8 62.6 99.7
p = 1/k 20.6 73.1 21.6 6 45.3
76.6 73.2 27.3 87.6 87.2
Exponential λ=1/ X Step 3: Critical value
(s = 1) Step 0:
−1 2
n 30
a i= ln(1−ip) χ α
= ... Chi-square table, with df = k −s−1 (s = number of n=30=¿ k ≤ = =6
λ 5 5
Uniform parameters)
a : min value Choose k = 6, => p = 1/k = 1/6 = 0.167
(s = 2)
b : max value a=6
a i=a+ ( b−a ) × ip b = 99.7

Ví dụ exponential i ai
1 a+ ( b−a ) ×ip
i ai
= 6 + (99.7 – 6) x 1 x 0.167
−1
1 a 1= ln (1−1 p) = 21.65
λ 2 = 6 + (99.7 – 6) x 2 x 0.167
−1 = 37.30
2 a 2= ln (1−2 p) 3 = 6 + (99.7 – 6) x 3 x 0.167
λ = 52.94
. . Step 4: Compare Test statistic and Critical value 4 = 6 + (99.7 – 6) x 4 x 0.167
−1 = 68.59
k a k= ln(1−kp) If
2 2
χ < χ →Cannot reject H 0 5 = 6 + (99.7 – 6) x 5 x 0.167
λ 0 α
= 84.24
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

Step 1:
H 0 : Ri is UNIFORM distributed
H 1 : R i is NOT UNIFORM distributed
Step 2:
Inter
val
Range Oi Ei Oi−E i ( Oi−E i )2 / Ei
2
1 [0.0 –21.65) 5 5 0 0 /5 = 0.0
2
2 [21.65 – 37.30) 7 5 2 2 /5 = 0.8
3 [37.30 – 52.94) 3 5 -2 (−2 )2 /5 =
0.8

4 [52.94 – 68.59) 2 5 -3 (−3 )2 /5 =


1.8equal N
Always

5 [68.59 – 84.24) 4 5 -1 (−1 )2 /5 =


0.2
2
6 [84.24 – ∞) 9 5 4 4 /5 = 3.2
Total 30 30 0 6.8

2
χ 0 =6.8
Step 3:
2 2
χ α , k−s−1= χ 5 % ,6−2−1=¿ 7.81
Step 4:

2 2
χ 0 < χ α (6.8<7.81)→Cannot reject H 0 (
Ri isUNIFORM distributed ¿
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

4.2.b Kolmogorov-Smirnov test R1: x 0.05 0.14 0.44 0.81 0.93


Small sample size, continuous only 0.10 0.26 0.60 0.82 0.86
R2: F i
No parameters have been estimated from the data
R3: i/ N 0.20 0.40 0.60 0.80 1.00
- When parameter estimates have been made:
+ Critical values are biased, too large
Step 2.2: Row 4: i/N - Fi (if value <0, leave it blank)
+ More conservative, (smaller Type I error than specified)
Row 5: F i – (i-1)/N (if value <0, leave it blank)
Example: 0.44, 0.81, 0.14, 0.05, 0.93. EXPONENTIAL
Step 1: Hypothesis R1: x 0.05 0.14 0.44 0.81 0.93
H 0 : Ri is ¿ distributed R2: F i 0.10 0.26 0.60 0.82 0.86

R3: i/ N 0.20 0.40 0.60 0.80 1.00


H 1 : R i is NOT ¿ distributed
R4: i/ N - Fi 0.10 0.14 - - 0.14
Step 2: Test statistic
R5: F i – 0.10 0.06 0.20 0.22 0.06
Step 2.1: Row 1: Arange x from smallest to largest.
( i−1 ) / N
R1: x 0.05 0.14 0.44 0.81 0.93
Step 2.3:
+¿=¿¿
Row 2: F i (depend on the distribution) D max (i/N - F i) = max (value on row
4)
a : min value −¿=¿¿
D max ( F i – (i-1)/N) = max (value on row 5)
b : max value

{
−¿¿

Uniform
0 , x< a D = max ( D +¿ ,D ¿
) = max (0.14, 0.22) = 0.22

F ( x )= x−a , a ≤ x ≤b R4: i/ N - Fi 0.10 0.14 - - 0.14


b−a 0.10 0.06 0.20 0.22 0.06
R5: F i –
1 , x >b
( i−1 ) / N
λ=1/ X

{
Exponential −λx
F ( x )= 1−e , x ≥ 0 Step 3: Critical value Dα = ... (K-S table). Degree of freedom = N
0 , x <0
Dα =0.565 Step 4: Compare Test statistic and Critical value
This example using exponential
If D< Dα →Cannot reject H 0
X =( 0.44+0.81+…+ 0.93)/5=0.474
If D> Dα →Reject H 0
λ=1/ X =1/0.474=2.11
F 1=1−e
− λ x1
=1−e
−2.11 ×0.05
=0.10 D< Dα (0.22< 0.565)→Cannot reject H 0
Example 7.3 (Question 2 Final 2022)
− λ x2 −2.11 ×0.14
F 2=1−e =1−e =0.26 Below is the data of processing time:
−λ x 3 −2.11 ×0.44 7.1, 10.3, 11.2, 13.9, 8.4, 19.2, 7.5, 9.1, 18.6, 13.2
F 3=1−e =1−e =0.60
b. Use appropriate hypothesis test to test the given data for uniform
− λx 4 −2.11× 0.81
F 4=1−e =1−e =0.82 distribution.
−λ x 5 −2.11 ×0.93 Continuous data + Small sample size => Dù ng K-S Test
F 5=1−e =1−e =0.86
Step 1: Hypothesis

Row 3: i/N
H 0 : Ri is UNIFORM distributed
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

H 1 : R i is NOT UNIFORM distributed


Step 2: Test statistic
Do chiề u ngang khô ng đủ chỗ nê n mình buộ c phả i tá ch thà nh 2 bả ng.
CHAP 8: VERIFICATION AND VALIDATION
|t 0|= | √|
Y −μ0
S/ n
Keyword: valid, validity, validation, invalid, power of the test, type II Step 3: Critical value (t-table)
x 7.1 7.5 8.4 9.1 10.3 error t α / 2 ,n−1
Fi 0.00 0.03 0.11 0.16 0.26 Goal of validation: Step 4: Conclusion
0.10 0.20 0.30 0.40 0.50
i/ N
0.10 0.17 0.19 0.24 0.24
- To produce a model that represents true behavior closely enough for
|t 0|>t α/ 2 ,n−1 => Reject (Model is invalid)
i/ N - F i decision-making purposes.

F i – (i-1)/N - - - - - - To increase the model’s credibility to an acceptable level. |t 0|<t α/ 2 ,n−1 => Cannot reject (Model is valid)

11.2 13.2 13.9 18.6 19.2 Example 8.1: (Question 3 Final 2022)
x Verification: building the model correctly (correctly implemented with
0.34 0.50 0.56 0.95 1.00 A simulation model of a manufacturing system is developed to
Fi good input and structure)
0.60 0.70 0.80 0.90 1.00 investigate the average WIP in the system. 10 replications of the model
i/ N Validation: building the correct model (an accurate representation of the
0.26 0.20 0.24 - - were run, each of 7 days’ duration. The results are shown in the table.
i/ N - F i real system)
The average WIP recorded in the system database in 6 months is 105.
F i – (i-1)/N - - - 0.15 0.10
i 1 2 3 4 5 6 7 8 9 10
Calibration and Validation of models
a=¿ 7.1, b : 19.2 Validation: the overall process of comparing the model and its behavior Y 112 90 88 100 97 97 105 108 117 110

to the real system. a. Conduct a statistical test to check the model validity. Use the level of
x 1−a 7.1−7.1
F 1= = =0.00 Calibration: the iterative process of comparing the model to the real significance alpha = 0.05
b−a 19.2−7.1 system and making adjustments. Step 0: Define Mean and Standard deviation


n
x 2−a 7.5−7.1 1 10
Y = ∑ Y i=102.4
F 2= =
b−a 19.2−7.1
=0.03 10 i=1 ∑ ( Y i −Y )2
i=1
S= =9.58
10−1
x 3−a 8.4−7.1
F 3= = =0.11 Step 1: Hypothesis
b−a 19.2−7.1
H 0 : E ( Y )=105
...
H 1 : E (Y ) ≠ 105
x 10−a 19.2−7.1 Step 2: Test statistic
F 10= = =1.00 I. T-TEST
b−a 19.2−7.1 Step 0: Define Mean and Standard deviation
|t 0|= | √||
Y −μ0
=
102.4−105
=0.86
|

1
n
n S/ n 9.58/ √ 10
Y= ∑Y
n i=1 i ∑ ( Y i −Y )2
Step 3: Critical value (t-table)
−¿¿
D = max ( D +¿ ,D ¿
) = max (0.26, 0.15) = 0.26 S= i=1
t α / 2 ,n−1=t 5 % /2 ,10−1=2.26
n−1
Step 1: Hypothesis Step 4: Conclusion
Step 3: Critical value D α = ... (K-S table). Degree of freedom = N = 10 H 0 : E ( Y )=μ0 |t 0|≤t α /2 ,n−1(0.86 < 2.26) → Cannot reject (model is valid with α =
Dα =0.41 H 1 : E ( Y ) ≠ μ0 0.05)
Step 4: Compare Test statistic and Critical value Step 2: Test statistic II. CONFIDENCE INTERVAL TESTING
Đọ c Appendix để hiể u hơn về Confidence Interval
D< Dα (0.26 <0.41)→Cannot reject H 0
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

S0 The worst-case error is ≤ ε accept the model.


Y ± t α /2 , R −1 (the model is valid)
0
√ R0 Either the best-case or worst- additional replications are
case error is ¿ ε necessary to reach a decision

μ0: là số quan sá t đượ c từ hệ thố ng thậ t, đề cho


Example 8.1: (Question 3 Final 2022)
ε : significant/critical difference, đề cho b. Use C.I to get a conclusion on the model validity. Use the level of

Procedure to check validity, given a critical difference ε significance alpha = 0.05. Assume a difference of 5 items is critical.

Step 1: Find C.I. Given μ0 = 105, ε =¿ 5


Confidence Interval: (Lower limit, Upper limit)
Step 1: Find C.I


n
Y −H Y +H 1 10
Y = ∑ Y i=102.4
Step 2: Check whether C.I contain μ0 are not
10 i=1 ∑ ( Y i −Y )2
i=1
Scenario a) C.I. does not contain μ0 S= =9.58
10−1
Scenario b) C.I. contains μ0 S0 9.58
H=t 5 % /2 , R −1 =2.26 × =6.85
Step 3: Calculate Best-case error, Worst-case error.
0
√ R0 √10
Best-case = min ¿ ¿ → C . I . :102.4 ± 6.85, which is (95.55, 109.25)
Worst-case = max ¿ ¿ Step 2: Check whether C.I contain μ0 are not
Step 4: Follow the table in corresponding scenario and conclude.
μ0=105 so C.I. contain μ0
a) C.I. does not contain μ0 Step 3: Calculate Best-case error, Worst-case error.
Best-case Best-case
Best-case = |109.25 – 105| = 4.25
Worst-case = |95.55 – 105| = 9.45
Step 4: Follow the table in corresponding scenario and conclude.
μ0 μ0
Worst-case Worst-case Follow table b), since the worst-case error is ¿ ε (9.45 > 5),

Condition Conclusion additional replications are necessary to reach a decision.

The best-case error is > ε the model needs to be refined .


(the model is invalid)
The worst-case error is ≤ ε accept the model.
(the model is valid)
The best-case error is ≤ ε , additional replications are
necessary to reach a decision
but the worst-case error is ¿ ε

b) C.I. contains μ0
Best-case Worst-case

μ0 μ0
Worst-case Best-case
Condition Conclusion
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

III. TYPE 2 – ERROR IV. PAIR T-TEST simulation model for 5 runs of 7 days each. The average WIP collected
Statistical Modeling Associated - Compare system output (historical realistic data) and model output. from the real system and from the simulation are presented in the table:
Terminology Terminology Risk - When using this technique, the modeler hopes that the simulation will i 1 2 3 4 5
Type I: rejecting H0 Rejecting a α Y 110 95 90 100 105
duplicate as closely as possible the important events that occurred in the
valid model Z 105 108 103 111 102
when H 0 is true real system.
a. Conduct a statistical test to check the model validity. (Alpha =0.05)
Type II: failure to reject Failure to reject an β - Implementation of this technique could be difficult for a large system,
H 0 when H 0 is false invalid model because of the need for simultaneous data collection of all input variables Step 0: Define Mean and Standard deviation.
and those response variables of primary interest. i 1 2 3 4 5
α : probability of type I error d 5 -13 -13 -11 3


Step 0: Define Mean and Standard deviation
β : probability of type II error 1
K
1
5
d= ∑ d j=−5.8 S D = ∑ 2
(also known as probability of failure to detect an invalid model or Input
Syste
m
Model Observed Squared Deviation
5 j=1 5−1 j=1
( d j−d ) =9.01
output Difference from Mean
probability to accept an invalid model) data output 2
set
Zij W ij dj ( d j−d ) Step 1: Hypothesis
Type I error is easily controlled by specifying a small level of H 0 : μd =0
2
significance α , say α = 0.1, 0.05, or 0.01. 1 Zi 1 Wi1 d 1=Z i 1−W i 1 ( d 1−d )
2
H 1: μd ≠ 0
Type II error can be controlled by specifying critical difference ε and 2 Zi 2 Wi2 d 1=Z i 2−W i 2 ( d 2−d ) Step 2: Test statistic

| || |
2
find the number of replications n. 3 Zi 3 Wi3 d 1=Z i 3−W i 3 ( d 3 −d ) d −0 −5.8−0
Type II error is more serious. Thus, it is important to design the |t 0|= = =1.44
. . . . . Sd/ √ K 9.01 / √ 5
simulation experiments to control the risk of accepting an invalid model. 2
K ZiK W iK d K =Z iK −W iK ( d K −d ) Step 3: Critical value (t-table)
For a fixed sample size n , increasing α will decrease β . Once α is set,
K
S D=¿ t α / 2 , K−1=t 5 %/ 2 ,5−1=2.78


and the critical difference to be detected is selected, the only way to 1
d= ∑ d j 1
K Step 4: Conclusion
decrease K j=1 ∑ ( d −d ) 2|t 0|<t α/ 2 ,n−1 (1.44 < 2.78) => Cannot reject (Model is valid)
K −1 j=1 j
β is to increase the sample size. Step 1: Hypothesis
H 0 : μd =0 b. In the statistical test above, what is the probability that we may
Power of the test = Probability detecting an invalid model = 1−β
accept an invalid model, providing that a difference of 5 units of the
Power of the test (0% – 100%), cà ng lớ n cà ng tố t, Beta cà ng nhỏ cà ng tố t. H 1: μd ≠ 0 WIP is considered significant?
Step 1: Find δ Step 2: Test statistic
β
| |
Critical difference, Probability of accept an invalid model =
ε d−0 0.85
δ= given |t 0|=
s S /√K Given: n = 5, α = 0.05, ε = 5, S D = 9.01
Step 3: Critical value (t-table)
Step 2: What do they ask? ε 5
Có 2 dạ ng bà i chính, đề hỏ i tìm gì thì mình xá c định nhữ ng cá i đã biế t. t α / 2 , K−1 δ= = =0.55
s 9.01
Step 4: Conclusion
#1: Tìm power of the test (hoặc β ), đã biế t α , n, và δ
|t 0|>t α/ 2 , K−1 => Reject (Model is invalid)
#2: Tìm n (số rep), đã biế t α , β (lấ y từ power of the test), và δ
|t 0|<t α/ 2 , K−1 => Cannot reject (Model is valid)
Step 3: Look at the graph of corresponding α (either 0.05 or 0.01)

Đọ c appendix mụ c 3 để nắ m cá ch nhìn graph Example 8.4: (Question 4 Final 2022)

Dù ng nhữ ng cá i đã biế t để tìm cá i đề yê u cầ u The modeler decided to use historical input data for validation. Five sets
of input data were collected over 5 different weeks, together with the
average WIP of each week. The input data were used to drive the
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

0.55

Using graph of α = 0.05, we get β of (n = 5, δ=0.55 ) is 0.85 or 85%.


 Giả sử đề hỏ i the power of test là bao nhiê u?

Power of the test = 1−β = 1 – 0.85 = 0.15

 Giả sử đề muố n probability of failure to detect an invalid model (or


probability to accept an invalid model) is smaller than 10%, how
many replication should be performed.

Using graph of α = 0.05, we get n of ( β = 10%, δ=0.55 ) is 40.

 Giả sử đề hỏ i muố n the power of test is 90%, how many


replications should be performed?

Power of test = 1 – β = 90% → β = 10%


Using graph of α = 0.05, we get n of ( β = 10%, δ=0.55 ) is 40.
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

CHAP 9: ABSOLUTE ANALYSIS


Examples:
I. TYPES OF SIMULATIONS WITH RESPECT TO OUTPUT ANALYSIS
- Assembly lines that shut down infrequently,
Explanation: Phầ n nà y thuầ n lý thuyế t, cô có thể cho ví dụ và hỏ i xem - Telephone and other communications systems such as:
dạ ng đó là terminating hay steady state, hoặ c yê u cầ u sinh viê n cho ví dụ . + The Internet,
1 case có thể là terminating hoặ c steady state tù y và o OBJECTIVE củ a The stopping time T E is generally unpredictable in advance. + Hospital emergency rooms,
analyst nữ a, nê n nhớ check kĩ objective. Objective: estimate the total time until the system breaks down. + Police dispatching and patrolling operations,
1. Terminating simulation Example 4: A manufacturing process runs continuously from Monday + Fire departments,

- Simulation that runs for some duration of time T mornings until Saturday mornings. The first shift of each work week is + Continuously operating computer networks.

- Opens at time 0 with well-specified initial condition and closes at the used to load inventory buffers and chemical tanks with the components II. TALLY/TIME PERSISTENT STATISTICS
and catalysts needed to make the final product. These components and
stopping time T E 1. Discrete-time statistics (Tally)
catalysts are made continually throughout the week, except for the last
- Estimation of a performance parameter θ (ordinary mean)
Example 9.1: Shady Grove Bank opens at 8:30 A.M. (time 0) with no shift Friday night, which is used for cleanup and maintenance.
- Simulation output data are of the form Y 1 ,Y 2 , Y 3 , …Y n
customers present and 8 tellers working (initial conditions) and closes at Thus, most inventory buffers are nearly empty at the end of the week.
During the first shift on Monday, a buffer stock is built up to cover the E.g: Time in system, waiting time, time start, time end
4:30 P.M. (time T E = 4:30 P.M – 8:30 A.M = 8 hours = 480 minutes)
eventuality of breakdown in some part of the process.
Here, the event E is the fact that the bank has been open for 480 2. Continuous-time statistic (Time persistent)
Objective: simulate the system during the first shift (time 0 to time T E =
minutes. - Estimation of a performance parameter ϕ (time weighted mean)
8 hours) to study various scheduling policies for loading inventory
Objective: simulate the interaction between customers and tellers over - Simulation output data are of the form Y ( t ) , 0<t <T E
buffers.
the entire day.
E.g: WIP, Inventory, cash flow, number in queue
Example 9.2: Consider the bank in example 1, but focus on the period
2. Steady state simulation
from 11:30 AM (time 0) to 1:30 PM, when it is especially busy. The Dấu hiệu phân biệt: nế u giá trị đó gắ n liê n vớ i từ ng entity, thì đó là tally,
- Run continuously, or at least over a very long period of time
nế u nó gắ n liề n vớ i từ ng thờ i gian khá c nhau, thì đó là time persistent.
simulation run length is T E =¿ 1:30 PM – 11:30 AM = 2 hours = 120 - To study steady state/long run properties that are not influenced by the
Ví dụ : waiting time và number in queue.
minutes. initial conditions
Thì waiting time là thờ i gian chờ củ a từ ng entity (entity 1 chờ 5p, entity
The initial conditions at time 0 (11:30 AM) could be specified in 2 ways: - Stopping time T E is determined not by the nature of the problem, but 2 chờ 8p, entity 3 chờ 2p), chứ khô ng thể thờ i gian chờ tạ i thờ i điể m nà y
a) the real system could be observed at 11:30 on different days and a
by the simulation analyst là bao nhiê u, thờ i gian chờ tạ i thờ i điể m kia là bao nhiê u.
distribution of number of customers in system (at 11:30 AM) could be
Number in queue là số lượ ng ngườ i chờ trong hà ng, thì nó sẽ khá c nhau
estimated, then these data could be used to load the simulation model
Example 9.1: The example is considered as terminating simulation tù y theo thờ i điể m (có thể là ban đầ u thì số lượ ng ngườ i chờ <5, đế n lú c
with customers at time 0 (11:30 AM)
because the analyst’s objective is one day’s operation of the bank, peak demand thì số lượ ng ngườ i chờ là >30), chứ nó khô ng thế là số
b) the model could be simulated from 8:30 AM to 11:30 AM without
including start up and close down. On the other hand, if the analyst were lượ ng ngườ i chờ củ a entity 1, số lượ ng ngườ i chờ củ a entity 2 đượ c.
collecting output statistics, and the ending conditions at 11:30 AM used
interested in some other aspects such as flow of money or operation of
as initial conditions for the 11:300 AM to 1:30 PM simulation. III. CONFIDENCE INTERVAL (C.I.) AND NUMBER OF REPLICATIONS
automated teller machines (which run continuously regardless of the
Example 9.3: A communication system consists of several components close down of the bank), then the system might be considered steady 1. Find Confidence interval
plus several backup components. Consider the system over a period of state. Đọ c Appendix để hiể u hơn về Confidence Interval

time T E , until the system fails. The stopping event E is defined by E = S0


Example 9.3: If the failed components were replaced and the system Y ± t α /2 , R −1
{A fails, or D fails, or (B and C both fail)}. Initial conditions are that all
continued to operate, and, most important, if the analyst were interested Mean
0
√ R0Half width (H)
components are new at time 0.
in studying its long-run behavior, then the example can be considered as
steady state. Example 9.5: Find the 95% C.I. for the mean waiting time.
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

Replication r Waiting time Recalculate S1with R1 (bằ ng cá ch chạ y simu :< mình khô ng có tự tính
1 0.88
2 5.04 đc)
3 4.13 => Check H thỏ a ≤ 0.5 chưa, nế u chưa, là m tiế p, nế u rồ i thì dừ ng tạ i
4 0.52
R1
0.88+5.04 +4.13+ 0.52 Find R2 based on S1 (y như cá ch tìm R1 ¿
Y= =2.64
4 => Check H thỏ a ≤ 0.5 chưa, nế u chưa, là m tiế p, nế u rồ i thì dừ ng tạ i
2 2
( 0.88−2.64 ) +…+ ( 0.52−2.64 ) R2
S2 = =( 2.28 )2 (có thể bấmmáy )
4−1 ...
S 2.28 Nó i chung kế t luậ n R nê n bằ ng bao nhiê u để H ≤ 0.5 ,nhưng vì xà i
H=t 0.025 ,3 =3.18 × =3.62
√R √4 Scũ nê n lú c nà o cũ ng phả i verify xem khi thế Shiện tại và o H có thỏ a
→ 2.64 ± 3.62minutes with 95% hô ng. a. Calculate the standard deviation & half width of 80% C.I of waiting
2. Find number of replications such that H < error time
S0 Approach 2: Given
H=t α /2 , R−1 ≤ϵ Mean = 1.9762
√R S0 3.16
H 0=t 5 % /2 , R −1 =2.09 × =1.47 Half width (95%) = 1.2
Approach 1:
√R √ 20
( )
2 R=7
t α /2 , R −1 S 0
( )
2

( )
2
R≥ H0 1.47 Tìm C.I. thì cầ n có Mean, và cầ n %, số lượ ng Rep, std để tính Half width.
ϵ R 1= × R 0= ×20=174
ϵ 0.5 Nhưng mình chưa có std. Bà i nà y cô kê u tính std coi như gợ i ý cho mình,

→ R ≥(
ϵ )
2
z S α /2 0 chứ nế u khô ng kê u tính std thì cũ ng phả i tự tính std để tìm Half width.
1 →S → R 1 2
Mean thì đề cho rồ i (nhìn chỗ Average, = 1.9762).
Vì mình đang tìm R sao cho H ≤ ϵ , nê n mình thế ϵ và o chỗ củ a H
Đề cho mình luô n Half width (95%) = 1.2, vậ y chỉ cầ n thế vô cô ng thứ c là
Approach 2: Assume S doesn’t change
tìm ngượ c lạ i đượ c std.

( ) H 1 2 R2
H2
=
R1
WARNING: cô có thể gà i bằ ng cá ch cho 2 loạ i data khá c nhau (như trong
bà i nà y là waiting time và number waiting). Cầ n chú ý đề kê u tính gì để sử

( )
2 dụ ng giá trị tương ứ ng.
H1
→ R 2= × R1 S
H2 H ( 95 % )=t 5 %/ 2 , R−1
Example 9.7: (Question 5 Final 2022) √R
Example 9.6: Find number of replications so that the mean waiting time The below picture shows an Arena report of a queue statistic. The Half
S
is within ± 0.5 minutes with 95% confidence. → 1.2=2.447 × → S=1.297
Width by default is 95% confidence level. The number of replications is 7.
√7
R0 = 20 S 1.297
H ( 80 % )=t 20% / 2 ,R −1 =1.44 × =0.706
S0 = 3.16 √R √7
Approach 1: Confidence Interval: 1.9762 ±0.706 ,

( ) (
2

)
2
z5 % / 2 S0 3.16 which is (___, ___)
R 1= = 1.96 × =153
ϵ 0.5
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

b. Propose how to have the same halfwidth value of the 80% C.I, but with => Pr ( x ≤1 )=22.66 % (dò bả ng Z)
95% confidence level.
Đề hỏ i larger thì là đang kê u tìm Pr( x ≥ 1 ¿ = 1 - Pr ( x ≤1 )
To do so, we can increase number of replications.
Assume the standard deviation does not change, the number of Đề cho a% và hỏ i average waiting time less than or more than 1 hour?, thì
replications can be estimated as bellow: mình là m procedure ngượ c lạ i. Đầ u tiê n dò bả ng z để tìm Z. Sau đó thế Z,

H (80 % )=0.706 μ và σ và o cô ng thứ c Z và tìm X.


H current ( 95 % ) =1.2
To make it have the same value of H (80 % ) (new value)

Rnew = (
H current 2
H new )
× R current =
1.2 2
0.706 (
×7=20.22 )
→ 21 replications
So we have to run the simulation with 21 replications to …
Tổ ng quá t: prospose how to have the same half width value of a% C.I, but
with b% confidence level.
If a% < b%: Increase number of replication
If a% > b%: Decrease number of replication

H ( a % ) (which is expected H new (b %) )


Cô ng thứ c từ
H current (b % ) approach 2

( )
2
H current
Rnew = × R current
H new
If a% < b%: round up Rnew
If a% > b%: round down Rnew

c. What types of two statistics (tally or time persistent) of the waiting


time and number of waiting in this example?
Waiting time: tally
Number of waiting: time persistent

d. Assume that the waiting time is Normal distribution, what is the


probability that the average waiting time is less than 1 hour? (Hint: use

this conversion Z = ( X −μ ) /σ

X−μ 1−1. 9762


Z= = =−0. 75
σ 1.297
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

CHAP 10: RELATIVE ANALYSIS |t 0|>t α/ 2 , R−1 => Reject a=Mean+ H b=Mean−H
Overall: Compare the relative performance (output) of 2 system designs, nế u a < θ1−θ 2< b
to discover whether any observed differences are due to differences in
|t 0|<t α/ 2 , R−1 => Cannot reject
* a â m cò n b dương => inconclusive
design or merely to the random fluctuation inherent in the models. Meaning:
* a â m b â m => system 1 faster/smaller than system 2 at least |b|
For example, compare 2 possible queue disciplines in a queueing system, Reject: the difference between 2 systems is significant
* a dương b dương => system 1 slower/larger than system 2 at least a.
2 possible ordering policies in a supply-chain inventory system, Cannot reject: the difference between 2 system is not significant

2 possible scheduling rules in a job shop,…


Faster vớ i slower là khi context về thờ i gian, cò n lạ i là smaller/larger.
Example 10.1: (Question 6 Final 2022)
I. COMMON RANDOM NUMBER TECHNIQUE (CRN)
Rep 1 Rep 2 Rep 3 Rep 4 Rep 5 Rep 6 Rep 7
Explanation Pull 8.2 11.6 10.1 7.7 13.6 10.8 9.5 2. Number of replications
CRN means that, for each replication, the same random numbers are used Push 6.6 9.5 7.5 5.9 11.4 7 8.1 (such that H is smaller than practically significant difference ϵ ¿
to simulate both systems. Therefore R1 and R2 must be equal. Conclude the difference of the 2 regime by using Common Random

( )
2
Number Technique (significant level = 5%)
t α /2 , R −1 S D
Thus, for each replication, Y r 1 and Y r 2 (output of system 1 and system
R≥
Step 0: Find Dr , D , and S D ϵ
2 in replication r , respectively) are no longer independent, but rather are
Rep 1 Rep 2 Rep 3 Rep 4 Rep 5 Rep 6 Rep 7
correlated. However, independent RN are used on different replications. D 1.6 2.1 2.6 1.8 2.2 3.8 1.4 Example 10.3: same data with example 10.1
If implemented correctly, CRN usually reduces the variance of the a. Conclude the difference of the 2 regimes by using 95% confidence
estimated difference of the performance measures and thus can provide 1.6+2.1+2.6 +…+1.4
D= =2.21 interval.
more precise estimates of the mean difference that can independent 7 Given: Á p dụ ng cô ng thứ c nà y là ra:
sampling. S D=0.81 (bấ m má y tính, có chỉ ở Appendix) R=7 replications SD
Procedure Alpha = 1 – 95% = 5% D ±t α /2 , R −1
Step 1: Hypothesis 0
√ R0
Step 0: Find Dr , D , and S D H 0 : E ( D )=0 Cầ n tìm D , S D vì đề chưa cho.


Dr =Y r 1−Y r 2 1
R H1: E (D )≠ 0
1
R S D= ∑
R−1 r=1
( Dr−D )
2
Step 2: Test statistic
Solution:

D= ∑ Dr
| ||
Rep 1 Rep 2 Rep 3 Rep 4 Rep 5 Rep 6 Rep 7
R r=1 |t 0|=
D−0
=
2.21−0
S D / √ R 0.81 / √ 7
= 7.22
| D 1.6 2.1 2.6 1.8 2.2 3.8 1.4

Step 3: Critical value (t-table) 1.6+2.1+2.6 +…+1.4


Step 1: Hypothesis D= =2.21
t α / 2 ,R −1=t 0.0025,7 −1 =2.45 7
H 0 : E ( D )=0
Step 4: Conclusion S D=0.81 (bấ m má y tính, có chỉ ở Appendix)
H1: E (D )≠ 0
Step 2: Test statistic |t 0|>t 5 % /2 ,7 −1 (7.22 > 2.45) => Reject SD 0.81
H=t 5 % /2 , R −1 =2.45 × =0.75

| D−0
| √ R0 √7
0

|t 0|= II. CONFIDENCE INTERVALS AND NUMBER OF REPLICATION


SD/ √ R 1. Confidence Interval (Đọ c Appendix để hiể u hơn về C.I.) So the confidence interval is 2.21 ± 0.75

Step 3: Critical value (t-table) SD Which means 2.21 – 0.75 ≤ θ1−θ2 ≤ 2.21 + 0.75,
D ±t α /2 , R −1
t α / 2 ,R −1 Mean
0
√ R0 Half width (H) Equals to 1.46 ≤ θ1−θ2 ≤ 2.96
Step 4: Conclusion
D=θ 1−θ2 So the pull system is larger than the push system at least 1.46 unit.
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

b. Suppose that a difference larger than 7 minutes is significant. Suggest a


number of replications to obtain the half width within the specified
precision. (alpha = 0.05)
Given: Solution:

( ) (
ϵ=7 minutes 2

)
2
t 5 % / 2 ,R −1 S D 2.45× 0.81
Alpha = 5%
R≥ = =0.08
ϵ 7
→ 1 replication
So no additional replication needed.
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

APPENDIX
1 chiế c appendix vô tri hihi :>
1. NHÌN BẢNG POWER OF TEST
COMPONENTS:
- Có 2 graph, graph alpha = 0.05 và graph alpha = 0.01

- Trụ c ngang là delta δ (tính đượ c)

- Trụ c dọ c là Beta = 1 – Power of the test


- Mấ y cá i curve là n (số lượ ng replication)
Có 2 dạ ng bà i chính, đề hỏ i tìm gì thì mình xá c định nhữ ng cá i đã biế t.

#1: Tìm power of the test (hoặc β ), đã biế t α , n, và δ


#2: Tìm n (số rep), đã biế t α , β (lấ y từ power of the test), và δ
Từ Mean, mình cộ ng Half
mộ t width
khoả ng (gọ i là Half
Halfwidth)
widththì ra upper limit.
#1: Tìm beta, biết alpha = 0.05, n = 5, và delta = 1 (tính được) Từ Mean, mình trừ mộ t khoả ng (gọ i là Half width) thì ra lower limit.
4. BẤM MÁY TÍNH AVERAGE VÀ STD
Do n = 5 nê n mình nhìn cá i curve n = 5 Ý nghĩa rằ ng nế u 95% C.I thì mình confidence rằ ng 95% data củ a mình
Máy tính fx580
Delta = 1 nê n dự ng mộ t đườ ng thẳ ng ở giá trị delta = 1 rơi và o khoả ng nà y.
Step 1: Mode: Statistics
Nhìn xem curve và đườ ng thẳ ng giao nhau tạ i đâ u, giố ng ngang qua để
Step 2: 1-Variable
tìm Beta. Nhữ ng lý thuyế t khá c
Step 3: Nhậ p data và o
=> Beta = 0.6 Across-replication data
Step 4: Bấ m AC, xong OPT
- Are independent, since they are based on different random numbers,
Step 5: Chọ n 1-var calculation hoặ c Variable
- Are identically distributed, since we are running the same model on
Average có kí hiệ u x each replication,
Std mình cầ n tìm là cá i có kí hiệ u sx - Tend to be normally distributed
Within-replication data
5. CONFIDENCE INTERVAL
Have none of the aforementioned properties.
The confidence interval (CI) is a range of values that’s likely to include a
population value with a certain degree of confidence. It is often expressed
as a % whereby a population mean lies between an upper and lower
interval.

#2: Tìm n, biết alpha = 0.01, beta = 0.2, và delta = 1


Delta = 1 nê n dự ng mộ t đườ ng thẳ ng đứ ng ở giá trị delta = 1
Beta = 0.2 nê n dự ng mộ t đườ ng thẳ ng ngang ở giá trị beta = 0.2
Nhìn xem điể m giao củ a 2 đườ ng thẳ ng đang rơi trú ng cá i curve nà o
=> n = 15
Simulation Theory. Noted by Mỹ Dung.
Ref: Dr. PHTram, textbook (Jerry Bank)

Nhữ ng thứ cầ n in:


- Slide cô
- Bả ng t, bả ng z, bả ng Chi-square, bả ng K-S
- 2 graphs power of test

You might also like