210 likes | 425 Views
Random-Variate Generation. Need for Random-Variates. We, usually, model uncertainty and unpredictability with statistical distributions Thereby, in order to run the simulation models involving uncertainty, we need to get samples from these statistical distributions
E N D
Need for Random-Variates • We, usually, model uncertainty and unpredictability with statistical distributions • Thereby, in order to run the simulation models involving uncertainty, we need to get samples from these statistical distributions • Here, we assume that the distributions (type and parameters) are already specified • ARENA comes with ready functions to sample from specified distributions. • It is still useful to know how it is done • We will generate the variates always using random numbers, whose generation is discussed previously
Inverse Transform Technique -- Exponential Distribution • To generate samples from exponential distribution we use the inverse transform technique Step 1. Compute the cdf of the desired random variable X, F(x). Step 2. Find the inverse of F(x) function Step 4. Generate uniform random variables R1, R2, R3, … and compute the desired random variates by
Inverse Transform Technique -- Exponential Distribution • Example: Generate 200 variates Xi with distribution exp(l= 1) • Check: Does the random variable X1 have the desired distribution?
Proof? • Can you prove that the numbers you have generated are indeed samples from an exponential distribution?
Other Distributions • Uniform Distribution [ UN(a,b)] (X = a + (b-a)R) • Does it really work? • Weibull Distribution • Derive the transformation • Triangular …. • The moral is if we can find a closed-form inverse of the cdf for a distribution we can use this method to get samples from that distribution
Continuous Functions without a Closed-Form Inverse • Some distributions do not have a closed form expression for their cdf or its inverse (normal, gamma, beta, …) • What can be done then? • Approximate the inverse cdf • For the standard normal distribution: • This approximation gives at least one-decimal place accuracy in the range [0.0012499, 0.9986501]
Discrete Distributions • An Empirical Discrete Distribution • p(0) = P(X=0) = 0.50 • p(1) = P(X=1) = 0.30 • p(2) = P(X=2) = 0.20 • Can we apply the inverse transform technique?
Discrete Distributions • Let x0 = -, and x1, x2, …, xn, be the ordered probability mass points for the random variable X • Let R be a random number
Discrete Distributions • A Discrete Uniform Distribution
Discrete Distributions • The Geometric Distribution • Some algebraic manipulation and …
Generate R no Condition yes Output R’ Acceptance-Rejection Technique • Useful particularly when inverse cdf does not exist in closed form, a.k.a. thinning • Illustration: To generate random variates, X ~ U(1/4, 1) • R does not have the desired distribution, but R conditioned (R’) on the event {R ³ ¼} does. • Efficiency: Depends heavily on the ability to minimize the number of rejections. Procedures: Step 1. Generate R ~ U[0,1] Step 2a. If R >= ¼, accept X=R. Step 2b. If R < ¼, reject R, return to Step 1
Acceptance-Rejection Technique • Poisson Distribution • N can be interpreted as number of arrivals from a Poisson arrival process during one unit of time • Then time between the arrivals in the process are exponentially distributed with rate
Acceptance-Rejection Technique • Step 1. Set n = 0, and P = 1 • Step 2. Generate a random number Rn+1 and let P = P. Rn+1 • Step 3. If P < e-, then accept N = n. Otherwise, reject current n, increase n by one, and return to step 2 • How many random numbers will be used on the average to generate one Poisson variate?
Direct Transformations • Consider two normal variables Z1 and Z2
Direct Transformation • Approach fornormal(m,s2): • Generate Zi ~ N(0,1) • Approach for lognormal(m,s2): • Generate X ~ N(m,s2) Xi = m + s Zi Yi = eXi
Convolution Method • Erlang Distribution • An Erlang-K random variable X with parameters (K, ) (1/ is the mean, K is the stage number) can be obtained by summing K independent exponential random variables each having mean 1/(K )