Skip to content

fit.identifiability

Parameter identifiability by profile likelihood.

A fit gives the parameters which describe the data best. Identifiability asks how well the data determines every one of them: a parameter is identifiable if the data constrains it to a finite interval, and non-identifiable if it can be changed without the model describing the data worse.

The profile likelihood answers this by scanning every parameter around the optimum. The scanned parameter is fixed at a value and all other parameters are optimized again, so the profile is the best cost the model reaches with the parameter at that value (Raue et al. 2009):

PL(θi) = min over θj≠i of cost(θ)

The cost of sbmlsim is the cost of scipy.optimize.least_squares, i.e., half the sum of the squared weighted residuals, cost = 0.5 * Σ r². With residuals which are standardized by the errors of the data, 2 * cost is the negative log-likelihood up to a constant, and the profile is compared with the threshold of the likelihood ratio test (Raue et al. 2009, Kreutz et al. 2013):

cost_threshold = cost_min + chi2.ppf(alpha, df) / 2

with df = 1 for the pointwise confidence intervals of single parameters, i.e., a threshold of 1.92 above the minimal cost at 95% confidence, and df = #parameters for simultaneous intervals. The values of a parameter at which the profile crosses the threshold are the bounds of its confidence interval. The intervals are invariant under a transformation of the parameters and may be asymmetric, which is where the intervals of the Fisher information matrix fail for the non-linear models of systems biology (Wieland et al. 2021).

The shape of the profile classifies the parameter (Raue et al. 2009):

  • identifiable: the profile crosses the threshold on both sides of the optimum, the confidence interval is finite,
  • practically non-identifiable: the profile has a minimum but stays below the threshold on one or both sides, i.e., up to the bound of the parameter. The data does not determine the parameter towards small and/or large values,
  • structurally non-identifiable: the profile is flat over the whole scanned range, the parameter is compensated by the other parameters and the data carries no information about it.

The scans run in logarithmic parameter space, as the optimization does. Every scan starts at the scale of its parameter, sqrt(2 max_rise) times the standard error of the Fisher information of the optimum (first_steps), so the first step is the one the profile allows and not one step for every parameter. The step along a profile is adaptive (Schälte et al. 2023): a step which raises the cost by more than a fraction of the threshold is reduced and repeated, a step which raises it by little is enlarged by step_factor, so the profile is resolved where it changes. A step is reduced by the curvature its own rise gives, step * sqrt(max_rise / (2 rise)), which is the step of half the allowed rise where the profile is quadratic: the correction reaches the scale of the profile at once, where a fixed factor needs several corrections and discards the re-optimization which measured each of them (#647). The other parameters start from the previous point of the profile (Simpson & Maclaren 2023) and their paths are stored, so a parameter which is coupled to the scanned one is seen in its path (Maiwald et al. 2016). A scan stops when the profile crosses the threshold, at the bound of the parameter or after max_points; a bound which is reached below the threshold is an open interval (Borisov & Metelkin 2020). A scan which finds a lower cost than the optimum reports it: the fit did not converge, and the threshold is taken relative to the lowest cost of all profiles.

The scans are independent, so they run in the worker pool of the fit runner, two scans per parameter. An analysis of fewer scans than one re-optimization spreads over, e.g. a profile of a single parameter, runs its scans one after another instead and evaluates the points of the jacobian of every re-optimization on all workers, see sbmlsim.fit.runner.split_cores. A parallel analysis needs the same if __name__ == "__main__": guard as a parallel fit.

References

Raue A, Kreutz C, Maiwald T, Bachmann J, Schilling M, Klingmüller U, Timmer J. Structural and practical identifiability analysis of partially observed dynamical models by exploiting the profile likelihood. Bioinformatics. 2009;25(15):1923-1929. doi:10.1093/bioinformatics/btp358

Kreutz C, Raue A, Kaschek D, Timmer J. Profile likelihood in systems biology. FEBS J. 2013;280(11):2564-2571. doi:10.1111/febs.12276

Maiwald T, Hass H, Steiert B, Vanlier J, Engesser R, Raue A, Kipkeew F, Bock HH, Kaschek D, Kreutz C, Timmer J. Driving the model to its limit: profile likelihood based model reduction. PLoS ONE. 2016;11(9):e0162366. doi:10.1371/journal.pone.0162366

Wieland FG, Hauber AL, Rosenblatt M, Tönsing C, Timmer J. On structural and practical identifiability. Curr Opin Syst Biol. 2021;25:60-69. doi:10.1016/j.coisb.2021.03.005

Borisov I, Metelkin E. Confidence intervals by constrained optimization, an algorithm and software package for practical identifiability analysis in systems biology. PLoS Comput Biol. 2020;16(12):e1008495. doi:10.1371/journal.pcbi.1008495

Simpson MJ, Maclaren OJ. Profile-wise analysis: a profile likelihood-based workflow for identifiability analysis, estimation, and prediction with mechanistic mathematical models. PLoS Comput Biol. 2023;19(9):e1011515. doi:10.1371/journal.pcbi.1011515

Schälte Y, Fröhlich F, Jost PJ, Vanhoefer J, Pathirana D, Stapor P, Lakrisenko P, Wang D, Raimúndez E, Merkt S, Schmiester L, Städter P, Grein S, Dudkin E, Doresic D, Weindl D, Hasenauer J. pyPESTO: a modular and scalable tool for parameter estimation for dynamic models. Bioinformatics. 2023;39(11):btad711. doi:10.1093/bioinformatics/btad711

Identifiability

Bases: StrEnum

Identifiability of a parameter, read from the shape of its profile.

The classification follows Raue et al. 2009: a parameter is identifiable if its profile crosses the threshold on both sides of the optimum, practically non-identifiable if the profile stays below the threshold up to a bound of the parameter, on one or both sides, and structurally non-identifiable if the profile is flat on both sides.

label property

label

Get the description of the identifiability.

is_identifiable property

is_identifiable

Check whether the parameter is identifiable.

ProfileSettings dataclass

ProfileSettings(
    alpha=0.95,
    degrees_of_freedom=1,
    initial_step=0.1,
    min_step=0.01,
    max_step=1.0,
    step_factor=2.0,
    max_cost_fraction=0.2,
    max_points=50,
    flatness=0.05,
    reoptimize=True,
    optimizer_kwargs=dict(),
    scan_timeout=None,
    timeout=None,
)

Settings of a profile likelihood analysis.

The steps are in logarithmic parameter space, i.e., in decades of the parameter, because the scans run in the space the optimization runs in.

Attributes:

Name Type Description
alpha float

confidence level of the intervals.

degrees_of_freedom int

degrees of freedom of the chi-square threshold, 1 for pointwise confidence intervals of single parameters, the number of parameters for simultaneous intervals.

initial_step float

first step of a scan in decades of the parameter, where the analysis has no scale of it: a scan starts at the scale of its parameter where the Fisher information of the optimum gives one, see first_steps.

min_step float

smallest step in decades, a step is not reduced below it.

max_step float

largest step in decades.

step_factor float

factor a step which rises slowly is enlarged by; a step which rises too fast is reduced by the curvature of the profile, see _scan_direction.

max_cost_fraction float

largest increase of the cost a single step may cause, as a fraction of the distance between the minimal cost and the threshold. A step with a larger increase is reduced and repeated, so a profile has at least 1 / max_cost_fraction points between the optimum and the threshold.

max_points int

largest number of points of a scan in one direction.

flatness float

a profile which rises by less than this fraction of the distance between the minimal cost and the threshold, on both sides, is flat, i.e., the parameter is structurally non-identifiable.

reoptimize bool

optimize the other parameters at every point of a scan, which is the profile likelihood. Without it the other parameters stay at the optimum, which is a plain scan of the cost and a lower bound of the profile: it is faster and finds the non-identifiable parameters, but its intervals are too narrow for coupled parameters.

optimizer_kwargs Mapping[str, Any]

arguments of scipy.optimize.least_squares for the optimization of the other parameters, without loss and f_scale: the loss is the one of the fit, FitSettings.loss_function. The step of the finite differences is the one of a fit, OptimizationProblem.optimizer_arguments, unless diff_step is given.

scan_timeout float | None

seconds without any scan finishing after which the scans which run or wait are given up, None for no limit. It bounds a scan which does not return, which stopped a parallel analysis with no message and no result at all (#522); the parameters of the scans which were given up have no profile and are named in incomplete, and the analysis writes the profiles it has.

timeout float | None

seconds after which the whole analysis is given up, None for no limit, so that an overnight run is bounded and writes what it has. It is the budget of the scans and, in a serial analysis, is checked before every scan.

delta property

delta

Get the chi-square quantile of the confidence level.

This is the threshold on -2 log L, i.e., on twice the cost.

threshold

threshold(cost)

Get the threshold on the cost for a minimal cost.

Parameters:

Name Type Description Default
cost float

minimal cost.

required

Returns:

Type Description
float

The cost at which the profile crosses the confidence level,

float

cost + delta / 2 for the cost convention 0.5 * Σ r².

to_dict

to_dict()

Convert to a dictionary of JSON serializable values.

from_dict staticmethod

from_dict(d)

Create settings from a dictionary, i.e., from the stored JSON.

A record written before the limits of #522 has neither, which is no limit, the behaviour it ran with.

ParameterProfile dataclass

ParameterProfile(
    pid,
    values,
    costs,
    paths,
    converged,
    index_optimum,
    ci_lower=None,
    ci_upper=None,
    identifiability=None,
)

Profile likelihood of a single parameter.

The points are sorted by the value of the parameter, the optimum is one of them. Every point carries the full parameter vector the cost was reached with, so the paths of the other parameters along the profile are known.

Attributes:

Name Type Description
pid str

id of the profiled parameter.

values ndarray

values of the parameter at the points, ascending.

costs ndarray

cost at every point.

paths ndarray

values of all parameters at every point, one row per point in the order of the parameters of the problem.

converged ndarray

whether the optimization of the other parameters converged at every point.

index_optimum int

index of the optimum in the points.

ci_lower float | None

lower bound of the confidence interval, None if the profile stays below the threshold down to the bound.

ci_upper float | None

upper bound of the confidence interval, None if the profile stays below the threshold up to the bound.

identifiability Identifiability | None

classification of the parameter, set by evaluate, None if a point failed or did not converge.

value_optimum property

value_optimum

Get the value of the parameter at the optimum.

cost_optimum property

cost_optimum

Get the cost at the optimum.

cost_min property

cost_min

Get the lowest cost of the profile, of the converged points.

side

side(direction)

Get the points on one side of the optimum, from the optimum outward.

Parameters:

Name Type Description Default
direction int

-1 for the points below the optimum, +1 above.

required

Returns:

Type Description
tuple[ndarray, ndarray]

The values and the costs, the optimum first.

crossing

crossing(threshold, direction, scale)

Get the value at which the profile crosses the threshold.

The crossing is interpolated between the last point below and the first point above the threshold, in the scale of the parameter, i.e. the scale the scan ran on.

Parameters:

Name Type Description Default
threshold float

threshold on the cost.

required
direction int

-1 for the crossing below the optimum, +1 above.

required
scale ParameterScaleType

the scale of the parameter.

required

Returns:

Type Description
float | None

The value of the parameter at the crossing, None if the profile

float | None

does not reach the threshold on that side.

rise

rise(direction)

Get how far the profile rises above its minimum on one side.

Parameters:

Name Type Description Default
direction int

-1 for the side below the optimum, +1 above.

required

Returns:

Type Description
float

The largest cost on the side minus the lowest cost of the profile.

evaluate

evaluate(threshold, flatness_cost, scale)

Set the confidence interval and the classification.

Parameters:

Name Type Description Default
threshold float

threshold on the cost of the confidence intervals.

required
flatness_cost float

rise of the cost below which a side is flat.

required
scale ParameterScaleType

the scale of the parameter, see crossing.

required

to_dict

to_dict()

Convert to a dictionary of JSON serializable values.

from_dict staticmethod

from_dict(d)

Create a profile from a dictionary, i.e., from the stored JSON.

IdentifiabilityResult dataclass

IdentifiabilityResult(
    opid,
    parameter_set,
    parameters,
    settings,
    fit_settings,
    cost,
    profiles,
    duration=0.0,
    incomplete=dict(),
    profiles_of=None,
)

Result of a profile likelihood analysis.

Attributes:

Name Type Description
opid str

id of the optimization problem.

parameter_set ParameterSet

parameters the profiles were computed around, in the units of pint of the problem, see OptimizationProblem.parameter_units.

parameters list[FitParameter]

fit parameters of the problem, with their bounds and units.

settings ProfileSettings

settings of the analysis.

fit_settings FitSettings

settings of the fit, which define the cost.

cost float

cost of the parameter set.

profiles dict[str, ParameterProfile]

profile of every analysed parameter by parameter id.

duration float

duration of the analysis in seconds.

incomplete dict[str, str]

why a parameter which was analysed has no profile, by parameter id, e.g. the scan which the scan_timeout or the timeout of the settings gave up (#522). Empty for an analysis whose every parameter has a profile.

profiles_of str | None

where the profiles were walked, RUN_IN_THE_ENGINE or RUN_IN_PYTHON (RUN_MIXED for a result whose parts were not all walked in one place, see combine); None for a result which did not record it, i.e. one of sbmlsim 0.27 or earlier.

pids property

pids

Get the ids of the parameters of the problem.

cost_min property

cost_min

Get the lowest cost, of the parameter set or of any profile point.

threshold property

threshold

Get the threshold on the cost of the confidence intervals.

flatness_cost property

flatness_cost

Get the rise of the cost below which a profile is flat.

n_identifiable property

n_identifiable

Get the number of identifiable parameters.

better_optimum property

better_optimum

Check whether a profile found a lower cost than the parameter set.

The threshold is relative to the lowest cost, so the intervals are still valid, but the fit did not converge to the optimum.

evaluate

evaluate()

Set the confidence intervals and the classifications.

combine staticmethod

combine(parts)

Combine the results of parts of an analysis into one result.

An analysis split into parts, e.g. one per parameter, or the results profile_likelihood reports with on_profile, combine to the result of the whole analysis: the profiles of the parts in the order of the parts, evaluated against the lowest cost of all of them, since the threshold of the confidence intervals depends on it.

Parameters:

Name Type Description Default
parts Sequence[IdentifiabilityResult]

the results of the parts, around the same parameter set with the same settings.

required

Returns:

Type Description
IdentifiabilityResult

The result with the profiles of all parts, its duration the sum of

IdentifiabilityResult

the durations of the parts, the parameters without a profile of

IdentifiabilityResult

all of them (incomplete) and, as profiles_of, the one place

IdentifiabilityResult

the parts were walked in, RUN_MIXED if they were not all walked

IdentifiabilityResult

in one place. The parts are not changed.

Raises:

Type Description
ValueError

if there is no part, if a parameter is profiled in two parts, or if the parts differ in the problem, the parameter set, the parameters, the settings, the settings of the fit or the cost.

scale

scale(pid)

Get the scale a parameter was profiled on.

It is the FitParameter.scale of the parameter and the parameter_scale of the settings of the fit for a parameter without one, i.e. OptimizationProblem.scales_initialized.

Raises:

Type Description
KeyError

if the problem has no parameter with the id.

parameter

parameter(pid)

Get the fit parameter of an id.

Raises:

Type Description
KeyError

if the problem has no parameter with the id.

summary_df

summary_df()

Get the table of the analysis, one row per profiled parameter.

Returns:

Type Description
DataFrame

Table with the parameter, its value, unit (as the user defined

DataFrame

it, model for the unit of the model) and bounds, the confidence

DataFrame

interval (NaN for an open side), the classification,

DataFrame

the number of points of the profile and its lowest cost.

report

report(path=None, print_output=False)

Get the text report of the analysis.

Parameters:

Name Type Description Default
path Path | None

file to write the report to.

None
print_output bool

print the report.

False

Returns:

Type Description
str

The report.

to_dict

to_dict()

Convert to a dictionary of JSON serializable values.

from_dict staticmethod

from_dict(d)

Create a result from a dictionary, i.e., from the stored JSON.

to_json

to_json(path=None)

Store the result as JSON.

Parameters:

Name Type Description Default
path Path | None

file to write, the JSON string is returned if it is None.

None

Returns:

Type Description
str | Path

The path or the JSON string.

from_json staticmethod

from_json(json_info)

Load a result from a JSON file or string.

Parameters:

Name Type Description Default
json_info str | Path

path of the file or the JSON string.

required

Returns:

Type Description
IdentifiabilityResult

The result.

chi2_ppf

chi2_ppf(alpha, df)

Get the quantile of the chi-squared distribution, scipy.stats.chi2.ppf.

The one of sbmlsim-core (sbmlsim_core.stats.chi2_ppf), scipy's to the bit.

Parameters:

Name Type Description Default
alpha float

confidence level.

required
df int

degrees of freedom.

required

Returns:

Type Description
float

The quantile, 3.84 at 95% and one degree of freedom.

cost_threshold

cost_threshold(cost, alpha=0.95, df=1)

Get the threshold on the cost of a likelihood ratio test.

The cost is 0.5 * Σ r², so the threshold is half the chi-square quantile above the minimal cost; at 95% and one degree of freedom it is 1.92.

Parameters:

Name Type Description Default
cost float

minimal cost.

required
alpha float

confidence level.

0.95
df int

degrees of freedom.

1

Returns:

Type Description
float

The threshold on the cost.

first_steps

first_steps(
    problem,
    settings,
    parameter_set,
    profile_settings,
    pids,
    n_cores=1,
)

Get the first step of the scan of every parameter from its scale.

A profile is quadratic around the optimum, the cost rising by d² / (2 s²) over a distance d with s the standard error of the parameter in the space the scans run in, so the step which raises the cost by the most a step may raise it, max_cost_fraction of the distance to the threshold, is sqrt(2 max_rise) s. A scan which starts there walks the profile at its scale from its first point, where one which starts at initial_step corrects that step down to the scale and discards the re-optimization which measured every correction (#647).

The standard errors are the ones of the Fisher information of the optimum (sbmlsim.fit.fisher.fisher_information), whose jacobian is the forward sensitivities of the engine where the problem has them and the central differences of python otherwise, so the step of a parameter costs a fraction of the point it saves. A direction the data does not constrain has no standard error and keeps initial_step, and an information which cannot be computed leaves every parameter with it: a first step is where a scan starts and not a result of the analysis, so a failure of it is reported and the analysis runs.

Parameters:

Name Type Description Default
problem OptimizationProblem

optimization problem, initialized with the settings.

required
settings FitSettings

settings of the fit, which define the cost.

required
parameter_set ParameterSet

the optimum the profiles are walked around.

required
profile_settings ProfileSettings

settings of the analysis.

required
pids Sequence[str]

the parameters to profile, in the order of the profiles.

required
n_cores int

the workers of the jacobian of the information, which is the threads of its batch in the engine.

1

Returns:

Type Description
list[float]

The first step of every parameter of pids, in its order, in the

list[float]

space the scans run in and within [min_step, max_step].

profile_likelihood

profile_likelihood(
    problem,
    settings,
    parameter_set,
    profile_settings=None,
    pids=None,
    n_cores=1,
    serial=False,
    show_progress=True,
    on_profile=None,
    engine_profiles=None,
)

Analyse the identifiability of the parameters of a fit.

Computes the profile likelihood of every parameter around the parameter set and classifies the parameters, see the module documentation.

Parameters:

Name Type Description Default
problem OptimizationProblem

optimization problem, initialized with the settings.

required
settings FitSettings

settings of the fit, which define the cost.

required
parameter_set ParameterSet

optimal parameters, e.g., the best run of a fit.

required
profile_settings ProfileSettings | None

settings of the analysis, the defaults if None.

None
pids Sequence[str] | None

parameters to profile, all parameters of the problem which are no elements of a network by default. The elements of a network are profiled when they are named: one scan per element is impractical for hundreds of elements.

None
n_cores int

number of worker processes, the scans of the parameters run in parallel, or, for fewer scans than one re-optimization spreads over, the scans run one after another and the points of the jacobian of every re-optimization run on all workers, see sbmlsim.fit.runner.split_cores. A parallel analysis needs the if __name__ == "__main__": guard like a parallel fit.

1
serial bool

run the scans in this process, whatever n_cores says.

False
show_progress bool

show the progress of the scans on the console.

True
on_profile Callable[[IdentifiabilityResult], None] | None

called in the calling process with the result of one profile as soon as both scans of its parameter finished, e.g. to store the profiles while the analysis runs; its duration is the time since the profile before it finished. The results of all profiles combine to the result of the analysis, see IdentifiabilityResult.combine. An analysis which walks in the engine answers with all of its profiles at once, so it calls the callback for every one of them when the answer is there.

None
engine_profiles bool | None

whether the whole analysis runs in the engine, i.e. the walks of the profiles, the optimizations of their points and the evaluations of those, see sbmlsim.fit.fit_core: None walks there if the engine can walk it (fit_core.gaps_of_the_profiles, which a problem of the engine core of a profile of the other parameters passes), True requires it and False scans in python, which evaluates the points through the engine.

None

Returns:

Type Description
IdentifiabilityResult

The profiles with the confidence intervals and the classification.

Raises:

Type Description
KeyError

if a parameter id is not a parameter of the problem.

ValueError

if the parameter set is outside of the bounds of the problem, if there is no parameter to profile, if the arguments of the optimizer change the loss, which is FitSettings.loss_function, or if engine_profiles is required and the engine cannot walk the profiles.

TypeError

if an argument of the optimizer is not an argument of scipy.optimize.least_squares.

plot_profiles

plot_profiles(result, path=None, ncols=3)

Plot the profiles of all parameters, one panel per parameter.

Parameters:

Name Type Description Default
result IdentifiabilityResult

result of the analysis.

required
path Path | None

file to save the figure to, svg or png, with its spec next to it, see sbmlsim.report.figures.save_figure.

None
ncols int

number of panels per row.

3

Returns:

Type Description
Chart

The figure, a chart of the renderer of sbmlsim-core.

plot_profile

plot_profile(result, pid, path=None)

Plot the profile of a parameter with the paths of the other parameters.

The upper panel is the profile, the lower panel the other parameters along it, relative to their values at the optimum: log10(parameter / optimum) for a parameter on a logarithmic scale and parameter - optimum for one on the linear scale, the axis log10(p / p_opt) and p - p_opt. A parameter which changes along the profile is coupled to the scanned one (Maiwald et al. 2016).

Parameters:

Name Type Description Default
result IdentifiabilityResult

result of the analysis.

required
pid str

id of the parameter.

required
path Path | None

file to save the figure to, see plot_profiles.

None

Returns:

Type Description
Chart

The figure, a chart of the renderer of sbmlsim-core.

plot_all

plot_all(
    result, output_dir, image_format="svg", png_dpi=None
)

Write the overview figure and the figure of every profile.

Every figure is written with its spec, see sbmlsim.report.figures.save_figure.

Parameters:

Name Type Description Default
result IdentifiabilityResult

result of the analysis.

required
output_dir Path

directory of the figures.

required
image_format str

format of the figures, svg or png.

'svg'
png_dpi float | str | None

resolution of a PNG copy of the overview figure, which is written if the format is another one, e.g. for LaTeX, which includes no SVG, and of the figures of the format png; no copy by default; "figure" is the resolution of the figure itself.

None

Returns:

Type Description
list[Path]

The paths of the figures, the overview first; a PNG copy and a spec

list[Path]

are not among them.