Drift-diffusion model in Stan

Hello forum,

We have been trying for a while to implement Pyddm model with collapsing bounds in Stan, but despite all efforts, we cannot get satisfactory posterior predictive checks.
Does anyone here have experience with DDM in Stan that goes beyond the build-in wiener function?

Thank you!


@Nathaniel-Haines I guess hBayesDM::hoiceRT_ddm() only does fixed-bounds, right?


@mike-lawrence yes, it is just using the built-in Stan functions, nothing with collapsing bounds or the additional variability parameters.


Thank you both – I know this package, but there is nothing like collapsing bounds there. Can you recommend someone who fits DDM in Stan that I can turn to with my question?

@bnicenboim any suggestions?

The people I know that have experience with the DDM are @tiagocc, @peterkraemer, and @Henrik_Singmann. So maybe they can tell you something.

(I quickly abandoned the DDM when the built in function didn’t really work with highly hierarchical realistic datasets. But this was a loong time ago.)


I think a DDM with collapsing bounds doesn’t have a tractable likelihood function which you need for HMC. Therefore you cannot use it with Stan (please correct me if I’m wrong).
People then use approximate bayesian computation (e.g., DE-MCMC or neural network based approaches) instead.


I think this is the correct answer. There is no known analytical likelihood for collapsing bounds so cannot be done with Stan.


Thank you all for your feedback! I will give a concrete example of what we are facing. In our task, the distribution of wrong RTs is shifted compared with the correct RTs and this difference cannot be captured by the existing Stan Wiener First Passage Time Distribution. On the other hand, Pyddm fits the data very well if we use collapsing bounds. I attached one example with real data (grey) and Pyddm model fit (black). Stan fit is nothing close to this.

As being said, I don’t think you can fit collapsing bounds with Stan.
I guess the Stan DDM can sort of fit the error rts with a starting point bias. But the Error RT distribution seems rather normal distributed which may hinder a good fit.
I’m not sure but maybe if you are willing to introduce drift-rate variablity, it may account for the error rts better. You can do that by specifying the model on trial level and have the trial-level drift rates coming from a participant/population level distribution. I haven’t tried this systematically but I think it can work. Let me know if you’re willing to go there ;-)

Thanks, @peterkraemer! We have tried to do a trial-specific drift-rate fitting in Stan, but it was also unsatisfactory. Is it ok if I reach out directly to you to ask more questions and potentially discuss our implementation?

Sure, just send me a message ^^

1 Like

According to This Evans et al., 2020 paper and this Voskuilen et al., 2016 paper, the collapse boundary diffusion model’s likelihood function can be somehow derived by using an approximate method proposed by P.Smiths. But I never figure out how they manage to do this…

Evans, N. J., et al. (2020). “The role of passing time in decision-making.” Journal of Experimental Psychology: Learning, Memory, and Cognition 46(2): 316-326.
Voskuilen, C., et al. (2016). “Comparing fixed and collapsing boundary versions of the diffusion model.” J Math Psychol 73: 59-79.