Integration in joint likelihood

I’m hoping to run MCMC using STAN (using the rstan package since I’m using R). My likelihood function involves an integral.

Is there a way I can program this self-defined likelihood in STAN? Thanks for your help.

Well, you would need some way of calculating the integral. It would depend on whether you could approximate it well enough so it depends on how nice the integral is.

1 Like

Thanks. Is there a way I can keep the integral intact and have the sampling done on it?

@randommm has a PR to (try to) handle something like this

However, you would currently have to #include your own C++ code to utilize it because it is not exposed to the Stan language yet. Even then, it would still depend on how amenable h() * g() is to the tanh-sinh transformation.