Differential equation-based models in R: An approach to simplicity and performance
The world is a complex dynamical system, a system evolving in time and space in which numerous interactions and feedback loops produce phenomena that defy simple explanations. Differential-equation models are powerful tools to improve understanding of dynamic systems and to support forecasting and management in applied fields of mathematics, natural sciences, economics and business. While lots of effort has been put into the fundamental scientific tools, applying these to specific systems requires significant programming and re-implementation. The resulting code is often quite technical, hindering communication and maintenance. We present an approach to: (1) make programming more generic, (2) generate code with high performance (3) improve sustainability, and (4) support communication between modelers, programmers and users by: - automatic generation of Fortran code (package rodeo) from spreadsheet tables containing state variables, parameters, processes, interactions and documentation, - numerical solution with general-purpose solvers (package deSolve), - web-based interfaces (package shiny), that can be designed manually or auto-generated from the model tables (package rodeoApp), - creation of docs in LaTeX or HTML. Package rodeo uses a stoichiometry-matrix notation (Petersen matrix) of reactive transport models and can generate R or Fortran code for ordinary and 1D partial differential equation models, e.g. with longitudinal or vertical structure. The suitability of the approach will be shown with two ecological models of different complexity: (1) antibiotic resistance gene transfer in the lab, (2) algae bloom control in a lake.