Sobol Method
GlobalSensitivity.Sobol — Type
Sobol(; order = [0, 1], nboot = 1, conf_level = 0.95, nonfinite = :propagate)Keywords
order::Vector{Int} = [0, 1]: requested sensitivity-index orders.0and1compute total and first-order indices; include2for second-order indices.nboot::Int = 1: positive number of bootstrap replicates for confidence intervals.conf_level::Real = 0.95: confidence level for bootstrap intervals.nonfinite::Symbol = :propagate: handling of non-finite (NaN/Inf) model evaluations. Option:propagateleaves non-finite values untouched, so they propagate into the indices. Option:dropremoves, independently in each bootstrap replicate, every design row whose evaluation is non-finite in any of itsd + 2blocks (2d + 2with second order) and, for multioutput models, in any output component; a warning reports the number of dropped rows. Each replicate must keep at least two rows. The indices are then computed from the kept rows only. They are exact for the input distribution restricted to the finite region only when that region is a Cartesian product of input ranges (e.g. failure depends on a single input). Otherwise the keptA/Bpairs are no longer independent and the indices should be treated as approximate, especially when many rows are dropped.
Method Details
Sobol is a variance-based method, and it decomposes the variance of the output of the model or system into fractions which can be attributed to inputs or sets of inputs. This helps to get not just the individual parameter's sensitivities, but also gives a way to quantify the affect and sensitivity from the interaction between the parameters.
\[ Y = f_0+ \sum_{i=1}^d f_i(X_i)+ \sum_{i < j}^d f_{ij}(X_i,X_j) ... + f_{1,2...d}(X_1,X_2,..X_d)\]
\[ Var(Y) = \sum_{i=1}^d V_i + \sum_{i < j}^d V_{ij} + ... + V_{1,2...,d}\]
The Sobol Indices are "order"ed, the first order indices given by $S_i = \frac{V_i}{Var(Y)}$ the contribution to the output variance of the main effect of $X_i$. Therefore, it measures the effect of varying $X_i$ alone, but averaged over variations in other input parameters. It is standardized by the total variance to provide a fractional contribution. Higher-order interaction indices $S_{i,j}, S_{i,j,k}$ and so on can be formed by dividing other terms in the variance decomposition by $Var(Y)$.
API
gsa(f, method::Sobol, p_range::AbstractVector; samples, kwargs...)
gsa(f, method::Sobol, A::AbstractMatrix{TA}, B::AbstractMatrix;
batch = false, Ei_estimator = :Jansen1999,
distributed::Val{SHARED_ARRAY} = Val(false),
kwargs...) where {TA, SHARED_ARRAY}Ei_estimator can take :Homma1996, :Sobol2007 and :Jansen1999 for which Monte Carlo estimator is used for the Ei term. Defaults to :Jansen1999. Details for these can be found in the corresponding papers:
:Homma1996- Homma, T. and Saltelli, A., 1996. Importance measures in global sensitivity analysis of nonlinear models. Reliability Engineering & System Safety, 52(1), pp.1-17.:Sobol2007- I.M. Sobol, S. Tarantola, D. Gatelli, S.S. Kucherenko and W. Mauntz, 2007, Estimating the approx- imation errors when fixing unessential factors in global sensitivity analysis, Reliability Engineering and System Safety, 92, 957–960. and A. Saltelli, P. Annoni, I. Azzini, F. Campolongo, M. Ratto and S. Tarantola, 2010, Variance based sensitivity analysis of model output. Design and estimator for the total sensitivity index, Computer Physics Communications 181, 259–270.:Jansen1999- M.J.W. Jansen, 1999, Analysis of variance designs for model output, Computer Physics Communi- cation, 117, 35–43.:Janon2014- Janon, A., Klein, T., Lagnoux, A., Nodet, M., & Prieur, C. (2014). Asymptotic normality and efficiency of two Sobol index estimators. ESAIM: Probability and Statistics, 18, 342-364.
Example
using GlobalSensitivity, QuasiMonteCarlo
function ishi(X)
A = 7
B = 0.1
sin(X[1]) + A * sin(X[2])^2 + B * X[3]^4 * sin(X[1])
end
samples = 600000
lb = -ones(4) * π
ub = ones(4) * π
sampler = SobolSample()
A, B = QuasiMonteCarlo.generate_design_matrices(samples, lb, ub, sampler)
res1 = gsa(ishi, Sobol(order = [0, 1, 2]), A, B)
function ishi_batch(X)
A = 7
B = 0.1
@. sin(X[1, :]) + A * sin(X[2, :])^2 + B * X[3, :]^4 * sin(X[1, :])
end
res2 = gsa(ishi_batch, Sobol(), A, B, batch = true)GlobalSensitivity.SobolResult — Type
SobolResult(S1, S1_Conf_Int, S2, S2_Conf_Int, ST, ST_Conf_Int, VY, n)Structure holding the output of a Sobol sensitivity analysis.
Fields
S1: First-order sensitivity indicesS1_Conf_Int: Confidence intervals forS1(ornothingifnboot == 1)S2: Second-order interaction sensitivity indices (ornothing)S2_Conf_Int: Confidence intervals forS2(ornothingifnboot == 1)ST: Total-order sensitivity indicesST_Conf_Int: Confidence intervals forST(ornothingifnboot == 1)VY: Output varianceVar(Y)(the Sobol denominator) estimated from theAandBevaluations; the mean of the per-replicate estimates ifnboot > 1, and a column matrix (one row per output) for multioutput modelsn: Number of design rows used per replicate (Int, orVector{Int}ifnboot > 1)
VY and n are nothing when constructed with the six-argument form.