Rob J. de Boer
|Home | Research | Publications | Books | Software | CV ||
Phase plane analysis is a powerful approach for analyzing mathematical models comprised of a few ordinary differential equations (ODEs). grind.R is an R-script allowing one to easily study such models by numerical integration, phase plane analysis, finding and following steady states, and fitting to data. grind.R is a wrapper around R-libraries developed by Karline Soetaert and colleagues. Grind is easy to use because it defines just a few basic functions:
- run() integrates a model numerically and provides a time plot or a trajectory in the phase plane,
- plane() draws nullclines and can provide a vector field or phase portrait,
- newton() finds steady states (using the Newton-Raphson method) and can provide the Jacobian with its eigenvalues and eigenvectors.
- continue() continues a steady state along a parameter, thus providing a bifurcation diagram.
- fit() fits an ODE model to data by estimating its parameters, and depicts the result in a timeplot.
The run() function calls ode() from the deSolve R-package, the fit() function calls modFit from FME, and newton() and continue() call steady() from the rootSolve package (these 3 packages have to be installed). The grind.R functions have several options with well-chosen defaults (also for the state (s) and parameters (p) of the system), such that they are typically well-behaved when no options are provided. Using Shiny in R one can easily create webpages for analyzing particular models using sliders for changing parameters (see a LotkaVolterra example).
We use grind.R in our courses for biology students at Utrecht University because it allows them to easily analyze mathematical models, see their dynamical behavior on the screen, and export high quality graphics for reports. Researchers may also like grind.R because it allows them to easily define and study simple ODE models, add if-then-else statements, noise and events, and perform non-linear parameter estimation while fitting several data sets simultaneously having unique and shared parameters (using the state of the art environment FME).
A tutorial, the grind.R script, and a number of examples can be downloaded from this directory.
Grind is basically an R-version of an earlier C-program called GRIND. The installation instructions of GRIND are still available on this web page for diehards. See this page for a translation of GRIND commands into Grind.