Time series implementation questions

Definitely. Usually we achieve that via variable transforms, so that the sampler proposes values in an “unconstrained” (or easier) space and we convert those to the “constrained” space (the same space where you “observe” or obtain random draws), adding any jacobian terms to make sure the user-defined prior is respected.

However, this approach is not great for timeseries, because most of the times it means doubling the amount of work: first “adding the innovations” when going from unconstrained to constrained space, and then undoing this work to get back to the “innovations”, which we need to actually compute the logpdf. In that issue I linked, it’s a simple case of differencing a cumsum of values, and it should be easy to teach Aesara (our computational backend) to optimize away that redundant back and forth, but for arbitrary Scan’s that’s obviously not as easy.

I have considered having some way of providing both formats, depending on whether a timeseries (or any distribution) is observed or latent, but I haven’t figured out how that could be done yet.