Issues with poisson changepoint model

Sure. These lp[j] <- a1 + b1*x[j] lines originally used <- instead of =, I switched the real foo[N] notation to vector[N] foo, and the int foo[N] to array[N] int foo. You might be using a version of Rstan that doesn’t incorporate the updated array syntax, so it might not necessarily be that big of an issue.

With regards to identifiability it was more a comment about how if you are modeling knots or changepoints (as opposed to fixing them a priori, which is probably more common) you probably want at least a weakly informative prior – otherwise, the model can end up being flexible enough that many different choices of knot/changepoint location can fit the data well.

However, I suspect most of the issues you may have with this model arise because of how the discontiunity is formulated. I have not explored this concept in depth myself but I believe HMC will struggle becuase the likelihood itself becomes discontinuous (e.g. Modeling Cutpoint for Noisy Covariate - #5 by icostley or https://statmodeling.stat.columbia.edu/2017/05/19/continuous-hinge-function-bayesian-modeling/
Like I said earlier, you may want to think about the physics of what you are trying to model and decide if the true behavior really has an instantaneous jump or actually has a very rapid smooth transition. The latter I think should be much more ammendable to HMC.

1 Like