# How to implement a moment ODE model

Moment ODEs are powerful models based on ordinary differential equations that allow to consider stochastic dynamics. This can be both intrinsics stochasticity, see in

or mixtures of intrinsic and extrinsic stochasticity, see in

To calibrate such models, for instance FACS data can be used.

The mathematical formulation of those model consists of ODEs for the mean of each species, of the covariance components between each species and higher order terms if desired. It can be encoded in the Data 2 Dynamics software as follows:

``````STATES
mu_1        C   "nmol/l"      "conc."
mu_2        C   "nmol/l"      "conc."
...
cov_1_1     C   "nmol/l^2"    "conc.^2"
cov_1_2     C   "nmol/l^2"    "conc.^2"
cov_2_2     C   "nmol/l^2"    "conc.^2"
...
``````

Please note that component `cov_1_2` and `cov_2_1` will be identical.

``````ODES
"mathematical expression for mu_1"
"mathematical expression for mu_2"
...
"mathematical expression for cov_1_1"
"mathematical expression for cov_1_2"
"mathematical expression for cov_2_2"
...
``````

The `OBSERABLES` and `ERRORS` section, for instance for FACS measurements of `mu_1` and `mu_2`, can be defined as follows

``````OBSERVABLES
obs_mu_1    C   "au"  "conc."   1   1   "scale_obs_mu_1 * (mu_1)"
obs_mu_2    C   "au"  "conc."   1   1   "scale_obs_mu_2 * (mu_2)"
...

ERRORS
obs_mu_1    "sqrt(cov_1_1 + sd_mu_1)"
obs_mu_2    "sqrt(cov_2_2 + sd_mu_2)"
``````

The error model parameters `sd_mu_1` and `sd_mu_2` implement additional measurement noise. Please note that these `OBERSERVABLES` do not take into account correlation information about `mu_1` and `m_2` that might be available. If such information should be considered a more complicated likelihood function has to be implemented manually.