Example models

The package comes with ready-made problems to try things on. They live in a submodule, ODEParameterEstimation.Examples. Each is a function that returns a ParameterEstimationProblem with true values and no data, so the usual pattern is:

using ODEParameterEstimation
using ODEParameterEstimation.Examples

problem = sample_problem_data(lotka_volterra(); datasize = 101)
results = estimate(problem)

Every model carries a time interval that suits it, and sample_problem_data uses it unless you pass time_interval yourself.

using ODEParameterEstimation
using ODEParameterEstimation.Examples

function describe(group)
    println(rpad("model", 32), "states  parameters  measured  interval")
    for name in example_models(group)
        problem = example_problem(name)
        println(rpad(name, 32), rpad(length(problem.ic), 8), rpad(length(problem.p_true), 12),
            rpad(length(problem.measured_quantities), 10), problem.recommended_time_interval)
    end
end

Looking inside one

A problem carries its ModelingToolkit system, its measured quantities and its true values:

using ModelingToolkit

problem = lotka_volterra()
equations(problem.model.system)
2-element Vector{Symbolics.Equation}:
 Differential(t, 1)(r(t)) ~ k1*r(t) - k2*r(t)*w(t)
 Differential(t, 1)(w(t)) ~ -k3*w(t) + k2*r(t)*w(t)
problem.measured_quantities
1-element Vector{Symbolics.Equation}:
 y1(t) ~ r(t)
problem.p_true
OrderedCollections.OrderedDict{Symbolics.Num, Float64} with 3 entries:
  k1 => 1.0
  k2 => 0.5
  k3 => 0.3

First steps

Small models that are solved quickly and accurately.

describe(:first_steps)
model                           states  parameters  measured  interval
harmonic_oscillator             2       2           2         [0.0, 10.0]
oscillator_mixed_outputs        2       2           2         [0.0, 10.0]
exponential_decay               1       1           1         [0.0, 10.0]
decay_cubed_output              1       1           1         [0.0, 10.0]
forced_decay                    1       2           1         [0.0, 10.0]
lotka_volterra                  2       3           1         [0.0, 20.0]
vanderpol                       2       2           2         [0.0, 10.0]
brusselator                     2       2           2         [0.0, 20.0]
daisy_mamil3                    3       5           2         [0.0, 10.0]
repressilator                   6       3           3         [0.0, 24.0]
ODEParameterEstimation.Examples.daisy_mamil3 — Method
daisy_mamil3()

A linear three-compartment model with five exchange rates, a standard identifiability benchmark. Two of the three compartments are measured.

All five rates and the unmeasured initial amount are recovered.

source
ODEParameterEstimation.Examples.repressilator — Method
repressilator()

A ring of three genes, each repressing the next, with saturating repression terms of the form beta / (1 + n p). The three proteins are measured and the three mRNA levels are not.

A model with parameters in denominators. It takes several minutes with the default options.

source

Something cannot be determined

In each of these the measured quantities leave at least one parameter or initial condition open. See More than one answer.

describe(:cannot_be_determined)
model                           states  parameters  measured  interval
sum_of_rates                    1       2           1         [0.0, 10.0]
partly_observed_chain           3       4           2         [0.0, 10.0]
hidden_scale                    3       3           1         [0.0, 10.0]
treatment                       4       5           2         [0.0, 40.0]
two_compartment_pk              2       5           1         [0.0, 48.0]
mass_spring_damper              2       4           1         [0.0, 10.0]
ODEParameterEstimation.Examples.hidden_scale — Method
hidden_scale()

Two unmeasured states feed a third, x3' = c (x1 + x2), and only x3 is measured. Scaling x1 and x2 up and c down by the same factor changes nothing that is measured.

The rates a and b and x3(0) are determined. c, x1(0) and x2(0) are reported as undetermined. Two results are returned, one for each way of assigning the two rates to the two hidden states.

source
ODEParameterEstimation.Examples.mass_spring_damper — Method
mass_spring_damper()

A mass on a spring with a damper, pushed by a constant unknown force: m x'' + c x' + k x = F. The position is measured.

Dividing the equation by m shows that only the ratios c/m, k/m and F/m matter. All four parameters are reported as undetermined, and the initial position and velocity are recovered.

source
ODEParameterEstimation.Examples.partly_observed_chain — Method
partly_observed_chain()

Three states, two of them measured. x2 grows at the rate b + c, so only that sum is determined, and x3 is neither measured nor felt by anything that is, so d and its initial value are open.

a and the two measured initial conditions are recovered. b, c, d and x3(0) are reported as undetermined.

source
ODEParameterEstimation.Examples.treatment — Method
treatment()

An epidemic model with treatment: susceptible S, infected In, treated Tr and the constant population N. Only the treated and the population size are measured.

Most of the model is left open by those two measurements: a, b, d, g, In(0) and S(0) are reported as undetermined, and nu is recovered. It takes a long time with the default options.

source
ODEParameterEstimation.Examples.two_compartment_pk — Method
two_compartment_pk()

A drug that moves between a central and a peripheral compartment and is eliminated from the central one. Only the central concentration is measured.

One concentration curve cannot separate the five parameters: all of them and the peripheral initial concentration are reported as undetermined. Only the central initial concentration is recovered.

source

Several answers

Two models in which several sets of values fit the data equally well, each beside a version that is measured fully enough to have one answer.

describe(:several_answers)
model                           states  parameters  measured  interval
hidden_subpopulations           5       6           3         [0.0, 12.0]
hidden_subpopulations_measured  5       6           5         [0.0, 12.0]
receptor_subtypes               3       6           2         [0.0, 8.0]
receptor_subtypes_measured      3       6           3         [0.0, 8.0]
ODEParameterEstimation.Examples.hidden_subpopulations — Method
hidden_subpopulations()

An epidemic in which the infected fall into three groups, each with its own infection rate b and recovery rate a. The susceptible, the recovered and the total number infected are measured, so the three groups are never seen apart.

Nothing in the data says which group is which. There are six answers, one for each ordering of the three groups, and all six fit equally well. Compare hidden_subpopulations_measured. It takes a long time with the default options.

source
ODEParameterEstimation.Examples.receptor_subtypes — Method
receptor_subtypes()

A ligand L that binds two receptor subtypes, each with its own amount and its own binding and release rates. The free ligand and the total amount bound are measured.

The two subtypes can be exchanged, so there are two answers. Compare receptor_subtypes_measured.

Warning

The package does not solve this model in reasonable time at present. It is here as a model to work on, and no test estimates it.

source

Larger models

Most of these are benchmarks from the identifiability literature. They take longer, some of them minutes, and two are beyond what the package solves in reasonable time at present. Their descriptions say which.

describe(:larger_models)
model                           states  parameters  measured  interval
crauste                         5       13          4         [0.0, 25.0]
daisy_ex3                       4       5           2         [0.0, 10.0]
daisy_mamil4                    4       7           3         [0.0, 10.0]
fitzhugh_nagumo                 2       3           1         [0.0, 10.0]
hiv                             5       10          4         [0.0, 25.0]
biohydrogenation                4       6           2         [0.0, 36.0]
seir                            4       3           2         [0.0, 60.0]
sirsforced                      5       6           2         [0.0, 30.0]
slowfast                        6       2           4         [0.0, 10.0]
allee_competition               2       8           2         [0.0, 10.0]
ODEParameterEstimation.Examples.allee_competition — Method
allee_competition()

Two competing species, each with logistic growth and an Allee threshold below which it declines. Both populations are measured. Eight parameters, with the carrying capacities in denominators.

There are four answers that fit the data equally well.

source
ODEParameterEstimation.Examples.biohydrogenation — Method
biohydrogenation()

A chain of three reactions with saturating rates of the form k x / (K + x). The first two of the four concentrations are measured.

The final product x7 affects nothing that is measured, so x7(0) is reported as undetermined. There are two answers for the rest. It takes several minutes with the default options.

source
ODEParameterEstimation.Examples.crauste — Method
crauste()

The Crauste model of the CD8 T-cell response to infection: naive cells N, early and late effector cells E and L, memory cells M and the pathogen P, with thirteen rates. N, E, P and the sum L + M are measured.

Warning

The package does not solve this model in reasonable time at present. It is here as a model to work on, and no test estimates it.

source
ODEParameterEstimation.Examples.daisy_ex3 — Method
daisy_ex3()

A linear three-state model driven by a ramp input u0, from the examples of the DAISY identifiability software. x1 and the input are measured.

There are two answers. It takes several minutes with the default options.

source
ODEParameterEstimation.Examples.daisy_mamil4 — Method
daisy_mamil4()

A linear four-compartment model with seven exchange rates. x1, x2 and the sum x3 + x4 are measured.

Compartments 3 and 4 are seen only together and can be exchanged, so there are two answers.

source
ODEParameterEstimation.Examples.fitzhugh_nagumo — Method
fitzhugh_nagumo()

The FitzHugh–Nagumo model of a nerve cell: a fast voltage V with a cubic term and a slow recovery variable R. Only the voltage is measured.

The three parameters and the unmeasured R(0) are recovered.

source
ODEParameterEstimation.Examples.hiv — Method
hiv()

A model of HIV infection and the immune response to it: uninfected cells x, infected cells y, virus v, and immune cells w and z, with ten rates. Four quantities are measured, one of them the sum y + v.

The values span eight orders of magnitude, from 2e-5 to 1000. The package rescales the problem internally (auto_rescale). It takes several minutes with the default options.

source
ODEParameterEstimation.Examples.seir — Method
seir()

The SEIR epidemic model: susceptible S, exposed E, infected In and the constant population N. The infected and the population size are measured.

There are two answers: the data cannot tell the recovery rate a from the rate nu at which the exposed become infected. It takes several minutes with the default options.

source
ODEParameterEstimation.Examples.sirsforced — Method
sirsforced()

An SIRS epidemic model whose infection rate varies with the seasons. The seasonal factor is produced by two extra states, x1 and x2, that form an oscillator of unknown frequency M. The infected and the recovered are measured.

Warning

The package does not solve this model in reasonable time at present. It is here as a model to work on, and no test estimates it.

source
ODEParameterEstimation.Examples.slowfast — Method
slowfast()

A chain of two reactions, A to B to C, watched through an absorbance signal eA xA + eB xB + eC xC. The concentration of C, the signal and two of the three coefficients are measured. The coefficients are constants, written as states that do not change.

There are two answers.

source

Control systems

Systems driven by a known sinusoidal input. See Inputs that depend on time.

describe(:control_systems)
model                           states  parameters  measured  interval
dc_motor                        2       2           1         [0.0, 5.0]
quadrotor_altitude              2       2           1         [0.0, 10.0]
forced_lotka_volterra           2       4           2         [0.0, 5.0]
magnetic_levitation             3       3           1         [0.0, 5.0]
aircraft_pitch                  3       4           1         [0.0, 10.0]
bicycle_model                   2       4           2         [0.0, 20.0]
boost_converter                 2       3           2         [0.0, 0.5]
bilinear_system                 2       8           2         [0.0, 15.0]
ODEParameterEstimation.Examples.aircraft_pitch — Method
aircraft_pitch()

The short-period pitch dynamics of an aircraft: pitch angle theta, pitch rate q and angle of attack alpha. The elevator moves as 0.05 sin(2 t) and the pitch rate is measured.

The four aerodynamic coefficients are recovered. The pitch angle itself affects nothing that is measured, so theta(0) is reported as undetermined.

source
ODEParameterEstimation.Examples.bicycle_model — Method
bicycle_model()

The lateral dynamics of a car as a single-track ("bicycle") model: lateral velocity vy and yaw rate r, with the steering angle 0.05 sin(0.5 t). Both states are measured. The geometry and the speed are taken as known.

The tyre stiffnesses Cf and Cr enter only divided by the mass or by the yaw inertia, so only those ratios are determined. All four parameters are reported as undetermined.

source
ODEParameterEstimation.Examples.boost_converter — Method
boost_converter()

The averaged model of a boost converter: inductor current iL and capacitor voltage vC, with the duty cycle varying as 0.5 + 0.1 sin(100 t). Both states are measured and the input voltage is taken as known.

The inductance, capacitance and load resistance are recovered.

source
ODEParameterEstimation.Examples.dc_motor — Method
dc_motor()

A DC motor: the armature current i produces a torque that turns the rotor at speed omega_m. The supply voltage is 12 + 2 sin(5 t) and the speed is measured. The electrical constants and the torque constant are taken as known.

The rotor inertia J and the friction coefficient b are recovered. With the torque constant unknown as well, only the ratios Kt/J and b/J could be determined.

source
ODEParameterEstimation.Examples.magnetic_levitation — Method
magnetic_levitation()

A ball held by an electromagnet, linearised about its resting point: position x, velocity v and coil current i. The coil voltage is 5 + sin(5 t) and only the position is measured. The electrical constants are taken as known.

The effective mass, stiffness and damping are recovered.

source

A model that has to be rewritten

One tank, written as it comes and written so that the package accepts it. See Rewriting a model so that it is accepted.

describe(:rewriting)
model                           states  parameters  measured  interval
tank_level                      1       2           1         [0.0, 30.0]
tank_level_rewritten            1       2           1         [0.0, 30.0]
ODEParameterEstimation.Examples.tank_level_rewritten — Method
tank_level_rewritten()

The tank of tank_level with the state z = sqrt(h) in place of the level. Then z' = (Qin - k z) / (2 A z), which is rational, and the measured level is z^2. The data are the same.

The area A and the outflow coefficient k are recovered. A second result has z and k both negated: it gives the same level, and is the price of measuring z only through its square.

source

Listing them

ODEParameterEstimation.Examples — Module
ODEParameterEstimation.Examples

Ready-made problems to try the package on. Each model is a function that returns a ParameterEstimationProblem with true values and no data:

using ODEParameterEstimation
using ODEParameterEstimation.Examples

problem = sample_problem_data(lotka_volterra(); datasize = 101)
results = estimate(problem)

example_models lists them and example_groups lists the groups they are sorted into.

source