I am in the process of writing a fairly complicated custom probability density function in Stan. The function is composed piece-wise like a spline, and it is impossible to get an integral of it with other means than by brute-force integration. The integral can’t be pre-computed, because it depends on the parameters.
I can approximate the integral using some form of interpolation techniques; the question arise: how precise the approximation needs to be.
The question is also cross-posted on CrossValidated. I will keep both threads in sync until I get an answer.