# dde v1.0.0

Monthly downloads

## Solve Delay Differential Equations

Solves ordinary and delay differential equations, where
the objective function is written in either R or C. Suitable only
for non-stiff equations, the solver uses a 'Dormand-Prince' method
that allows interpolation of the solution at any point. This
approach is as described by Hairer, Norsett and Wanner (1993)
<ISBN:3540604529>. Support is also included for iterating
difference equations.

## Readme

# dde

This package solves ordinary differential equations (ODEs), delay differential equations (DDEs) and discrete-time *difference* (or recursion) equations, perhaps involving delays.

For all the solvers, the target function can be an R function or a compiled function.

## Ordinary and delay differential equations

ODEs are solved with `DOPRI5`

and `DOP853`

; the 5th order and 8th order Dormand Prince methods Dormand Prince, based off of Ernst Hairer's Fortran implementations, but implemented in C. These integrators support dense output.

To solve DDEs, I use the same approach as Hairer in his `RETARD`

algorithm, exploiting the dense output of the Dormand Prince solvers.

This is an alternative approach to fitting delay DDE models to using deSolve. It exists because I have had problems fitting very large DDE systems in deSolve, possibly because the order of interpolation is lower than the order of integration which can cause problems with the overall accuracy of the solution.

By using the dense output, the solution can be computed at any time point the solver has passed to the same accuracy as the solution itself. This sidesteps the interpolation problem at the cost of a bit more book-keeping.

To store the history without using ever-growing (or just huge) amounts of memory, `dde`

uses a ring buffer to hold the history over time. This means that the memory required to store the solution does not grow as the total integration length increases (though you still need to pick an amount of memory that scales with the maximum number of steps that span your longest lag at any point in the integration).

These solvers are suitable only for non-stiff problems.

The interface is fairly different to the deSolve interface. A `deSolve`

compatible interface may be provided later (see this issue).

## Discrete time models

Solving discrete time equations is much simpler; you don't have much choice but just to iterate the model. The package implements this efficiently for compiled models, and also allows models to reference their previous history.

## Installation

Install `dde`

from CRAN with

```
install.packages("dde")
```

To install our internally released version (which might be ahead of CRAN) via drat, use

```
# install.packages("drat") # (if needed)
drat:::add("mrc-ide")
install.packages("dde")
```

or install the bleeding edge with

```
# install.packages("devtools") # (if needed)
devtools::install_gitub("mrc-ide/dde", upgrade = FALSE)
```

## License

MIT © Imperial College of Science, Technology and Medicine

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

## Functions in dde

Name | Description | |

difeq | Solve difference equation | |

difeq_replicate | Solve difference equations repeatedly | |

dopri_interpolate | Interpolate Dormand-Prince output | |

dopri | Integrate ODE/DDE with dopri | |

No Results! |

## Vignettes of dde

Name | ||

dde.Rmd | ||

No Results! |

## Last month downloads

## Details

License | MIT + file LICENSE |

URL | https://github.com/mrc-ide/dde |

BugReports | https://github.com/mrc-ide/dde/issues |

LinkingTo | ring (>= 1.0.0) |

RoxygenNote | 6.1.1 |

VignetteBuilder | knitr |

Encoding | UTF-8 |

Language | en-GB |

NeedsCompilation | yes |

Packaged | 2019-05-16 10:50:50 UTC; rfitzjoh |

Repository | CRAN |

Date/Publication | 2019-05-16 16:10:27 UTC |

suggests | deSolve , knitr , microbenchmark , rmarkdown , testthat |

depends | R (>= 3.1.0) |

linkingto | ring (>= 1.0.0) |

Contributors | Wes Hinsley, Imperial College of Science, Technology and Medicine |

#### Include our badge in your README

```
[![Rdoc](http://www.rdocumentation.org/badges/version/dde)](http://www.rdocumentation.org/packages/dde)
```