This is a optimized simulation of the drift diffusion process (DDP, as described, for example, here http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2474742/). I used a mixture of for loops and cumsum to obtain high speed.
The same code can be used to have a diffusion process without drift across trial, a binary DDP, a one-choice DDP, a one choice pure diffusion process.
Hi Jing, fitting the drift diffusion model could be quite tricky. You could use the DMAT toolbox designed exactly for that purpose. Alternatively I have some methods that I use myself. I will maybe post them on here in the future, if I can manage to clean the code up a little bit.
I'm so happy to find this code! Would you please tell how to fit the model to specific data, is there existing code or functions?
Inspired: Quantile Probability Plot
Create scripts with code, output, and formatted text in a single executable document.