Accelerating the pace of engineering and science

# Documentation

## Sensitivity Calculation

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

$\frac{\partial x}{\partial y},\frac{\partial x}{\partial z}$

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

### 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 uses "complex-step approximation" to calculate derivatives of reaction rates. This technique yields accurate results for the vast majority of typical reaction kinetics, which involve only simple mathematical operations and functions. When a reaction rate involves a nonanalytic function, this technique can lead to inaccurate results. In this case, either sensitivity analysis is disabled, or sensitivity analysis warns you that the computed sensitivities may be inaccurate. An example of such a nonanalytic function is the MATLAB® function abs. If sensitivity analysis gives questionable results on a model whose reaction rates contain unusual functions, you may be running into limitations of the complex-step method. Contact MathWorks Technical Support for additional information.

 Note:   Models containing the following active components do not support sensitivity analysis:Nonconstant compartmentsAlgebraic rulesEvents
 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.

### Setting SolverOptions Properties for Calculating Sensitivities

Perform sensitivity analysis at the command line by setting the following properties of the SolverOptions property of your configset object, before using 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

### Calculating Sensitivities of Model and Viewing Results

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.