Skip to content

sensitivity.uncertainty

The uncertainty analysis: bands of timecourses and distributions of values.

The uncertainty of a prediction is a scan over draws of the uncertain parameters, see sbmlsim.simulation.sampling (random, lhs, fit_parameters, profile_parameters, fit_repeats, population), run by Simulator.run, and its summary over the dimension of the draws, ScanResult.summary(dim, quantiles=[0.05, 0.5, 0.95]). The functions here draw it: plot_bands a timecourse as a median and a band per label of the other dimensions, plot_distribution a value per simulation as a histogram or a box per label. They return the figure and never show it.

plot_bands

plot_bands(
    summary,
    key,
    *,
    lower="q0.05",
    center="q0.5",
    upper="q0.95",
    ax=None,
    alpha=0.3,
)

Draw a timecourse of a summary as a center line and a band per label.

Parameters:

Name Type Description Default
summary ScanResult

a summary of a scan, ScanResult.summary(..., quantiles=...).

required
key str

the timecourse.

required
lower str

the statistic of the lower bound of the band.

'q0.05'
center str

the statistic of the line.

'q0.5'
upper str

the statistic of the upper bound of the band.

'q0.95'
ax Axes | None

the axes to draw into, a new figure without.

None
alpha float

the opacity of the band.

0.3

Returns:

Type Description
Figure

The figure.

Raises:

Type Description
ValueError

if the variable is no timecourse of a summary or a statistic is missing.

plot_distribution

plot_distribution(
    result, key, *, dim, kind="hist", ax=None, bins=30
)

Draw a value per simulation over the draws as a histogram or a box per label.

Parameters:

Name Type Description Default
result ScanResult

the result of a scan over draws.

required
key str

a value per simulation, e.g. the parameter of a PK observable.

required
dim str

the dimension of the draws.

required
kind str

hist or box.

'hist'
ax Axes | None

the axes to draw into, a new figure without.

None
bins int

the number of bins of a histogram, shared by every label.

30

Returns:

Type Description
Figure

The figure.

Raises:

Type Description
ValueError

if the variable is a timecourse, the dimension is not one of it, or the kind is unknown.