Elasticity
Elasticity(y, x)
Returns the percent change in the expression «y» caused by a 1% change in a dependent variable «x». Mathematically, writing y(x) to emphasize that «y» is a function of «x», elasticity is defined as:
- [math]\displaystyle{ Elasticity(y,x)=\lim_{u \to 0} \frac{1}{u}\Big(\frac{y(x(1+u))-y(x)}{y(x)}\Big) }[/math]
When «x» is a positive scalar, but not when «x» is array-valued (and hence, not an uncertain quantity, which would be indexed by Run), Elasticity() is related to Dydx() in the following manner:
Elasticity(y, x) = DyDx(y, x) * (x/y)
A result of 1.0 means that «y» changes by 1% when «x» changes by 1%. Elasticity(x, x) should be 1.0.
Elasticity(y,x,I)
(requires Analytica 5.0)
When one or more indexes are specified, it computes the elasticity relative to each slice of «x» along «I». In other words, if a single slice of «x» along «I» were to change by 1%, by what percent would the result «y» change? You may list multiple indexes, e.g., Elasticity(y, x, I, J, K)
, in which case it computes the elasticity for each slice at all combinations of the indexes. This option requires «y» to be evaluated, and then re-evaluated once for every combination of indexes. The result will include all of the specified indexes.
When all the indexes of «x» are listed (but only if they are all listed), then Elasticity is related to DyDx in the following manner.
Elasticity(y, x, I, J, K) = DyDx(y, x, I, J, K) * (x/y)
where I, J, K
includes all indexes of x
.
Library
Special Functions
Evaluation Modes
When you evaluate Elasticity(y, x) in mid-mode, the mid-value of «x» is varied and the mid-value of «y» is evaluated.
In a model with uncertainty (probability distributions), a number of problems may result. It is important to be aware of these, because in many cases the result from Elasticity may be nonsense and random. The nonsense is the result of random numbers being utilized during the evaluation of Elasticity.
The main thing you need to watch out for is the presence of probability distributions in variables between «x» and «y». For example, consider this case:
Variable x := 30
Variable v := Normal(x, 10)
Variable y := v^2 - 3*v + 2
Variable elas := Elasticity(Mean(y), x)
The problem in this example is that v
contains a distribution and is a function of x
, and Mean(y) is a function of v
. The computation of Elasticity requires two evaluations, one with x
at its nominal value, and one with x
at x*(1+δ). Each of these evaluations will require a new random sampling from the Normal distribution, and even though x
only changes by delta, the randomness in v
means the difference between the samples will be very large. The elasticity, therefore, will appear to be extremely big. In cases such as these, you are likely to see Elasticity results in the millions, with large random swings every time you re-evaluate.
In cases like these, it is often possible to restructure your model so that the uncertainties do not live on the dependency path from «x» to «y». In the example, the following change will fix the problem:
Variable v0 := Normal(0, 10)
Variable v := x + v0
If the only uncertain variable involved is «x» itself, then in Analytica 4.2 and later, Elasticity provided that «x»'s caching method is configured as the default cache-always (which it will be as long as you haven't explicitly gone out of your way to configure it differently). In Analytica 4.1 and earlier, «x» cannot be an uncertain variable when the model applies a statistical function to a result downstream of «x».
Numeric Delta
To compute the elasticity, Elasticity() varies «x» by a small amount, by default the multiple (1 + 1.0e-8). In the rare event of unusual numeric complications, this multiple can be controlled using the optional parameter «delta», e.g.:
Dydx(y, x, delta: 1.0e-2)
In the equation above that defines Elasticity(y, x), «delta» is essentially the value for u that is used in the numeric evaluation.
Preservation of computed values
By default, Elasticity(y,x)
preserves previously computed values throughout the model. In rare situations, if your model consumes nearly all available memory and you'd rather allow previously computed values to be dropped while computing Elasticity, you can specify the optional parameter «preserve» to be false, e.g.:
Elasticity(Y, X, preserve: false)
Of course, when you need to view other results that had been previously cached, they will need to be recomputed again, and probability distributions will need to be re-sampled.
History
- Analytica 4.1 and earlier did not preserve previously computed values (equivalent to specifying
preserve:false
). The «preserve» parameter was introduced in Analytica 4.2. - The optional index parameters were introduced in Analytica 5.0.
See Also
- DyDx
- WhatIf
- Tornado Charts webinar, recorded at: Tornado-Charts.wmv
Enable comment auto-refresher