Slides Sensitivity Analysis
Slides Sensitivity Analysis
Eric Marsden
<[email protected]>
X is a sensitive
parameter
X is not a sensitive
parameter
Sensitivity analysis: intuition
5
𝑓 (𝑥, 𝑦) is sensitive in 𝑥 and in
𝑦
0
2
−2 0
−1
0 𝑦
1
𝑥 2 −2
Sensitivity analysis: intuition
2
𝑓 (𝑥, 𝑦) is sensitive in 𝑥 but
not in 𝑦
2
0
−2 0
−1
0 𝑦
1
𝑥 2 −2
Sensitivity analysis: intuition
X
Sensitivity analysis: intuition
▷ No graphical interpretation
parameter 3
simulation
model outputs
parameter 2
parameter 3
simulation
model outputs
parameter 2 sensitivity analysis Sensitivity analysis: what is the
relative contribution of the variability
in each of the inputs to the total output
variability?
parameter 3
parameter 1
uncertainty analysis
simulation
model outputs
parameter 2 sensitivity analysis
feedback on model
inputs & model structure
▷ Model reduction
• identify ineffective parameters
• generate models with fewer parameters, but (almost) identical results
(metamodels or response surfaces)
Application areas
‘‘
When the assumptions underlying the baseline scenario
might vary as a result of external factors, you need to do
a sensitivity analysis to assess whether the impacts of the
policy options differ significantly for different values of
the key variables.
‘‘
Influential risk assessments should characterize uncertainty with a
sensitivity analysis and, where feasible, through use of a numeric
distribution.
[…] Sensitivity analysis is particularly useful in pinpointing which
assumptions are appropriate candidates for additional data
collection to narrow the degree of uncertainty in the results.
Sensitivity analysis is generally considered a minimum, necessary
component of a quality risk assessment report.
Figure from Clemen, R. T., Making Hard Decisions: An Introduction to Decision Analysis, 1996
Aside: extracting a model from a spreadsheet
2 Screening methods
increasing
3 oat “one at a time” methods sophistication
Market Size
Our Share
Selling Price
Our Share
Fixed Costs
Variable Cost
▷ Determine lower bound, upper bound and best estimate of each uncertain
input parameter
• = 10%, 90% and 50% quantiles of parameter’s probability distribution
▷ For each uncertain parameter, calculate model output for lower and upper
bounds, while taking best estimate for all other uncertain parameters
▷ Draw a horizontal bar for each uncertain parameter between value for
lower bound and value for upper bound
Our Share
Market size 8 12 20 Selling Price
Fixed Costs
Our share 0.18 0.25 0.35
Variable Cost
Variable cost 30 40 60 0 100 200 300 400 500 600
, If model fails, you know which factor is responsible for the failure
100
> rosenbrock(0, 1)
−1 101
> rosenbrock(1, 1)
0
> rosenbrock(-1, -1)
−2
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2 404
𝑥1
▷ The elementary effect for the 𝑖-th input variable at x ∈ [0, 1]𝑘 is the first
difference approximation to the derivative of 𝑓 (·) at x:
𝑓 (x + ∆e𝑖 ) − 𝑓 (x)
𝐸𝐸𝑖 (x) =
∆
where e𝑖 is the unit vector in the direction of the 𝑖-th axis
▷ Intuition: it’s the slope of the secant line parallel to the input axis
▷ Average 𝐸𝐸𝑖 (x) for various points x in the input domain to obtain a
measure of the relative influence of each factor
1 𝑟
𝜇𝑖 = ∑ ∣𝐸𝐸𝑖 (𝑥𝑗 )∣
𝑟 𝑗=1
Elementary effects method: example
▷ Consider 𝑦(x) = 1.0 + 1.5𝑥2 + 1.5𝑥3 + 0.6𝑥4 + 1.7𝑥42 + 0.7𝑥5 + 0.8𝑥6 + 0.5(𝑥5 𝑥6 )
where
• x = (𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 , 𝑥5 , 𝑥6 )
Elementary effects
• 0 ≤ 𝑥1 , 𝑥2 , 𝑥4 , 𝑥5 , 𝑥6 ≤ 1
μ_6
• 0 ≤ 𝑥3 ≤ 5
μ_5
μ_4
▷ Note:
μ_3
• 𝑦(·) is functionally independent of 𝑥1
μ_2
▷ Sensitivity results:
• 𝜇1 = 0 as expected tails as a
Download full de
teb oo k at
Python no
• influence of 𝑥4 is highest ring.org
risk-enginee
• influence of 𝑥2 and 𝑥3 is equal, as expected
Local sensitivity analysis methods
▷ Local sensitivity with respect to a factor is just the partial derivative wrt
that factor, evaluated at that location
𝜕𝑓
𝜕𝑥1 = -155
(-1.5,2)
𝜕𝑓
𝜕𝑥2 = -50
2,000 2
Local sensitivity is low
1
0
−2 0
−1 𝑥2
0 −1
1
𝑥1 2 −2
Rosenbrock example
𝜕𝑓
𝜕𝑥1 = -4806
(-2,-2) 𝜕𝑓
𝜕𝑥2 = -1200
2,000 2
Local sensitivity is high
1
0
−2 0
−1 𝑥2
0 −1
1
𝑥1 2 −2
Rosenbrock example
𝜕𝑓
𝜕𝑥1 =0
𝜕𝑓
𝜕𝑥2 =0
(1,1)
2,000 2
Local sensitivity is zero
1
0
−2 0
−1 𝑥2
0 −1
1
𝑥1 2 −2
Local sensitivity analysis methods
▷ This method does not allow you to detect interaction effects between
the input variables
▷ In general, this is the most relevant method for risk analysis purposes
• allows the analysis of interactions between input variables
Sensitivity indices
▷ Properties:
• 𝑆𝑖 ∈ [0,1]
• ∑ 𝑖 𝑆𝑖 = 1
Var(𝔼[𝑧|𝑥𝑗 ])
▷ First-order index: 𝑆𝑗 = Var(𝑧)
• measures “main effect”
𝔼[Var(𝑧|𝑥𝑗 )]
▷ Total effect index: 𝑇𝑗 = Var(𝑧)
• measures residual variability due to interactions between 𝑥𝑖 and other
parameters
Estimating sensitivity indices using SciPy and SALib
import numpy
from SALib.sample import saltelli
from SALib.analyze import sobol
problem = {
"num_vars": 2,
"names": ["x1", "x2"],
"bounds": [[-2, 2], [-2, 2]]
}
sample = saltelli.sample(problem, N, calc_second_order=True) Download full de
tails as a
Y = numpy.empty([sample.shape[0]]) Python noteb oo k at
for i in range(len(Y)): ring.org
risk-enginee
x = sample[i]
Y[i] = rosenbrock(x[0], x[1])
Si = sobol.analyze(problem, Y, calc_second_order=True)
@LearnRiskEng
fb.me/RiskEngineering
Was some of the content unclear? Which parts were most useful to
you? Your comments to [email protected]
(email) or @LearnRiskEng (Twitter) will help us to improve these
materials. Thanks!