Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Random Number Generation Dr. Jerrell T. Stracener, SAE Fellow Update: 1/31/02.

Similar presentations


Presentation on theme: "1 Random Number Generation Dr. Jerrell T. Stracener, SAE Fellow Update: 1/31/02."— Presentation transcript:

1 1 Random Number Generation Dr. Jerrell T. Stracener, SAE Fellow Update: 1/31/02

2 2 Generating Random Numbers Generating values of a random variable using the probability integral transformation to generate a random value y from a given probability density function f(y): 1. Generate a random value r U from a uniform distribution over (0, 1). 2. Set r U = F(y) 3. Solve the resulting expression for y.

3 3 Generating Random Numbers with Excel From the Tools menu, look for Data Analysis.

4 4 Generating Random Numbers with Excel If it is not there, you must install it.

5 5 Generating Random Numbers with Excel Once you select Data Analysis, the following window will appear. Scroll down to “Random Number Generation” and select it, then press “OK”

6 6 Generating Random Numbers with Excel We would like U(0, 1). So select “Uniform” under the “Distribution” menu. Type in “1” for number of variables and 10 for number of random numbers. Then press OK. 10 random numbers of uniform distribution will now appear on a new chart.

7 7 Generating Random Numbers f(y) F(y) y y 1 2 3 1.0 0.8 0.6 0.4 0.2 0 riri yiyi

8 8 Generating Random Values from the Exponential Distribution E() generate r i from U(0, 1) calculate x i = - ln(1 - r i ) since for i = 1, 2, …, n

9 9 Generating an Exponential Distribution with Excel See charts 7 - 10. Select a  that you would like to use, we will use  = 5. Type in the equation - ln(1 - r i ), with filling in  as 5, and r i as cell A1. Now with that cell selected, place the cursor over the bottom right hand corner of the cell. A cross will appear, drag this cross down to B10. This will transfer that equation to the cells below. Now we have an exponential distribution in cells B1 - B10.

10 10 Generating Random Values from the Weibull Distribution W(, ) generate r i from U(0, 1) calculate x i = [-ln(1 - r i )] 1/ since for i = 1, 2, …, n

11 11 Generating a Weibull Distribution with Excel See charts 7 - 10. Select a  and  that you would like to use, we will use  = 100,  = 20. Type in the equation x i =  [-ln(1 - r i )] 1/ , with filling in  as 100,  as 20, and r i as cell A1. Now transfer that equation to the cells below. Now we have an Weibull distribution in cells B1 - B10.

12 12 Generating Random Values from the Lognormal Distribution Ln(, ) generate r i from N(0, 1) calculate since Ln x i =  + r i  for i = 1, 2, …, n

13 13 Generating a Lognormal Distribution with Excel See charts 7 - 10. Select a  and  that you would like to use, we will use  = 2,  = 1. Type in the equation, with filling in  as 2,  as 1, and r i as cell A1. Now transfer that equation to the cells below. Now we have an Lognormal distribution in cells B1 - B10.


Download ppt "1 Random Number Generation Dr. Jerrell T. Stracener, SAE Fellow Update: 1/31/02."

Similar presentations


Ads by Google