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 as a sbmlsim.plot.Chart: 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, a box or a violin per label. Given a mapping of
scenarios to their results instead of one result, they draw the scenarios
into one plot with one legend, labelled by their keys.
The values are quantities, ScanResult.quantity: the axes have the units of
the first quantities drawn into them and convert every other one, and
time_unit and unit choose the units, e.g. time_unit="hr". The renderer
labels an axis with its name and the short form of its unit, e.g.
cp [ng/ml].
plot_bands
¶
plot_bands(
summary,
key,
*,
lower="q0.05",
center="q0.5",
upper="q0.95",
label=None,
time_unit=None,
unit=None,
name=None,
)
Draw a timecourse of a summary as a center line and a band per label.
Every band is labelled with the labels of the other dimensions, e.g.
dose=1, or with the key for a summary without other dimensions. A
label is the label of a summary without other dimensions and the
prefix of the labels otherwise, e.g. mid: dose=1; the summaries of a
mapping take their keys as their labels, so the scenarios are told apart
in the legend. A legend is drawn for more than one band or a label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
Results
|
a summary of a scan, |
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'
|
label
|
str | None
|
the label of the bands of one summary, see above. |
None
|
time_unit
|
str | None
|
the unit of the time, e.g. |
None
|
unit
|
str | None
|
the unit of the values, e.g. |
None
|
name
|
str | None
|
the name of the values on their axis, the key by default. |
None
|
Returns:
| Type | Description |
|---|---|
Chart
|
The chart. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the variable is no timecourse of a summary or a statistic is missing. |
plot_distribution
¶
Draw a value per simulation over the draws as a histogram, a box or a violin per label.
The distributions are labelled as the bands of plot_bands: with the
labels of the other dimensions, the key without them, and a label is
the label of a result without other dimensions and the prefix of the
labels otherwise; the results of a mapping take their keys as their
labels. The histograms share their bins and a legend; the boxes and
violins are side by side, labelled on the axis. A violin is the density
of sbmlsim.sensitivity.plots.density, a kernel density between the
smallest and the largest value; a sample of fewer than two distinct
values has no violin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
Results
|
the result of a scan over draws, or results by the labels of their scenarios. |
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'
|
bins
|
int
|
the number of bins of a histogram, shared by every label. |
30
|
label
|
str | None
|
the label of the distributions of one result, see above. |
None
|
unit
|
str | None
|
the unit of the values, e.g. |
None
|
name
|
str | None
|
the name of the values on their axis, the key by default. |
None
|
Returns:
| Type | Description |
|---|---|
Chart
|
The chart. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the variable is a timecourse, the dimension is not one of it, or the kind is unknown. |