# Sobol Method

GlobalSensitivity.SobolType
Sobol(; order = [0, 1], nboot = 1, conf_level = 0.95)
• order: the order of the indices to calculate. Defaults to [0,1], which means the Total and First order indices. Passing 2 enables calculation of the Second order indices as well.
• nboot: for confidence interval calculation nboot should be specified for the number (>0) of bootstrap runs.
• conf_level: the confidence level, the default for which is 0.95.

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 standardised 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) + A*sin(X)^2+ B*X^4 *sin(X)
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