# Simulating an ODE model with non-constant parameter

I have a model, I can formulate the model using ordinary differential equation with parameter $P$. I want to simulate the model, but instead of using a fixed constant $P$ for the parameter, I want to force that the parameter $P$ is normally distributed. Can I do this ?

NB: I can also run a Gillespie Algorithm for my mode, but can I use a non-constant rate for my parameter ?

Thanks...

There is many way to introduce uncertainty of the parameters in a ordinary differential equation (ode) corresponding to different physical interpretation.

First example : Your parameter $P$ is theoricaly fix but the measure of this parameter came from a statistical study that shows that the estimator of $P$ : $\hat P \tilde\ \mathcal N$.

In this case you can sample $P$ in its law and do as much ode resolution as the number of sample.

In R code :

# Your ode
x0 = ..
nu = ..
a = ..

# Your random parameter
n = 100 # number of sample
P  = rnorm(n,p_theo=0,p_sd=1)

out = as.list(1:n)
for( i in 1:n)
{
params = list(P=P[i],..)
out[[i]] <- out <- ssa(x0,a,nu,params,tf=100,simName="My model")
}


Then you will have $n$ different trajectories in out that represent all the possible trajectories of your model.

Second example : Your parameter $P$ is theoricaly random : it can depend on complex biological aspect of an individual in an epidemiological study, it can depend on the humitity level (respiratory diseases)... Here you can randomly chose your parameter $P$ at each step of your ode resolution.

With gillespieSSA you can call the iteration time of the algorithm with : .t

# Your ode
x0 = ..
nu = ..
a = c('P(.t)*...',...)
params = ...

# Your random parameter
P <- function(t){return(rnorm(10,0,1))}
out <- out <- ssa(x0,a,nu,params,tf=100,simName="My model")


Note that in the first example you can use an other ode resolution algorithm like a deterministic algorithm.

In the second example there is many ways to model those type of uncertainty, this is not as simple as in the first example. In particular, depending on your algorithm of resolution, you can incerase the variability of your solution with the number of step that your algorithm have done.

Matt Keeling wrotted a good book on those subjects : Modeling Infectious Diseases in Human and Animals. If you want to model those type of uncertainty i advise you to read this book or some article about those issues because there is a lot of issues hidden behind this simple question.

• +1 Welcome to our site, Alex! Thank you for formulating a careful answer to an old question. – whuber Oct 23 '15 at 17:29