Alternative to wiener_rng in Stan

Dear community,

For fitting DDM I use Wiener First Passage Time Distribution and all works fine in terms of chain diagnostics. However, I cannot run predictive checks since the wiener_rng function is not yet implemented in Stan math library. What can be a current alternative? We tried writing our own wiener_rng, but it didn’t work…

Thank you!

Based on this old thread it seems like it should be possible to implement the wiener_rng function using uniform_rng in pure-Stan. It will likely not be particularly fast, due to the use of a kind of rejection sampling

Thanks! This is what we tried :) didn’t work for us.

I just wrote it up as a Stan program and found that it took an unreasonably long time to produce a result. It compiled and ran, so it “worked” but I doubt it’s usable in a real program.

first of all, thank so much with your help with this! We also wrote something that complies alright, but the predictive checks looked bad. We used the very basic modeling approach, so I think something in the rng was funky.

we also compared results from our custom code and R rwiener code, and we got different outputs.