(Click here for older, Version 1.15 User Guide)
About YASAI
The YASAI.XLA add-in is intended is intended for teaching elementary Monte Carlo simulation. It does not provide the full functionality of
@Risk,
Crystal Ball, and other commercial products, but should be sufficient for elementary instruction. A key advantage is that YASAI.XLA consists of a single downloadable file that can be run on any PC with a recent version of Excel, without requiring administrator privileges or a special installation procedure. It is also designed to be very straightforward to use. In exchange for this simplicity, YASAI may run simulations slower than
commercial products, since all the random number generation code is interpreted in Visual Basic.
Installing YASAI
We have encountered some problems with the automated installation procedure; it is no longer recommended. Manual installation is not difficult.
Manual Installation for Excel 2003
First, you must download the file YASAI.XLA from the YASAI download page, and if necessary move it to the system on which you wish to install YASAI.
If YASAI is installed, "YASAI Simulation..." and "YASAI Charts..." should
appear on Excel's "Tools" menu.
Manual Installation for Excel 2007
First, you must download the file YASAI.XLA from the YASAI download page, and if necessary move it to the system on which you wish to install YASAI.
YASAI should now be loaded. A new "Add-Ins" button should appear in the ribbon interface. If you click it, the buttons "YASAI Simulation..." and "YASAI Charts..." should appear. These buttons should bring up the simulation and charting dialog boxes, respectively.
Known issues with Excel 2007:
GENGEOMETRIC(p): Returns a
geometric random variables with a probability p of being 1. This
variable is equal to the number of trials of a mean p Bernoulli (or
equivalently, GENBINOMIAL(1,p)) variable until the value 1 is obtained.
The value of p must be greater than 0, and less than or equal to 1, or an
error value is returned. GENTRIANGULAR(a, b, c): Returns a value
from a triangular distribution with minimum a, mode b, and maximum
c. The arguments must be numbers with the property a <
b < c, or an error value is returned.
Specifying Scenarios
Specifying Output
Running the Simulation
YASAI
analyzes your spreadsheet to determine how many scenarios appear to be
needed. It places this number in the default number of scenarios
box. If this number is satisfactory, click on the "Default"
button. If you would like a different number of scenarios, click on the
"set to" button and enter the number of scenarios you want. The
"Sample Size" box is the number of times YASAI will recalculate your
model for each scenario. It defaults to 1000, but you can enter any
positive whole number.
Optionally, you may indicate a fixed random number seed to use, and whether the seed should be reset for each scenario (resetting is good practice, and is the default). Press "Simulate" to start the
simulation, or "Cancel" to return to Excel.
The simulation involves only the current sheet of the current workbook. If the
number of scenarios" is N, and the "Sample Size" is S, then YASAI will recalculate the current sheet
NS times. These recalculations are divided into N blocks of S recalculations, each block
constituting a scenario. Output data are collected separately for each scenario, and the values returned by any PARAMETER functions in the sheet will vary from scenario to scenario, as described above.
A "progress" display indicates how quickly the simulation is progressing. When the simulation is over, there will be a short delay while the outputs are processed. The output report is automatically placed in a new sheet named "Simulation Output
n", which YASAI inserts into the current workbook. YASAI makes this report the current sheet and then returns control to Excel. For each output-scenario combination, the report contains the mean, standard deviation, minimum, maximum, and percentiles in 5% intervals. Currently there are no graphics or other output
data, although improvements are planned for later versions.
Aborting a Simulation
Testing a Model Interactively
To specify different trial values for decision variables, YASAI provides the function
PARAMETER(L, k, name). The first argument, L, is a block of cells or a list specifying the possible return values. The
name argument is a character string describing the parameter, and is used only in the output reports. The
k argument specifies the number of scenarios between changes in the parameter. For example, a cell containing =PARAMETER({1,2,3},1, "woof") specifies a parameter called "woof" that will change every scenario, first taking the value 1, then 2, and then 3. A cell containing =PARAMETER({1,8,2.3,-2},2, "snort") defines a parameter called "snort" that takes the value 1 for the first two scenarios, then 8 for the next two,
2.3 for the next two, and -2 for the last two. The argument k makes it possible to try combinations of values of various parameters without having to write every combination out in a list.
To specify an output of the simulation, use the formula SIMOUTPUT(x, name): This function returns the value
x. During simulation runs, the values of x encountered are saved for later analysis, as described below. The argument name is a character string to describe the output in the simulation reports. For example a cell containing =SIMOUTPUT(A4+B7,"profit") defines an output called "profit" whose value is A4+B7.
Once you have built your model, specified scenarios (if any), and specified outputs, you can run your simulation. To do so, select "YASAI Simulation" from the Tools menu. This will cause a dialog box to appear.
You can abort a YASAI simulation while it is running by clicking on the "Abort" button, or simply by pressing the escape key on your keyboard. It may take up to 5 seconds for the simulation to abort.
To test a model interactively, simply press the F9 key. Excel will perform a single recalculation, drawing new values for all the random variable generation functions. New values will also be generated for each PARAMETER function call.
As of version 2.0, YASAI can produce charts of simulation outputs. You must run simulation before trying to produce charts. To make a chart, select "YASAI Charts..." from the "Tools..." menu, which produces a charting window:

You may chart up to five blocks of outputs, each corresponding to one row in the window. The first column selects which variables to chart. The second and third columns allow you to specify a range of scenarios for the selected variable, for example scenarios 1 through 5; a graph for each scenario in the range will appear in the output. The last column selects the kind of graph desired for the block of variables: "Histogram" is a standard bar chart, and "Cumulative plot" produces empirical cumulative distributions. You may mix the two kinds of graphs on a single chart. With the "automatic" button set under "Chart Range" YASAI chooses the horizontal axis range and subdivisions to attempt to produce an attractive chart. "Manual" lets you specify a range from "Min" to "Max", with "Buckets" subdivisions.
YASAI charts are regular Excel charts. Once they have been created, you modify them to suit your needs. The chart and its associate data each become a new worksheet ply. You may delete them if they are no longer needed. YASAI charts are also "static" -- they are based on the simulation immediately preceding their creation; if you run another simulation of the same model, they will not automatically update. You must run a simulation again and make new charts if you want your charts to reflect a change to your simulation model.
Due to internal limitations in Excel,
cumulative graphs are not possible for outputs with more than 32,760
observations. Histograms are possible for any sample size. Known Problems Updating Links
On some Excel installations, however, Excel does not seem to generate an
"open workbook" event, and link updating is skipped. If link updating fails, your spreadsheet formulas may contain weird strings
like "!'C:Documents and Settings\JoeUser\...\YASAI.xla':". If
you delete these strings manually or with Excel's "Replace" function,
things shoudl start working normally again.
"YASAI Simulation..." appears on the Tools menu, but the all YASAI spreadsheet functions evaluate to "#NAME!"
Macintosh Excel Excel 2007
When you open a workbook containing YASAI functions, Excel may display the message that it contains "automatic links to another workbook", and asks if you want to update the links.
As of version 1.15, it should not matter what you answer here -- YASAI should
automatically repair the links. Link updating generally occurs when you
move a YASAI-based spreadsheet between two computers where YASAI is installed
in different places in the file system.
Excel's security settings may be preventing YASAI from running. Select "YASAI Simulation..." from the Tools menu. You should immediately see a dialog box asking if you wish to enable macros. Click "Yes" or "Enable Macros". The YASAI dialog box should appear. Click "Cancel". For each cell containing a YASAI spreadsheet function, click the cell, place the cursor at the end of the formula in the formula bar, click, and then hit the enter key.
Although the random variable generation routines work, the rest of YASAI is
inoperable on older Macintosh systems. The 2008 version of Macintosh
Office lacks Visual Basic, so YASAI cannot work at all.
The charting button appears twice, but both buttons work. Simulations
run much slower than in Excel 2003 on some systems. An earlier problem
with charts appearing mangled appears to have fixed itself due to updates to
Excel. On the bright side, the link updating message issue finally
appears to have resolved itself in Excel 2007.