Sensitivity Calculation

About Calculating Sensitivities

Calculating sensitivities lets you determine which species or parameter in a model is most sensitive to a specific condition (for example, a drug), defined by a species or parameter. Calculating sensitivities 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

xy,xz

where, the numerator is the sensitivity output and the denominators are the sensitivity inputs to sensitivity analysis.

For more information on the calculations performed, see References.

Model Requirements for Calculating Sensitivities

Sensitivity analysis is supported only by the ordinary differential equation (ODE) solvers. The software 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.

SimBiology® sensitivity analysis 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, this technique can produce inaccurate results when analyzing models that contain mathematical expressions that involve nonanalytic functions, such as abs. In this case, 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.

Note

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

  • Nonconstant compartments

  • Algebraic rules

  • Events

Note

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 task 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 task, 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 Sensitivities using sbiosimulate or SimFunctionSensitivity Object

You can calculate sensitivities using sbiosimulate or the SimFunctionSensitivity object.

Calculate using sbiosimulate

Set the following properties of the SolverOptions property of your configset object, before running the sbiosimulate function:

  • 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 About Calculating Sensitivities.

    • 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 About Calculating Sensitivities.

    • 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 by providing the model object as an input argument to the sbiosimulate function.

The sbiosimulate function returns a 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.

For illustrated examples, see:

Calculate 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 Sensitivities Using SimFunctionSensitivity Object.

References

Martins, J.R.R.A., Kroo, I.M., and Alanso, J.J. (Jan. 2000). An automated method for sensitivity analysis using complex variables. AIAA Paper 2000–0689.

Martins, J.R.R.A., Sturdza, P., and Alanso, J.J. (Jan. 2001). The connection between the complex-step derivative approximation and algorithmic differentiation. AIAA Paper 2001–0921.

Ingalls, B.P, and Sauro, H.M. (2003). Sensitivity analysis of stoichiometric networks: an extension of metabolic control analysis to non-steady state trajectories. J Theor Biol. 222(1), 23–36.