# Parameter Identifiability in ODE Models

Ordinary differential equations are commonly used for modeling real-world processes. The problem of parameter identifiability is one of the key design challenges for mathematical models. A parameter is said to be identifiable if one can recover its value from experimental data. Structural identifiability is a theoretical property of a model that answers this question. In this tutorial, we will show how to use StructuralIdentifiability.jl with ModelingToolkit.jl to assess identifiability of parameters in ODE models. The theory behind StructuralIdentifiability.jl is presented in paper .

We will start by illustrating local identifiability in which a parameter is known up to finitely many values, and then proceed to determining global identifiability, that is, which parameters can be identified uniquely.

To install StructuralIdentifiability.jl, simply run

using Pkg
Pkg.add("StructuralIdentifiability")

The package has a standalone data structure for ordinary differential equations but is also compatible with ODESystem type from ModelingToolkit.jl.

## Local Identifiability

### Input System

We will consider the following model:

$$$\begin{cases} \frac{d\,x_4}{d\,t} = - \frac{k_5 x_4}{k_6 + x_4},\\ \frac{d\,x_5}{d\,t} = \frac{k_5 x_4}{k_6 + x_4} - \frac{k_7 x_5}{(k_8 + x_5 + x_6)},\\ \frac{d\,x_6}{d\,t} = \frac{k_7 x_5}{(k_8 + x_5 + x_6)} - \frac{k_9 x_6 (k_{10} - x_6) }{k_{10}},\\ \frac{d\,x_7}{d\,t} = \frac{k_9 x_6 (k_{10} - x_6)}{ k_{10}},\\ y_1 = x_4,\\ y_2 = x_5\end{cases}$$$

This model describes the biohydrogenation process with unknown initial conditions.

### Using the ODESystem object

To define the ode system in Julia, we use ModelingToolkit.jl.

We first define the parameters, variables, differential equations and the output equations.

using StructuralIdentifiability, ModelingToolkit

# define parameters and variables
@variables t x4(t) x5(t) x6(t) x7(t) y1(t) y2(t)
@parameters k5 k6 k7 k8 k9 k10
D = Differential(t)

# define equations
eqs = [
D(x4) ~ - k5 * x4 / (k6 + x4),
D(x5) ~ k5 * x4 / (k6 + x4) - k7 * x5/(k8 + x5 + x6),
D(x6) ~ k7 * x5 / (k8 + x5 + x6) - k9 * x6 * (k10 - x6) / k10,
D(x7) ~ k9 * x6 * (k10 - x6) / k10
]

# define the output functions (quantities that can be measured)
measured_quantities = [y1 ~ x4, y2 ~ x5]

# define the system
de = ODESystem(eqs, t, name=:Biohydrogenation)


After that we are ready to check the system for local identifiability:

# query local identifiability
# we pass the ode-system
local_id_all = assess_local_identifiability(de, measured_quantities=measured_quantities, p=0.99)
# [ Info: Preproccessing ModelingToolkit.ODESystem object
# 6-element Vector{Bool}:
#  1
#  1
#  1
#  1
#  1
#  1

We can see that all states (except $x_7$) and all parameters are locally identifiable with probability 0.99.

Let's try to check specific parameters and their combinations

to_check = [k5, k7, k10/k9, k5+k6]
local_id_some = assess_local_identifiability(de, funcs_to_check=to_check, p=0.99)
# 4-element Vector{Bool}:
#  1
#  1
#  1
#  1

Notice that in this case, everything (except the state variable $x_7$) is locally identifiable, including combinations such as $k_{10}/k_9, k_5+k_6$

## Global Identifiability

In this part tutorial, let us cover an example problem of querying the ODE for globally identifiable parameters.

### Input System

Let us consider the following four-dimensional model with two outputs:

$$$\begin{cases} x_1'(t) = -b x_1(t) + \frac{1 }{ c + x_4(t)},\\ x_2'(t) = \alpha x_1(t) - \beta x_2(t),\\ x_3'(t) = \gamma x_2(t) - \delta x_3(t),\\ x_4'(t) = \sigma x_4(t) \frac{(\gamma x_2(t) - \delta x_3(t))}{ x_3(t)},\\ y(t) = x_1(t) \end{cases}$$$

We will run a global identifiability check on this enzyme dynamics model. We will use the default settings: the probability of correctness will be p=0.99 and we are interested in identifiability of all possible parameters

Global identifiability needs information about local identifiability first, but the function we chose here will take care of that extra step for us.

Note: as of writing this tutorial, UTF-symbols such as Greek characters are not supported by one of the project's dependencies, see this issue.

using StructuralIdentifiability, ModelingToolkit
@parameters b c a beta g delta sigma
@variables t x1(t) x2(t) x3(t) x4(t) y(t) y2(t)
D = Differential(t)

eqs = [
D(x1) ~ -b * x1 + 1/(c + x4),
D(x2) ~ a * x1 - beta * x2,
D(x3) ~ g * x2 - delta * x3,
D(x4) ~ sigma * x4 * (g * x2 - delta * x3)/x3
]

measured_quantities = [y~x1+x2, y2~x2]

ode = ODESystem(eqs, t, name=:GoodwinOsc)

@time global_id = assess_identifiability(ode, measured_quantities=measured_quantities)
# 30.672594 seconds (100.97 M allocations: 6.219 GiB, 3.15% gc time, 0.01% compilation time)
# Dict{Num, Symbol} with 7 entries:
#   a     => :globally
#   b     => :globally
#   beta  => :globally
#   c     => :globally
#   sigma => :globally
#   g     => :nonidentifiable
#   delta => :globally

We can see that only parameters a, g are unidentifiable and everything else can be uniquely recovered.

Let us consider the same system but with two inputs and we will try to find out identifiability with probability 0.9 for parameters c and b:

using StructuralIdentifiability, ModelingToolkit
@parameters b c a beta g delta sigma
@variables t x1(t) x2(t) x3(t) x4(t) y(t) u1(t) [input=true] u2(t) [input=true]
D = Differential(t)

eqs = [
D(x1) ~ -b * x1 + 1/(c + x4),
D(x2) ~ a * x1 - beta * x2 - u1,
D(x3) ~ g * x2 - delta * x3 + u2,
D(x4) ~ sigma * x4 * (g * x2 - delta * x3)/x3
]
measured_quantities = [y~x1+x2, y2~x2]

# check only 2 parameters
to_check = [b, c]

ode = ODESystem(eqs, t, name=:GoodwinOsc)

global_id = assess_identifiability(ode, measured_quantities=measured_quantities, funcs_to_check=to_check, p=0.9)
# Dict{Num, Symbol} with 2 entries:
#   b => :globally
#   c => :globally

Both parameters b, c are globally identifiable with probability 0.9 in this case.