kingaa / pomp

R package for statistical inference using partially observed Markov processes
https://kingaa.github.io/pomp
GNU General Public License v3.0
111 stars 27 forks source link

Implementing a time delay in pomp #175

Closed catherinebyrne closed 2 years ago

catherinebyrne commented 2 years ago

Is there any way to write a system of ODEs in pomp with a time delay in one of the equations? Are there any examples online where you do this?

kingaa commented 2 years ago

Hello @catherinebyrne!

A key restriction in pomp is that the latent state process be Markov of finite order. That is, the state must be a point in $\mathbb{R}^n$ for some $n<\infty$.

If we have a dynamical system governed by equations of the form $$\frac{dx}{dt} = f(t,x(t),x(t-\tau)),\qquad x\in\mathbb{R}^n$$ where $\tau>0$ is a delay, then in general, the dimension of the dynamical system is infinite. Some people refer to such a system as having a "hard" delay.

Of course, it often happens that one isn't really married to the idea of hard delays. Indeed, the concept of a hard delay is itself an idealization. More realistically, one typically thinks of $$\frac{dx}{dt} = \int_0^\infty K(s) f(t,x(t),x(t-s)) ds,$$ where the kernel $K(s)$ is a probability density function. This is a so-called "soft" delay.

If one is willing to assume that $K$ is the probability density function of an Erlang distribution (i.e., a Gamma distribution with integer shape), then the linear chain trick (e.g., this paper) allows us to write an equivalent finite-dimensional system.

So the short answer to your question is "No", and if all you are looking for are algorithms for numerically integrating delay differential equations (NB: these are not ODE), then I recommend the deSolve package and, in particular, the dede function of that package.