Skip to content

sensitivity.estimators

The estimators of the global sensitivity analyses, over every element at once.

An analysis of sbmlsim.sensitivity.indices computes the indices of every element of its observables: every label of the other dimensions of the scan (doses, conditions) and every time point of a timecourse. The estimators of the three methods are means over the points of the design, so an element is one column of an array and every element is estimated in the same pass (y of the shape (points, elements)); the analyses called SALib once per element before, about 10 ms, which a timecourse of a thousand time points under a few conditions paid for every observable.

The estimators are the ones of SALib, which the tests of tests/sensitivity/test_global.py compare them with on the same values, from the papers they cite:

  • sobol_indices: S1 and ST of Saltelli et al. 2010 and S2 of Saltelli 2002 on the matrix of Saltelli, normalized by the variance of the sample;
  • fast_indices: S1 and ST of the extended FAST of Saltelli et al. 1999 from the spectrum of the output over the frequency of every parameter;
  • morris_effects: the elementary effects of Morris 1991 with the mu_star of Campolongo et al. 2007.

The intervals are the bootstrap of SALib with the resamples of its seed, which it draws once per analysis, so every element shared them before and shares them now. A mean over a resample is the mean of the values of the sample weighted by how often the resample draws each of them (_counts), so the intervals of Sobol and Morris are products with that matrix of counts rather than means over an array of points x resamples x elements values, which is the same mean and holds no array of that size. FAST resamples a window of the output and not its points, so its intervals are one transform per parameter and resample, which is the cost of a FAST analysis of many elements.

The guard of SALib against a sample without variance is kept (such an index is zero) and the one of its intervals against a resample without variance is not: an element whose values are constant within the error of the integrator is left out by the caller (sbmlsim.sensitivity.indices.constant_tolerance), far above the machine epsilon of these guards. Groups of parameters are no part of a design of sbmlsim, so the estimators have none.

References

Saltelli, A., Annoni, P., Azzini, I., Campolongo, F., Ratto, M., Tarantola, S. (2010). Variance based sensitivity analysis of model output. Design and estimator for the total sensitivity index. Computer Physics Communications 181(2):259-270.

Saltelli, A. (2002). Making best use of model evaluations to compute sensitivity indices. Computer Physics Communications 145(2):280-297.

Saltelli, A., Tarantola, S., Chan, K. P.-S. (1999). A quantitative model-independent method for global sensitivity analysis of model output. Technometrics 41(1):39-56.

Morris, M. D. (1991). Factorial sampling plans for preliminary computational experiments. Technometrics 33(2):161-174.

Campolongo, F., Cariboni, J., Saltelli, A. (2007). An effective screening design for sensitivity analysis of large models. Environmental Modelling and Software 22(10):1509-1518.

sobol_indices

sobol_indices(
    y, *, d, second_order, conf_level, num_resamples, seed
)

Get the Sobol indices of the points of a design of Saltelli.

The values are centred and scaled by their standard deviation per element, as SALib does, since the estimators are biased for an output which is not centred; an element of no standard deviation keeps its zeros and gets zero indices. S1 is mean(B (AB - A)) / var and ST is 0.5 mean((A - AB)^2) / var of Saltelli et al. 2010, S2 is mean(BA_j AB_k - A B) / var - S1_j - S1_k of Saltelli 2002, each over the variance of the pooled sample of A and B. An interval is z(conf_level) times the standard deviation of the estimator over the resamples, each with the variance of its own resample.

Parameters:

Name Type Description Default
y ndarray

the values, a row per point in the order of the design and a column per element.

required
d int

the number of parameters.

required
second_order bool

whether the design carries the second order.

required
conf_level float

the level of the confidence intervals, in (0, 1).

required
num_resamples int

the number of bootstrap resamples.

required
seed int

the seed of the resamples.

required

Returns:

Type Description
dict[str, ndarray]

S1, S1_conf, ST and ST_conf of the shape (d, elements), and

dict[str, ndarray]

with the second order S2 and S2_conf of the shape

dict[str, ndarray]

(d, d, elements), the upper triangle and NaN elsewhere.

Raises:

Type Description
ValueError

if the number of rows is no multiple of the points of a sample of the design of d parameters.

fast_indices

fast_indices(y, *, d, m, conf_level, num_resamples, seed)

Get the indices of the extended FAST of the points of a FAST design.

The points of a parameter are the block of the design which walks the search curve at its frequency omega = floor((n - 1) / (2 m)), see _orders. An interval is the standard deviation of the orders over num_resamples windows of half of the points of the block, drawn from the legacy random state of SALib: a window wraps around the end of the block and its frequency is the one of its own length. SALib documents these intervals as unreliable, so they are indicative only.

Parameters:

Name Type Description Default
y ndarray

the values, a row per point in the order of the design and a column per element.

required
d int

the number of parameters.

required
m int

the interference factor of the design.

required
conf_level float

the level of the confidence intervals, in (0, 1).

required
num_resamples int

the number of bootstrap resamples.

required
seed int

the seed of the windows.

required

Returns:

Type Description
dict[str, ndarray]

S1, S1_conf, ST and ST_conf of the shape (d, elements).

Raises:

Type Description
ValueError

if the number of rows is no multiple of d.

morris_effects

morris_effects(
    cube, y, *, levels, conf_level, num_resamples, seed
)

Get the elementary effects of the trajectories of a Morris design.

One step of a trajectory moves one parameter, so the effect of that parameter is the change of the output over the step divided by delta = levels / (2 (levels - 1)), the step of the grid of SALib on [0, 1]. Which parameter a step moves and in which direction follows from the points alone and is the same for every element, so the rows of the output are gathered once and the effects of every element are the differences of those rows. mu and mu_star are the mean of the effects and of their magnitudes over the trajectories (Campolongo et al. 2007), sigma is their standard deviation and mu_star_conf the interval of mu_star over resamples of the trajectories.

Parameters:

Name Type Description Default
cube ndarray

the points of the design on the unit cube, a row per point; a centred grid gives the same effects as the grid of SALib, since only the sign of a step is read from it.

required
y ndarray

the values, a row per point in the order of the design and a column per element.

required
levels int

the levels of the grid of the design.

required
conf_level float

the level of the confidence interval, in (0, 1).

required
num_resamples int

the number of bootstrap resamples.

required
seed int

the seed of the resamples.

required

Returns:

Type Description
dict[str, ndarray]

mu, mu_star, sigma and mu_star_conf of the shape

dict[str, ndarray]

(d, elements).

Raises:

Type Description
ValueError

if the points are no trajectories of d + 1 points of the d parameters of the cube.