Subglobal sensitivity analysis

SubglobalSensitivityAnalysis.estimate_subglobal_sobol_indicesFunction
estimate_subglobal_sobol_indices(f, paramsModeUpperRows, p0; 
    estim::SobolSensitivityEstimator=SobolTouati(),
    n_sample = 500, δ_cp = 0.1, names_opt, targets)

Estimate the Sobol sensitivity indices for a subspace of the global space around parameter vector p0.

The subspace to sample is determined by an area in the cumulative probability function, specifically for parameter ipar: cdf(p0) ± δcp. Samples are drawn from this cdf-scale and converted back to quantiles at the parameter scale.

Sobol indices are estimated using the method of Touati (2016), which has a total cost of $(p+2)×n$, where p is the number of parameters and n is the number of samples in each of the two random parameter samples.

Arguments

  • f: a function to compute a set of results, whose sensitivity is to be inspected, from parameters (p1, p2, ...) -> NamedTuple{NTuple{N,NT}} where NT <: Number, for example fsens = (a,b) -> (;target1 = a + b -1, target2 = a + b -0.5).
  • paramsModeUpperRows: a Vector of Tuples of the form (:par_name, Distribution, mode, 95%_quantile) where Distribution is a non-parameterized Object from Distributions.jl such as LogNormal. Alternatively, the argument can be the DataFrame with columns par and dist, such as the result of fit_distributions
  • p0: the parameter vector around which subspace is constructed.

Optional

  • estim: The SobolSensitivityEstimator, responsible for generating the design matrix and computing the indices for a given result
  • n_sample = 500: the number of parameter-vectors in each of the samples used by the sensitivity method.
  • δ_cp = 0.1: the range around cdf(p0_i) to sample.
  • min_quant=0.005 and max_quant=0.995: to constrain the range of cumulative probabilities when parameters are near the ends of the distribution.
  • targets: a NTuple{Symbol} of subset of the outputs of f, to constrain the computation to specific outputs.
  • names_opt: a NTuple{Symbol} of subset of the parameters given with paramsModeUpperRows

Return value

A DataFrame with columns

  • par: parameter name
  • index: which one of the SOBOL-indices, :first_order or :total
  • value: the estimate
  • cf_lower and cf_upper: estimates of the 95% confidence interval
  • target: the result, for which the sensitivity has been computed

Example

using Distributions
paramsModeUpperRows = [
    (:a, LogNormal, 0.2 , 0.5),
    (:b, LogitNormal, 0.7 , 0.9),
];
p0 = Dict(:a => 0.34, :b => 0.6)
fsens = (a,b) -> (;target1 = 10a + b -1, target2 = a + b -0.5)
# note, for real analysis use larger sample size
df_sobol = estimate_subglobal_sobol_indices(fsens, paramsModeUpperRows, p0; n_sample = 50)
source
SubglobalSensitivityAnalysis.fit_distributionsFunction
fit_distributions(tups)
fit_distributions!(df)

For each row, fit a distribution of type dType to mode and upper quantile.

In the first variant, parameters are specified as a vector of tuples, which are converted to a DataFrame. A new column :dist with a concrete Distribution is added. The second variant modifies a DataFrame with corresponding input columns.

source