Advice to improve fit using ODE solver

Hello again everyone,

I need some advice in how to improve a current fit. So far, this is the best prediction that I have came with for my ODE system:

By adding (involuntarily as described here: Bounds on a specific column of a 2D array) an extra prior to my time series xn[t]. I got a fair improve in the fit:

However, I would not like to ‘force’ Stan to sample in that way by imposing a weird prior that is difficult to explain. I have played around with the absolute and relative tolerances, but it hasn’t helped that much.

I have attached my model and R program to call it in case anyone would mind to have a look.

Thanks in advance! :)
papu.R (2.7 KB)

mod6.3.V.stan (3.2 KB)

I’ll throw a few comments out here but I’d still like to hear what other people thought as well.

  • You should do more than 200 iters in your run script (or if you are, ignore me). Just wait on a couple thousand + run a few chains. Do it overnight if you need to. It didn’t seem to take too long for the 200 iters to run.

  • Is there a reason you set the max treedepth at 15? The one chain I ran was happily cruising along at 7-8.

  • Can you add to the plots a few samples of the actual output ODE? I assume we’re looking at means and 95% intervals on the posterior predictives?

The reason I’m asking is because it looks like your data is constrained > 0 but the error model allows stuff to go less than zero. For X6 though, I’m confused, cause it looks like the posterior is really tight for the first bit of time and then gets wide.

Is the ODE you’re running going negative or is that just the error-model isn’t quite ideal? Are these plots of the x_hats? If so, I’d do the posterior checks with the noise on top as well (it’s usually worth looking at both).