| Applying science to business management |
  
Custom Continuous Distributions
If DecisionPro does not include a random number generator with
the distribution you want, you can create a custom generator.
However, to do this you will need to know an equation for the
desired probability density function (PDF).
Suppose you want a random number generator that returns a
number between 0 and 10 with a parabolic shape as graphed below.
This PDF graph uses the formula
To create a generator that has this distribution, click Custom
in the Make Stochastic Input dialog box (Tools, Monte
Carlo, Make Stochastic Input).
This will bring up the Custom Distribution dialog box.
Here you enter the equation for the desired distribution plus the
necessary limits.
If you click the Update Graph button, DecisionPro will
display the PDF for the distribution you chose.
When you are satisfied that the distribution is what you want,
just click Finish.
Lets
consider another example. Suppose you want to create a random
number generator with a normal (or Gaussian) distribution. Of
course, the easiest way to do this is just to use the built-in
generator nrand. However, the
custom generator tool will be used here to illustrate a few
concepts.
The equation for a Gaussian distribution with mean zero and
standard deviation of one is
1/sqrt(2PI)*exp(x^2/-2)
One peculiar property of this equation is that x extends from
negative infinity to positive infinity. However, you need
explicit limits. Since the graph shows that the curve approaches
zero at about -4 and 4, these values will be used for the limits.
Another feature of this equation is that it is difficult to
know exactly what the maximum value is. To find this
automatically, you can just press the Find Maximum button
in the Custom Distribution dialog box.
You dont
need to be exact about the limits in order for the custom
generator to work properly. However, if you choose limits that
are too tight, the distribution will be distorted. If you choose
limits that are too relaxed, the generator will be slow.
How it Works
To generate a custom distribution, DecisionPro uses the
rejection method. This is best illustrated by example. Suppose
you want to generate Gaussian deviates that fit the distribution
below.
First, generate two random numbers drawn from uniform
distributions. The first number ranges from -4 to 4. The second
number ranges from 0 to 0.4. Next, imagine you use these two
numbers as x and y coordinates to create a point on the graph
above. The point will always lie in the box shown on this graph.
If the point lies below the distribution curve, you return the
x-value as your random number. If the point lies above the curve,
you reject it, generate two new numbers, and see where they lie.
Since all points you generate are equally likely to be anywhere
in the box, rejecting all points above the curve leaves you with
deviates drawn from the desired distribution.
This method is quite robust and it can be used to produce
virtually any distribution. However, this method is not very
fast. Depending on how you select the limits, DecisionPro might
have to reject many pairs before finding a single match. Using
the limits illustrated in the graph above, about one third of the
pairs is accepted as valid deviates and the remaining two thirds
are rejected. Now, imagine if you had set the limits at -10, 10,
and a maximum of 0.5:
The resulting random number generator will be almost identical
to the one generated with the smaller limits. However, you will
reject about 9 points for every good one you keep. This makes the
generator considerably slower.
|