Hi,

I’ve a likelihood function over some continuous parameter, x. I can calculate the likelihood of different x by: discretizing x-space, letting each x be a state in a markov chain process and finding the stationary frequencies of that (linear algebra involved, specifically: matrix inversion + matrix dot product). In principle I could interpolate between the different x’es to get a continuous distribution. Now, my problem is that this likelihood function is not implemented in Stan, and as far as I can see not implementable directly in Stan?

I currently have the code in a python function, but I could in principle implement that in C++ if necessary. In either case (if not implementable directly in Stan), could you provide me with a pointer how I would go about attaching a custom python/c++ likelihood function to my Stan code?

Thanks,

Chris