Skip to content

distrib

The formulas of the distributions of the fitted parameters, without a simulator.

A fitted parameter carries the distribution of its draws as a formula of the SBML package distrib: normal(mean, sd[, lower, upper]), lognormal(mu, sigma[, lower, upper]) (mu and sigma of the natural logarithm) and uniform(lower, upper), with numbers as arguments, truncated to the bounds of the fit when they are given. This module is the one grammar of these formulas: the draws of the fitted parameters parse them into the distributions of sbmlsim.simulation.sampling, and a library which must not import a simulator, e.g. the PBPK library of pkpdsim, reads their support to bound a fitted fraction. It imports only the standard library, so its import loads neither roadrunner nor the sampler.

ARGUMENTS module-attribute

ARGUMENTS = {
    "normal": (2, 4),
    "lognormal": (2, 4),
    "uniform": (2,),
}

The distributions and their numbers of arguments; the last two of four are the bounds of a truncation.

UNCERTAINTY_DIMENSION module-attribute

UNCERTAINTY_DIMENSION = 'uncertainty'

The id of the dimension of the draws of the fitted parameters of a model, see sbmlsim.simulation.sampling.uncertainty_dimension.

DistribFormula dataclass

DistribFormula(name, args)

A formula of a distribution of distrib.

Attributes:

Name Type Description
name str

the distribution, a key of ARGUMENTS.

args tuple[float, ...]

the arguments.

bounds property

bounds

The bounds of a truncated or uniform distribution, None without.

parse

parse(formula)

Parse a formula of a distribution.

Parameters:

Name Type Description Default
formula str

e.g. normal(0.3, 0.05, 0.01, 0.6).

required

Returns:

Type Description
DistribFormula

The distribution and its arguments.

Raises:

Type Description
ValueError

if the formula is no function of numbers, or no distribution of ARGUMENTS with a supported number of arguments.

support

support(formula)

Get the support of a distribution: the values its draws can take.

Parameters:

Name Type Description Default
formula str

the formula of the distribution.

required

Returns:

Type Description
float

The bounds of a truncated or uniform distribution; without bounds

float

normal is unbounded and lognormal positive; a formula which

tuple[float, float]

parse refuses is unbounded (its values cannot be bounded).

check_band

check_band(draws, quantiles)

Check the draws and the quantiles of the bands of a run over the draws.

The one check of sbmlsim.experiment.draws.UncertaintySettings and of the draws of the kind simulate (sbmlsim.run.scan_kinds.DrawsSpec), which checks a spec without importing the experiments.

Parameters:

Name Type Description Default
draws int

the number of draws.

required
quantiles tuple[float, ...]

the lower and the upper quantile of the bands.

required

Returns:

Type Description
tuple[float, float]

The quantiles as floats.

Raises:

Type Description
ValueError

for less than two draws or quantiles which are not an increasing pair within (0, 1).