I have been trying to use Stan for model calibration problems. I fit an emulator to the computer model and then try to use Bayesian model calibration. However, I am facing issues while calling an external R/Python function from within the Stan block. I need to invoke the prediction function from the emulator during each iteration of the Monte Carlo setup and this needs a way to call an R function outside the Stan block from within the Stan block. Usually we pass all the necessary data to Stan in the data block, which is not the case here. Does anyone have any idea how to go about this issue ?
Thanks.