28
1 Outline Outline stages and topics in simulation generation of random variates

1 Outline stages and topics in simulation generation of random variates

Embed Size (px)

Citation preview

1

OutlineOutline

stages and topics in simulation generation of random variates

2

Stages of SimulationStages of Simulation

Model Experimentation and Optimization

Implementation of Simulation Result

Problem Formulation

Data Collection and Analysis

Model Development

Model Verification and Validation

# of servers in a counter

3

Topics in SimulationTopics in Simulation

knowledge in distributions and statistics random variate generation input analysis output analysis verification and validation optimization variance reduction

4

Model FormulationModel Formulation

model

conceptual model

analytical or computer

model

5

Problem FormulationProblem Formulation

conceptual and analytical models: identify & define variables X, objective functions f, & constraints

through observing the system never forcing for a standard model

This is an M/M/1 queue

This is a GI/G/1 queue … … …

6

Data Collection and Analysis Data Collection and Analysis – Actual Tasks– Actual Tasks

How to conduct data collection? How much time, effort, and money to deploy to get data? What kind of sampling techniques should be used? How to ensure that the objects under observation behave normally? How to deal with outliners in the data? Is the set of data enough (representative)? What distribution do the collected data values of Xi appear to follow?

What are the parameter values of the distribution of data of Xi?

How good is the fit of data to selected distributions and parameter values? Do the random quantities Xi and Xj appear to be independent?

Do the data values of a variable Xi appear to follow some pattern?

7

Input AnalysisInput Analysis

statistical tests to analyze data collected and to build model standard distributions and statistical tests estimation of parameters enough data collected? independent random variables? any pattern of data? distribution of random variables? factors of an entity being independent from each other? data from sources of the same statistical property?

8

Random Variate GenerationRandom Variate Generation

the generation of samples from a given distribution

different methods, eventually tracing back to the generation of random variates from uniform(0, 1)

various tests correct distribution? best parameter values? independent of random variables? ….

9

Output AnalysisOutput Analysis

to draw meaningful inferences by statistical methods What is a good point estimate? What is an interval estimate? How large is the variance of the point estimate? How many simulation runs is needed to get a pre-

specified confidence interval? Does the variance estimating method correct? …

10

Output Analysis Output Analysis – Terminating System– Terminating System

output analysis: statistical tests for the results n replications = 1n

= (1, , n), where i is outcome of the ith

replication sampled values: X1(1), …, Xn(n)

estimate estimate by by = g(X1(1), …, Xn(n))

11

unbiased estimator of ? variance of estimator efficient estimator of ? confidence on the range estimator # of simulation runs (replications) required?

Output Analysis Output Analysis – Terminating System– Terminating System

statistical tests associated with

12

Output Analysis Output Analysis – Non-Terminating System– Non-Terminating System

similar questions in the terminating system possibly with dependent random variables

13

Validation and VerificationValidation and Verification

conceptual model

systemanalytical

or computer model

solution

validation: are we solving the right model,

i.e., can our model really solve the

problem?

verification: are we solving the model right, i.e, have we made any mistake in these tasks?

model

14

Verification and ValidationVerification and Validation

Verification: Is the simulation model right? Does the simulation match with the conceptual model? debugging simulation programs

Validation: Is it a right model to simulate? Is the simulation model or even the conceptual model

a meaningful and accurate representation of the real system?

checking the consistency of the model with reality and its value as a model to simulate

15

Model Experimentation Model Experimentation and Optimization and Optimization

X: characterized by a parameter , denoted as X() : can be a vector

examples: carousel system: = given order or item picking policy 8-hour workshop: = (1, , k) being the production

rates of k workers GI/G/1 service station: = (arrival rate of customers,

service rate of the server)

look for the best

16

Model Experimentation and Model Experimentation and Optimization Optimization

the determination of opt

)( )(

XEoptopt

questions to answer What are the best values for the parameters? How to search for such best values? What is the most convenient way to get such values?

17

Variance Reduction MethodsVariance Reduction Methods

How to get an unbiased estimator with smaller variances?

different g’s to estimate some g’s has less variance than others

e.g., one versus two replications

speeding up simulation by choosing specific g’s

estimate estimate by by = g(X1(1), …, Xn(n))

18

The Generation of Random VariatesThe Generation of Random Variates

generators met before Excel rand(), Random Number Generator Assignments: die and random movement,

exponential, discrete distribution, random location, Binomial distribution

19

Methods to Generate Random VariatesMethods to Generate Random Variates

inverse transform convolution composition acceptance / rejection

20

Generation of Random VariatesGeneration of Random Variates

random variable: a mapping from the sample space to the set of real number

random variate: an outcome (i.e., sample point) of a random variable

key: uniform (0, 1) random variates {un} getting random variates from any distributions,

including those from multi-variate distributions of any arbitrary joint distributions

21

Inverse TransformInverse Transform

to simulate the flips of a fair coin head if 0 < u < 0.5, tail if 0.5 < u < 1

to simulate X = 1 w.p. 0.5, X = 0 w.p. 0.5 x = 1 if 0 < u < 0.5, x = 0 if 0.5 < u < 1

general form: looking for a function h such that h(U) (or h(U1, …, Uk)) ~ X x = h(u) (or x = h(u1, …, uk))

22

Inverse TransformInverse Transform

what is function h for the case: to simulate X = 1 w.p. 0.5, X = 0 w.p. 0.5

x = 0 if 0 < u < 0.5, x = 1 if 0.5 < u < 1

the form of function h: h(u) = 0 if 0 < u < 0.5 h(u) = 1 if 0.5 < u < 1

h being the inverse function of F, the distribution function of X

23

Distribution Function Distribution Function FF and its Inverse Functionand its Inverse Function

0

F(x)

x1

0.5

1

0.5

h(u)

u1

1

24

Inverse TransformInverse Transform

same idea of h = F-1 to any discrete random variables

same idea to any continuous random variables (as long as F-1 is known)

clever ways to check the inverse transform

Algorithm 2.3.2.1 for Exponential

25

ConvolutionConvolution

X = b1Y1 + ... + bnYn

generate variates of Y1 to Yn

weighted sum Y variates as the expression

Example 2.6.2 for Binomial

Example 2.5.3 for Triangular

Example 2.6.3 for Erlang (k, )

26

CompositionComposition

. ..

, ..

,

, 11

kk ppw

ppw

Y

Y

X

equivalent form in distribution

F(x) = p1F1(x ) + ... + p1Fk(x )

use a zero-one uniform variate to determine the “type” and then

generate the corresponding Y variate

27

Acceptance / RejectionAcceptance / Rejection

generate a variate from the uniform distribution on a disc of unit radius

1o generate a variate of (X, Y) such that X, Y X, Y ~ i.i.d. uniform [-1, 1]

2o accept (x, y) to be the desirable variate if x2 + y2 1; else go to 1o

result: uniform in {(x, y)| x2 + y2 1}

28

Acceptance / Rejection Acceptance / Rejection – Discrete Distribution– Discrete Distribution

X ~ {pi}; Y ~ {qi} such that pi/qi c for all i

1o Generate y from Y ~ {qi}.

2o Generate u from U. 3o If cqyu < py, set x = y and stop; else go to 1o.

similar procedure applicable to continuous distribution with {pi}, {qi} replaced by the

corresponding density functions

primarily for continuous distributions whose F-1 is

hard to find