How to solve Stochastic Differential Equations in Stan


Someone has an example code to solve a simple stochastic differential equation in Stan?
Thank you so much in advance for your help.


We don’t have solvers for stochatic diff eqs.

An example of our basic ODE solver is in the manual, my case study for soil carbon and Charles Margossian’s tutorial from StanCon 2017 on PK/PD models.


We can’t do SDEs per se, but if you can transform the problem into a Gaussian process with an appropriate kernel then you can tackle it from the GP perspective. Also, you can do the INLA trick of discretizing the domain of the SDE and modeling it with random effects – that can do very well in many applications.


Dear Bob and Michael, Thank you for clarifying.