Main Content

Sensitivity Analysis in SimBiology

Sensitivity Analysis

Sensitivity analysis lets you explore the effects of variations in model quantities (species, compartments, and parameters) on a model response. You can use the analysis to validate preexisting knowledge or assumption about influential model quantities on a model response or to find such quantities. You can use the information from sensitivity analysis for decision making, designing experiments, and parameter estimation. SimBiology® supports two types of sensitivity analyses: local sensitivity analysis and global sensitivity analysis.

Global sensitivity analysis uses Monte Carlo simulations, where a representative (global) set of parameter sample values are used to explore the effects of variations in model parameters of interest on the model response. GSA provides insights into relative contributions of individual parameters that contribute most to the overall model behavior.

On the other hand, local sensitivity analysis is derivative based. This technique analyzes the effect of one model parameter at a time, keeping the other parameters fixed. Local sensitivities are dependent on a specific choice of parameter values at a time point where the analysis is performed and do not capture how parameters interact with each other during simulation when they are varied jointly.

Global Sensitivity Analysis (GSA)

In GSA, model quantities are varied together to simultaneously evaluate the relative contributions of each quantity with respect to a model response. SimBiology provides the following features to perform GSA.

Sobol Indices

In this approach, SimBiology performs a decomposition of the model output (response) variance by calculating the first- and total-order Sobol indices [1]. The first-order Sobol indices give the fractions of the overall response variance that can be attributed to variations in an input parameter alone. The total-order Sobol index gives the fraction of the overall response variance that can be attributed to joint parameter variations. For details, see Saltelli Method to Compute Sobol Indices.

Use sbiosobol to compute the Sobol indices. The function requires Statistics and Machine Learning Toolbox™.

Multiparametric GSA (MPGSA)

MPGSA lets you study the relative importance of parameters with respect to a classifier defined by model responses. SimBiology implements the MPSA method proposed by Tiemann et al. [2]. For details, see Multiparametric Global Sensitivity Analysis (MPGSA).

Use sbiompgsa to perform MPGSA. The function requires Statistics and Machine Learning Toolbox.

Elementary Effects

sbioelementaryeffects lets you assess the global sensitivity of a model response with respect to variations in model parameters by computing the means and standard deviations of the elementary effects of input parameters. An elementary effect (EE) of an input parameter P with respect to a model response R is defined as: EEP(x)=R(x)R(x+delta)delta.

Here, EEP(x) is the elementary effect of P. R(x) and R(x+delta) are model responses at specific time or the value of an observable, evaluated for parameter values x and x+delta. For details, see Elementary Effects for Global Sensitivity Analysis.

Comparison of GSA Functions

GSA FunctionSensitivity MeasureConsiderations
sbiosobolIt computes the fractions of total variance of a model response (sensitivity output) that can be attributed to individual model parameters (sensitivity inputs).
  • Variance-based method

  • Supports different distributions for sensitivity inputs

  • Computationally expensive because a large number of samples may be required to achieve convergence


It answers the question of whether variations in a model parameter (sensitivity input) have an influence on answering a modeling question. For example, the question might be: does a model parameter have an effect on the model response exceeding or falling below a target threshold?

You can define such a question using a mathematical expression (classifier). For example, the following classifier defines an exposure (area under the curve) threshold for the target occupancy TO: trapz(time,TO) <= 0.1. sbiompgsa reports the difference between the distributions of samples that are accepted or rejected by the classifier.

  • Distribution-based method

  • Requires a classifier that collapses time courses into a scalar value, such as max, min, mean, or AUC

  • Less computationally expensive than sbiosobol


It computes the means and standard deviations of elementary effects of sensitivity inputs with respect to a model response.

It assesses the average sensitivity by linear approximations of model responses, similar to averaged local sensitivities. It also assesses if the sensitivity of a model response is the same across the input parameter domain or if there is a spread of sensitivity values across the parameter domain.

  • Screens sensitivities based on linear approximations

  • Computes the sensitivity measures over a specified parameter domain

  • More computationally expensive than sbiompgsa and slightly less expensive than sbiosobol, assuming the same number of samples is used

Local Sensitivity Analysis (LSA)

In this analysis, SimBiology calculates the time-dependent sensitivities of all the species states with respect to species initial conditions and parameter values in the model.

Thus, if a model has a species x, and two parameters y and z, the time-dependent sensitivities of x with respect to each parameter value are the time-dependent derivatives


where, the numerator is the sensitivity output and the denominators are the sensitivity inputs to sensitivity analysis. y0 and z0 represent the initial conditions of y and z, respectively. For more information on the calculations performed, see [3][4][5].

Model Requirements for LSA

LSA is supported only by the ordinary differential equation (ODE) solvers. SimBiology calculates local sensitivities by combining the original ODE system for a model with the auxiliary differential equations for the sensitivities. The additional equations are derivatives of the original equations with respect to parameters. This method is sometimes called forward sensitivity analysis or direct sensitivity analysis. This larger system of ODEs is solved simultaneously by the solver.

LSA calculates derivatives by using a technique called complex-step approximation. This technique yields accurate results for the vast majority of typical reaction kinetics, which involve only simple mathematical operations and functions. However, the complex-step approximation requires the functions to be complex analytic, that is, to be infinitely differentiable in the complex plane. This technique can produce inaccurate results when analyzing models that contain mathematical expressions that involve nonanalytic functions, except min, max, and abs. If the model contains nonanalytic functions, SimBiology either disables the sensitivity analysis or warns you that the computed sensitivities may be inaccurate. If sensitivity analysis gives questionable results for a model with reaction rates that contain unusual functions, you may be running into limitations of the complex-step technique. Contact MathWorks Technical Support for additional information.

Although the min, max, and abs are nonanalytic functions and are not compatible with the complex-step approximation, SimBiology provides replacements of these functions so that they become compatible and can be used for LSA. Note that:

For details, see [3].

If your model uses the abs, min, and max functions, SimBiology automatically replaces them when:


Models containing the following active components do not support local sensitivity analysis:

  • Nonconstant compartments

  • Algebraic rules

  • Events


You can perform sensitivity analysis on a model containing repeated assignment rules, but only if the repeated assignment rules do not determine species or parameters used as inputs or outputs in sensitivity analysis.

SUNDIALS as Default Solver

SimBiology always uses the SUNDIALS solver to perform sensitivity analysis on a model, regardless of what you have selected as the SolverType in the configuration set.

In addition, if you are estimating model parameters using sbiofit or the Fit Data program with one of these gradient-based estimation functions: fmincon, fminunc, lsqnonlin, or lsqcurvefit, SimBiology uses the SUNDIALS solver by default to calculate sensitivities and use them to improve fitting. If you are using sbiofit, you can turn off this sensitivity calculation feature by setting the SensitivityAnalysis name-value pair argument to false. However, if you are using the Fit Data program, you cannot turn off this feature. It is recommended that you keep the sensitivity analysis feature on whenever possible for more accurate gradient approximations and better parameter fits.

Calculate Local Sensitivities with sbiosimulate

For illustrated examples, see:

More information on sensitivity analysis options and sensitivity outputs are described next.

The following properties of the SimBiology.SolverOptions property of your configset object define the sensitivity analysis options. You need to set these options before you run sbiosimulate.

  • SensitivityAnalysis — Set to true to calculate the time-dependent sensitivities of all the species states defined by the Outputs property with respect to the initial conditions of the species and the values of the parameters specified in Inputs.

  • SensitivityAnalysisOptions — An object that holds the sensitivity analysis options in the configuration set object. Properties of SensitivityAnalysisOptions are:

    • Outputs — Specify the species and parameters for which you want to compute the sensitivities. This is the numerator as described in Local Sensitivity Analysis (LSA).

    • Inputs — Specify the species and parameters with respect to which you want to compute the sensitivities. Sensitivities are calculated with respect to the InitialAmount property of the specified species. This is the denominator, described in Local Sensitivity Analysis (LSA).

    • Normalization — Specify the normalization for the calculated sensitivities:

      • 'None' — No normalization

      • 'Half' — Normalization relative to the numerator (species output) only

      • 'Full' — Full dedimensionalization

      For more information about normalization, see Normalization.

After setting SolverOptions properties, calculate the sensitivities of a model using sbiosimulate.

You can use one of the following syntaxes to get the sensitivity results. Refer to sbiosimulate for a complete input argument list.

  • simData = sbiosimulate(_)

  • [time,x,names] = sbiosimulate(_)

The first syntax returns a scalar SimData object containing the following simulation data:

  • Time points, state data, state names, and sensitivity data

  • Metadata such as the types and names for the logged states, the configuration set used during simulation, and the date of the simulation

A SimData object is a convenient way of keeping time data, state data, sensitivity data, and associated metadata together. A SimData object has properties and methods associated with it, which you can use to access and manipulate the data.

The second syntax returns three output arguments as follows:

  • time is an n-by-1 vector, where n is the number of steps taken by the ode solver and t defines the time steps of the solver.

  • x is an n-by-m matrix, where n is the number of steps taken by the ode solver and m is computed as: number of species and parameters specified in StatesToLog + number of sensitivity outputs * number of sensitivity inputs. A SimBiology state includes species and nonconstant parameters.

  • names is the list of states logged and the list of sensitivities of the species specified in StatesToLog with respect to the input factors.

Calculate Local Sensitivities Using SimFunctionSensitivity object

Create a SimFunctionSensitivity object using the createSimFunction specifying the 'SensitivityOutputs' and 'SensitivityInputs' name-value pair arguments. Then execute the object. For an illustrated example, see Calculate Local Sensitivities Using SimFunctionSensitivity Object.

Calculate Local Sensitivities Using SimBiology Model Analyzer App

For a workflow example using the app, see Find Important Tumor Growth Parameters with Local Sensitivity Analysis Using SimBiology Model Analyzer.


[1] Saltelli, Andrea, Paola Annoni, Ivano Azzini, Francesca Campolongo, Marco Ratto, and Stefano Tarantola. “Variance Based Sensitivity Analysis of Model Output. Design and Estimator for the Total Sensitivity Index.” Computer Physics Communications 181, no. 2 (February 2010): 259–70.

[2] Tiemann, Christian A., Joep Vanlier, Maaike H. Oosterveer, Albert K. Groen, Peter A. J. Hilbers, and Natal A. W. van Riel. “Parameter Trajectory Analysis to Identify Treatment Effects of Pharmacological Interventions.” Edited by Scott Markel. PLoS Computational Biology 9, no. 8 (August 1, 2013): e1003166.

[3] Martins, Joaquim, Ilan Kroo, and Juan Alonso. “An Automated Method for Sensitivity Analysis Using Complex Variables.” In 38th Aerospace Sciences Meeting and Exhibit. Reno,NV,U.S.A.: American Institute of Aeronautics and Astronautics, 2000.

[4] Martins, J., Peter Sturdza, and Juan Alonso. “The Connection between the Complex-Step Derivative Approximation and Algorithmic Differentiation.” In 39th Aerospace Sciences Meeting and Exhibit. Reno,NV,U.S.A.: American Institute of Aeronautics and Astronautics, 2001.

[5] Ingalls, Brian P., and Herbert M. Sauro. “Sensitivity Analysis of Stoichiometric Networks: An Extension of Metabolic Control Analysis to Non-Steady State Trajectories.” Journal of Theoretical Biology 222, no. 1 (May 2003): 23–36.