Applications for Reduction
There are several applications for reduction:
- Using the result of an analysis as an input for another analysis;
- Shortening the run time for a large analysis without sacrificing the numerical
accuracy of the result;
- Creating a random variable with 2 - 6 states from a set of historical values
and probabilities; and / or
- Obtaining statistical information on the outcome distribution of your model.
Please read the section on reduction in the manual starting on page 456 before referring
to this supplemental documentation.
Using the result of an analysis as an input for another analysis
A large model frequently consists of several independent models, e.g., a financial
model, a technical model. etc. If you have a separate code module for a model,
you can reduce it into a single random variable. The reduction will write the
code for this variable into the clipboard or a separate program file. You may
then either paste the code directly into the new program, or include the file.
Shortening the run time for a large analysis
If you have independent sub-models in your program, you can shorten the run-time
of a large analysis by converting those sub-models into single random variables.
To reduce a section of your model, you need to convert the sub-model into an
independent program (there is no automated way to reduce only parts of a model.)
Once you run a reduction on this program, you may include the resulting variable
in the rest of the model. The Monte Carlo Sampling technique can be used to
reduce the time to run the reduction.
Example 1 describes the conversion of an independent sales model into a single
random variable of three states. Example 2 explains the steps that are necessary
if dependencies exist between the sub-model and the overall program.
Creating a random variable
Reduction makes it possible to create a random variable with 2 - 6 states from
a set of historical values and probabilities. To create such a random variable,
first create a chance node with the number of states corresponding to the number
of data points. If no probabilities are available and all outcomes have equal
probabilities, the probability for each state is 1/(# of data points). Once
you run a reduction on this event, the data will be aggregated into a random
variable which can be included in another model.
How to create a node from available data
A set of data points is frequently contained in a spreadsheet. To avoid retyping
all values in DPL when creating a large node, consider the following tips:
- Use the code editor rather than the influence diagram to create the chance
node.
- If you have both value and probability data, consider transposing columns
into rows such that the probabilities are in the top row, with matching data
points in the row below.
- Simply copy the row or column with data points from the spreadsheet, paste
it straight into DPL code, and insert the necessary commas between values.
- If you have a large amount of data and want to avoid typing commas between
the values, a quicker process would be save the spreadsheet file in Comma
Separated Value format (*.csv). You can then open the *.csv file directly
in the DPL code editor and modify it to create a small program.
Obtaining statistical information on the outcome distribution of your model
If you check the "Display moments" button in the reduction dialog box, the
moments (about 0) of the outcome distribution of your model will be printed
to the log. This feature is an alternative to exporting the interval midpoints
from the distribution window to a spreadsheet package. It is also more exact,
since the interval midpoints in the distribution window may be aggregated outcome
values, depending on the number of paths in your model and the number of intervals
you specified. To obtain the standard deviation of the outcome distribution,
use the formula: sqrt(m1-m2^2).
Example 1
//Sales Model
chance market_size.{small, nominal, large} = {.1, .8} = 80000, 100000, 110000;
chance level_of_competition. {none, low, nominal, high} = {.05, .2, .55};
value market_share | level_of_competition = .85, .65, .5, .35;
value sales = market_size * market_share;
//Revenue Model
chance unit_price. {low, nominal, high} = {.25, .5} = 1.25, 1.5, 1.75;
value revenues = sales * unit_price;
//Cost Model
chance unit_cost. {low, nominal, high} ={.1, .55} = .26, .38, .46;
value costs = sales * unit_cost;
sequence:
gamble on market_size then
gamble on level_of_competition then
gamble on unit_price and get revenues then
gamble on unit_cost and pay costs
You are satisfied with the sales model, which is an independent part of the
overall program, and would like to convert it into a single random variable
of three states. First, you load a copy of the program into a second file. Second,
you modify the sequence section so that it generates the particular results
you need, in this case, a distribution on sales. Although you could eliminate
the unreferenced definitions in the data definition section, it is not necessary,
since DPL will ignore them.
//Sales Model
chance market_size. {small, nominal, large} = {.1, .8} = 80000, 100000, 110000;
chance level_of_competition. {none, low, nominal, high} = {.05, .2, .55};
value market_share | level_of_competition = .85, .65, .5, .35;
value sales = market_size * market_share;
//Revenue Model - not needed but DPL will ignore
chance unit_price. {low, nominal, high} = {.25, .5} = 1.25, 1.5, 1.75;
value revenues = sales * unit_price;
//Cost Model - not needed but DPL will ignore
chance unit_cost. {low, nominal, high} = {.1, .55} = .26, .38, .46;
value costs = sales * unit_cost;
sequence:
gamble on market_size then
gamble on level_of_competition then
get sales
Next, compile the new program file. When compilation is complete, select Analysis | Decision Analysis
and check Risk Profile. Then, with the risk profile chart active, select Analysis | Run reduction. Fill in
3 in the Number of states box. The DPL source code defining the random variable
will be generated and placed in the Clipboard. The final
step is to replace the sales model with the random variable and modify the original
sequence section to reflect the elimination of two chance events:
//Sales
Model
chance sales. {3} = { 0.310969502459963, 0.608035213491635, }
= 36098.1525197623, 54780.9198015704, 82700.4594537479;
//Revenues Model
chance unit_price. {low, nominal, high} = {.25, .5} = 1.25, 1.5, 1.75;
value revenue = sales * unit_price;
//Cost Model
chance unit_cost. {low, nominal, high) = {.1, .55} = .26, .38, .46;
value costs = sales * unit_cost;
sequence:
gamble on sales then
gamble on unit_price and get revenues then
gamble on unit_cost and pay costs
This process is relatively simple, since the code to be reduced was not influenced
by any of the remaining events. What if the code to be reduced is a dependency
on an event that is not to be reduced?
Example 2
To see how to handle dependencies, assume that you want to remove the revenues
model from your program and replace it with a random variable of two states.
This model depends on sales. Any random variable that replaces this code will
also be dependent on sales. The new random variable would look like this:
chance revenues. {2} | sales =
{ ? }, //sales.s1
{ ? }, //sales.s2
{ ? } //sales.s3
=
?, //sales.s1, revenues.s1
?, //sales.s1, revenues.s2
?, //sales.s2, revenues.s1
?, //sales.s2, revenues.s2
?, //sales.s3, revenues.s1
?; //sales.s3, revenues.s2
So, how do you do this? DPL will not give it to you directly. It does not
handle dependencies, so you have to do some work on your own.
First, load a copy of the original program into a new program file and change
the sequence section to reflect the information you need:
sequence:
gamble on sales then
gamble on unit_price and get revenues
Now, you need to set sales to its first state, so that you can fill in the
first line of the revenues.
sequence:
set sales.s1 then
gamble on unit_price and get revenues
Now compile and run reduction as before (filling in 2 in the Number of states box).
Open a new Program window and paste in the code
just produced. Now, run the reduction twice more, setting sales to its second
and third states. Paste the results of each of these reductions into the new
Program window. The results of the three reduction runs will look like this:
chance rev_sales_s1. {2} = {
0.499999999999958, }
=
47765.9166708854,
60528.5408884004;
chance rev_sales_s2. {2} = {
0.50000000000003, }
=
72487.3897345245,
91855.3696701879;
chance rev_sales_s3. {2} = {
0.500000000000006, }
=
109431.175258875,
138670.203102369;
Use the DPL editor's Cut and Paste commands to combine these into a single
random variable:
chance revenues. {2} | sales =
{0.499999999999958},
{0.50000000000003},
{0.5000000000000006}
=
47765.9166708854,
60528.5408884004,
72487.3897345245,
91855.3696701879,
109431.175258875,
138670.203102369;
The last step is to insert this random variable into the original program,
replacing the revenue model.
//Sales Model
chance sales. {3} = {
0.310969502459963,
0.608035213491635, }
=
36098.1525197623,
54780.9198015704,
82700.4594537479;
//Revenue Model
chance revenues. {2} | sales =
{0.499999999999958},
{0.50000000000003},
{0.500000000000006}
=
47765.9166708854,
60528.5408884004,
72487.3897345245,
91855.3696701879,
109431.175258875,
138670.203102369;
//Cost Model
chance unit_cost. {low, nominal, high} = {.1, .55} = .26, .38, .46;
value costs = sales * unit_cost;
sequence:
gamble on sales then
gamble on revenues and get revenues then
gamble on unit_cost and pay costs
Note that the sequence section must also be modified to reference the new random
variable.
Obviously, this technique is much simpler if you can find a fairly independent
piece of the program to reduce. You probably wouldn't want to try this with
more than two or three dependencies.
|