Differential equation modeling in Pymc

I’m up to chapter 16 of McElreath’s Statistical Rethinking. I’m on the last example that models hare and lynx populations using differential equations. I haven’t been able to find a Python version of the code:

The above stops at problems that come earlier in the chapter.

I do see R versions that replicate what he does:

I’ve found a tutorial and notebook here so that may be the answer:


However, the above is even more complex than what I’m trying to understand. I’m trying to take it one step at a time and want to just understand if there is a straightforward way in PyMC to build the hare-link differential equation population models as per the book?


That’s for Partial Differential Equations. If all you have is an ODE, you might want to look here: GitHub - pymc-devs/sunode: Solve ODEs fast, with support for PyMC

1 Like