Hi,
I’m wondering how to randomly generate values from my custom likelihood?
My understanding is I need to generate simulated data alongside my observed data to perform leaveoneout crossvalidation with LOO (Stan  Loo).
I can see that this is simple when using one of STAN’s prespecified likelihood functions: 27.1 Simulating from the posterior predictive distribution  Stan User’s Guide.
I have a fairly complicated custom likelihood function that I use in my model. Is there an easy way to randomly sample from this function?
Thanks.
Here are some suggestions:

Can you do inverse transform sampling on your likelihood? Or does it have any relationship with a more standard probability density? I have done both for my own work.

You can always do the simulation outside of Stan.
Can you share what your likelihood looks like?
This is not correct. You need the pointwise loglikelihood for LOO.
You can achieve this by generating random uniform values and transforming them by the inverse CDF. Again, you don’t need to do this for loo
, but answering for completeness.
If anybody is interested, I gave a summary of what I ended up doing in this thread here: Compound SamplingBinomial?  #13 by freddie090
(I went option #2 @sonicking  the likelihood is quite fiddly!)