Subglobal sensitivity analysis
SubglobalSensitivityAnalysis.estimate_subglobal_sobol_indicesSubglobalSensitivityAnalysis.fit_distributions
SubglobalSensitivityAnalysis.estimate_subglobal_sobol_indices — Functionestimate_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 examplefsens = (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 asLogNormal. Alternatively, the argument can be the DataFrame with columnsparanddist, such as the result offit_distributionsp0: the parameter vector around which subspace is constructed.
Optional
estim: TheSobolSensitivityEstimator, responsible for generating the design matrix and computing the indices for a given resultn_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.005andmax_quant=0.995: to constrain the range of cumulative probabilities when parameters are near the ends of the distribution.targets: aNTuple{Symbol}of subset of the outputs of f, to constrain the computation to specific outputs.names_opt: aNTuple{Symbol}of subset of the parameters given with paramsModeUpperRows
Return value
A DataFrame with columns
par: parameter nameindex: which one of the SOBOL-indices,:first_orderor:totalvalue: the estimatecf_lowerandcf_upper: estimates of the 95% confidence intervaltarget: 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)SubglobalSensitivityAnalysis.fit_distributions — Functionfit_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.