Dear Stan Forum users, I would like to know if there is a way for Stan to estimate the following nested model. Also, if there is a similar type of problems that are doable in Stan, please let me know.

(1) The likelihood depends on the parameter of interest (say theta), but also on a function of theta, v(theta).

Likelihood:

P(data|theta) = g(theta, v(theta); data)

(2) For a given theta, the function v( ) is the solution to a fixed point problem in a functional space.

Fixed Point Equation:

v = f(v; theta)

I have R codes that can conduct the second part (i.e. the codes can solve the fixed point equation given theta). My question is if it is possible for us to feed Stan v(theta)'s that are only numerically available from the R codes.

Thank you very much for your help!