Tutorial: Analyzing a model
This Tutorial page shows you how to do various kinds of sensitivity analysis to see how changes to input assumptions affect the results, including:
- Importance analysis
- One way parametric analysis
- Two-way parametric analysis
- Three-way parametric analysis
- Pivoting a graph or table over multiple dimensions
Tutorial Video: Analyze a model (6 minutes)
The difference between renting and buying
Open the Rent vs. Buy Analysis model from More Example models -> Tutorial models, by double-clicking the file labeled Rent vs. Buy Analysis.ana. This model is the module called Model that you explored in Tutorial: Reviewing a model with some additional variables to perform uncertainty analysis.
First look at the objective node, Difference between buying and renting:
The difference between the two uncertain values is uncertain. It is positive if it costs less to buy, and negative if it costs less rent over the time period.
Several of the input variables in the Rent vs. Buy Analysis model are uncertain, defined as probability distributions. It's useful to see how much of the uncertainty is in the result, in this case the Difference between buying and renting is due to each of these uncertain inputs. Importance analysis is an easy way to do this. Typically, a few key uncertain inputs are responsible for the lion’s share of the uncertainty in the output, while the rest of the inputs have little impact. If so, you can then focus your efforts on getting more precise estimates or building a more detailed model for those few most “important” inputs.
Importance is defined on a relative scale from 0 to 1. An importance value of 0 indicates that the uncertain input variable has no effect on the uncertainty in the output. A importance of 1 implies that you can "blame" all of the uncertainty in the output on that single input. Technically, it computes importance as the Rank correlation (also known as Spearman's correlation) between the output value and each uncertain input, using the RankCorrel function.
We can see that the input Appreciation Rate contributes most of the uncertainty to the Difference between buying and renting.
Parametric analysis involves varying the value of an input variable to examine its effect on a selected output. It helps you see how an input affects the desired outcome. Since the importance analysis you just did found that Appreciation rate caused most of the uncertainty in Difference between buying and renting, let's start the parametric analysis with that input variable. You want to change the Definition of Appreciation rate’ from a probability distribution to a list of alternative values.
- Click the edit button in the toolbar to switch into edit mode. Then you can modify the model: adding and removing nodes, and modifying existing nodes.
- Click the key icon to open the Attribute panel
- Click the Appreciation rate node to select it
- Select Definition from the Attribute dropdown menu to view its definition.
When the Definition attribute is displayed, it shows the Expression popup menu , currently showing a probability distribution. You can press this to show a menu that lets you change the definition to any of these types of expression:
For now, you want to change the definition of Appreciation rate from a probability distribution to a list. Then you can enter a list of values from -10% to 10%.
Note that the icon on the Expression popup menu has changed to List .
After selecting a list, the definition shows a single cell — a box — containing the previous definition — in this case, a normal distribution
Now replace it with a number, say -10:
To add another cell to the list,
- Press the Enter key or down arrow key (not the numeric keypad Enter key). The next cell contains -9 (adding 1 to the previous value).
- Change its value to -5.
- Press Enter again, and it shows 0. The number in the new cell increments the previous cell by the difference between the last two cells, in this case by 5 — resulting in zero.
- Press Enter twice more, and it adds cells with 5 and 10. You can always override the automatic value by typing in something else.
Pivot the graph as follows:
The resulting graph shows the mid value of buying and renting as Appreciation rate varies from -10% to 10%, using the list of values you just entered. You can see that renting and buying costs about the same at an Appreciation rate of -5% per year — the switchover value. It would be cheaper to rent if the Appreciation rate is less than -5%. And it would be cheaper to buy if it is greater than -5%.
The table shows the values computed for each parameterized value of Appreciation rate. Appreciation rate acts as an index — that is, a dimension of the table (array) of values in the Costs of buying and renting. You'll learn a lot more about indexes and arrays, a key source of Analytica's flexibility and power, in Tutorial: Arrays.
Two-way parametric analysis
You can extend this parametric sensitivity analysis to two variables. In this cased, let's look at the effects of changing Buying price along with Appreciation rate.
The first cell in this list contains the expression for the previous definition, 140K. Now change this value, and add additional cells, as you did for Appreciation rate.
The Result window displays the variable’s mid value. The Difference between buying and renting variable now shows three curves over Appreciation rate, one for each Buying price. The key shows the value of Buying price for each curve by color.
The graph shows that a $160K home, coupled with an appreciation rate of -2%/year or less, or a $140K home, coupled with an appreciation rate of -6%/year or less, results in renting being cheaper than buying. What is the best buy, a $120K home or a $160K home? That depends on the appreciation rate. If you expect an appreciation rate less than 9% per year, the less expensive home is the better investment. The more expensive home gives a larger return only for an appreciation rate over 9%.
Three-way parametric analysis
So far the Cost of renting has been held constant. What happens if we change that too?
The result has now has three dimensions, Buying price, Buy or rent, and Appreciation rate. It shows two dimension in the graph, Appreciation rate along the X axis, and Buy or rent, in the Key. The third dimension Buying price is shown at the top of the graph as a slicer dimension, currently set to $120K.
- Click the diagonal arrows to change the Buying price in the slicer index.
The graph now show the mid value of Costs of buying and renting given that the Buying price equals $160K.
= Pivot a 3-dimensional graph or table
You can pivot the graph (or table) by selecting different variables to show in the X-axis, Key, or Slicer:
Buy or Rent becomes the third dimension with one value (buy) displayed.
This table shows the mid value cost of buying for the parameterized values of Buying Price and Appreciation Rate.
This table confirms that Cost to Rent does not vary with Buying Price or Appreciation rate — no surprise when you think about it!
You can quit Analytica at this point.
This page showed several approaches to sensitivity analysis to find out how changes in key variables affect the results. The next page shows you how to create a new Analytica model.
- Play the Rent vs. Buy model in Analytica Cloud Player
- Analyzing a model (en explanatory video on YouTube)
- Example Models
- Example Models and Libraries
- Comparing results
- Importance analysis
- Parametric analysis
- Statistics, Sensitivity, and Uncertainty Analysis
- Sensitivity analysis functions
- The Sensitivity Analysis Library
- Tornado Plots
- Tutorial videos