160 likes | 231 Views
Chapter 8 Random-Variate Generation. Purpose & Overview. X = (-1/ λ ) ln(1 – R). Inverse Transform Technique Exponential, uniform, weibull and triangular and empirical distributions. Exponential Distribution: Consider a RV X that is expo. Distributed with mean λ
E N D
Chapter 8 Random-Variate Generation
X = (-1/λ) ln(1 – R) Inverse Transform Technique Exponential, uniform, weibull and triangular and empirical distributions. Exponential Distribution: Consider a RV X that is expo. Distributed with meanλ Step 1 : Compute the cdf of the desired random variable X. F(X)=1 - e –λx , x>=0. Step2: Set F(X)=R on the range of X. 1 - e –λx = R , x>=0 Step3: Solve the equation F(X) = R for X in terms of R. Step 4: Generate uniform random nos R1, R2, R3…………. And compute the desired random variates by Xi = F -1 (Ri ) F -1 (R) = (-1/λ) ln(1 – R) Xi = (-1/λ) ln(1 – Ri) = (-1/λ) ln Ri
Inverse Transform Technique Uniform distribution: Consider a RV X that is uniformly distributed on interval [a,b] Step1: cdf is 0 , x < a F(x) = (x-a) / (b-a) , a <= x <=b 1 , x > b Step2: Set F(X) = (X – a)/(b – a) = R Step3: Solving for X in terms of R yields X = a + (b – a)R
X = α [ -ln(1-R)]1/β Inverse Transform Technique Weibull Distribution: Consider a RV X that has Weibull distribution with α>0 ,β >0 v=0 Step1: cdf is given by F(X)= 1 - e –(x/ α) Step2: Let F(X) = R Step3 :Solving for X in terms of R yields
Triangular Distribution Consider a RV X that has triangular distribution with end points (0,2) and mode at 1 Step1 :Cdf is 0 x<=0 F(X)= x2/2 0< x <=1 1 - ((2-x)2/2) 1<x<=2 1 x>2 Step2: For 0<= X <=1, R = x2/2 and for 1<= X <=2 , R = 1 - ((2-x)2/2) Step3: X = sqrt(2R) , 0 <= R <= ½ = 2 – sqrt(2(1 – R)) , ½ < R <= 1
Convolution Method Refers to adding together two or more random variables to obtain a new random variable with desired distribution. Used to obtain Erlang variates and bionomial variates. • This equation implies that K uniform random nos are needed for each erlang variate generated.
Erlang Distribution An Erlang R.V X with para (k, θ) can be shown to be the sum of K independent expo. RVs , Xi(i=1,2…….K), each having mean 1/K θ i.e X= ∑ Xi i = 1…….K Since each Xi can be generated by equation Xi= (-1/λ) ln Ri with λ = 1/K θ, an Erlang variate can be generated by X = ∑ (-1/k θ)ln Ri = (-1/k θ)ln (πRi) i = 1…….K This equation implies that K uniform random nos are needed for each erlang variate generated. Example.
Acceptance –Rejection Technique Uniform Distribution Generate random variates uniformly distributed between ¼ and 1 Step 1: Generate a random number R Step2a: If R >= ¼, accept X=R then go to step 3 . Step2b: If R< ¼ , reject R and return to step1. Step3: If another uniform random variate on [1/4 , 1] is needed, repeat the procedure beginning at step1. If not, stop. Here R itself does not have a desired distribution but R conditioned on the event {R>=1/4} does have a desired distribution. The efficiency of this technique depends heavily on being able to minimize the number of rejections. The mean no. of random numbers R required to generate one variate X is one more than number of rejections.
Acceptance –Rejection Technique Poisson Distribution Steps for generating a Poisson random variate: • Set n=0, P=1. • Generate a random number Rn+1 and replace P by P. Rn+1 • If P < e-α then accept N=n. Otherwise , reject the current n, increase n by one, and return to step2.
Acceptance –Rejection Technique Gamma Distribution Step 1: Compute a = (2β - 1)1/2 b = 2β – ln 4 + 1/a Step 2: Generate R1 and R2. Step 3: Compute X = β[ R1/ (1-R1) ]a . Step 4a: If , reject X and return to step 2. Step 4b:If ,use X as the desired variate(Mean=variance=β) Step 5: Replace X by X / βθ (if it is desired to have mean=1/θ and var=1/ βθ2 )