dMod2 builds ODE models of reaction networks, generates and compiles C++ code for them, and estimates their parameters from data. Prediction, observation, parameter transformation and objective functions return gradient and Hessian with their value, propagated forward or in one reverse sweep.
Model code is generated and compiled at run time, so C and C++ compilers and Python with SymPy are required; reticulate provides the Python packages on first use. On Linux the compilers are usually present, Windows users need Rtools. The default backend is cppDE, which generates C++ with forward and reverse derivatives to second order; cOde with deSolve is available as an alternative.
remotes::install_github("dModverse/dMod2")The backend cppDE comes along as a
Remotes: dependency and does not have to be installed separately.
Working on the package itself is easier from a checkout.
-
File → New Project → Version Control → Git, repository URL
https://github.com/dModverse/dMod2. -
Install the dependencies, including the ones declared under
Remotes::remotes::install_deps(dependencies = TRUE)
-
Build → Install and Restart.
cppDE installs the same way and has to be built first: dMod2 compiles
the generated model sources against its headers.
Models are assembled from four kinds of function objects that compose
with * (concatenation, chain rule) and + (direct sum over
experimental conditions):
| Object | Constructor | Role |
|---|---|---|
odemodel, prdfn |
odemodel(), Xs() |
the compiled ODE and its sensitivities |
obsfn |
Y() |
observation and error functions |
parfn |
P() |
parameter transformations |
objfn |
normL2(), constraintL2() |
objective functions |
Two models are worked through end to end:
- STAT5 dimerisation after Epo stimulation: the model of Boehm et al. (2014) from reactions to profile likelihoods, with a multistart fit, an error model by restricted maximum likelihood and confidence intervals.
inst/examples/example_BachmannMSB2011.R: the JAK2-STAT5 model of Bachmann et al. (2011), with 25 states in two compartments, the negative feedbacks CIS, SOCS3 and SHP1, and 113 parameters estimated from 541 measurements across thirteen experiments.
There is no publication for dMod2 yet. The paper below describes dMod, its predecessor, and is the reference for the modelling framework:
Kaschek D, Mader W, Fehling-Kaschek M, Rosenblatt M, Timmer J (2019). Dynamic Modeling, Parameter Estimation, and Uncertainty Analysis in R. Journal of Statistical Software, 88(10), 1-32. doi:10.18637/jss.v088.i10