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. 0 and 1 compute total and first-order indices; include 2 for 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 :propagate leaves non-finite values untouched, so they propagate into the indices. Option :drop removes, independently in each bootstrap replicate, every design row whose evaluation is non-finite in any of its d + 2 blocks (2d + 2 with 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 kept A/B pairs 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:

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)
source
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 indices
  • S1_Conf_Int: Confidence intervals for S1 (or nothing if nboot == 1)
  • S2: Second-order interaction sensitivity indices (or nothing)
  • S2_Conf_Int: Confidence intervals for S2 (or nothing if nboot == 1)
  • ST: Total-order sensitivity indices
  • ST_Conf_Int: Confidence intervals for ST (or nothing if nboot == 1)
  • VY: Output variance Var(Y) (the Sobol denominator) estimated from the A and B evaluations; the mean of the per-replicate estimates if nboot > 1, and a column matrix (one row per output) for multioutput models
  • n: Number of design rows used per replicate (Int, or Vector{Int} if nboot > 1)

VY and n are nothing when constructed with the six-argument form.

source