<p>The R package diffIRT (<a href="http://www.dylanmolenaar.nl/jss1265.pdf" rel="nofollow">http://www.dylanmolenaar.nl/jss1265.pdf</a>) estimates both the Q and the D diffusion models (see his website for the van der Maas et al. paper discussing the differences between these models). R code for the EZ2 approach, which is much faster if that is important for your applications, is <a href="http://raoul.socsci.uva.nl/EZ2/" rel="nofollow">http://raoul.socsci.uva.nl/EZ2/</a>.</p>

CC BY-SA 3.0
2015-04-06T14:58:29.293Z
2015-04-06T14:58:29.293Z
Dan Wright
<p>For the diffusion model, there is also Eric-Jan Wagenmakers' "EZ-diffusion model", which you can find <a href="http://raoul.socsci.uva.nl/EZ2/">here</a>.</p>

<p>This paper compares three different pieces of software for estimation of diffusion model parameters:</p>

<blockquote>
  <p>von Ravenzwaaij D., &amp; Oberauer, K. (2009). How to use the diffusion
  model: Parameter recovery of three methods: EZ, fast-dm, and DMAT.
  Journal of Mathematical Psychology, 53 (6),  463–473.
  <a href="http://www.donvanravenzwaaij.com/Papers_files/van%20Ravenzwaaij%20%26%20Oberauer,%202009.pdf">[PDF]</a></p>
</blockquote>

CC BY-SA 3.0
2012-11-13T23:42:33.187Z
2012-11-16T10:45:54.627Z
2012-11-16T10:45:54.627Z
Pavel
<p>In the subheading you also mention that you're interested in matlab / python implementations:</p>

<p>I've personally used DMAT in matlab at that's a nice package. However, the python based HDDM package may be one of the best around at the moment (in my opinion) and it has a good user guide.</p>

<p><a href="http://ski.clps.brown.edu/hddm_docs/abstract.html" rel="nofollow noreferrer">http://ski.clps.brown.edu/hddm_docs/abstract.html</a></p>

<p>and the paper associated with the package:</p>

<p>Wieki et al (2013): <a href="http://journal.frontiersin.org/article/10.3389/fninf.2013.00014/full" rel="nofollow noreferrer">http://journal.frontiersin.org/article/10.3389/fninf.2013.00014/full</a></p>

<h3>References</h3>

<ul>
<li>Wiecki, T. V., Sofer, I., &amp; Frank, M. J. (2013). HDDM: hierarchical bayesian estimation of the drift-diffusion model in python. Frontiers in neuroinformatics, 7, 14. <a href="http://journal.frontiersin.org/article/10.3389/fninf.2013.00014/full" rel="nofollow noreferrer">http://journal.frontiersin.org/article/10.3389/fninf.2013.00014/full</a></li>
</ul>

CC BY-SA 3.0
2016-12-18T22:41:50.063Z
2016-12-18T22:56:57.650Z
2016-12-18T22:56:57.650Z
B. Critt
<p>The R package <a href="https://cran.r-project.org/web/packages/rtdists/index.html" rel="nofollow noreferrer"><code>rtdists</code></a> is another great option:</p>

<blockquote>
  <p>Provides response time distributions (density/PDF, distribution function/CDF, quantile function, and random generation): (a) Ratcliff diffusion model based on C code by Andreas and Jochen Voss and (b) linear ballistic accumulator (LBA) with different distributions underlying the drift rate.</p>
</blockquote>

CC BY-SA 3.0
2016-12-16T18:05:37.667Z
2016-12-18T03:19:00.227Z
2016-12-18T03:19:00.227Z
crsh
<p><em>Here are a few options. I have not tried them yet personally.</em> </p>

<p>As mentioned below, the <a href="https://cran.r-project.org/web/packages/rtdists/index.html" rel="nofollow noreferrer">rtdists</a> package in R is able to fit both LBA and diffusion models.</p>

<h1>Other Options</h1>

<h3>LBA</h3>

<p>Scott Brown has a copy of Donkin et al (2009) on his web page with some code in R, Excel, and WinBUGS for fitting the LBA model:</p>

<ul>
<li><a href="http://www.newcl.org/publications/DonkinAverellEtAl2009BRM.pdf" rel="nofollow noreferrer">http://www.newcl.org/publications/DonkinAverellEtAl2009BRM.pdf</a></li>
<li><a href="http://www.newcl.org/members/chris/fitLBA.zip" rel="nofollow noreferrer">http://www.newcl.org/members/chris/fitLBA.zip</a></li>
</ul>

<p>There's also the <code>glba</code> package on CRAN by Ingmar Visser.</p>

<ul>
<li><a href="http://cran.r-project.org/web/packages/glba/index.html" rel="nofollow noreferrer">http://cran.r-project.org/web/packages/glba/index.html</a></li>
</ul>

<h3>Diffusion model</h3>

<p>The Diffussion model is available as a matlab toolbox called (<a href="http://ppw.kuleuven.be/okp/software/dmat/" rel="nofollow noreferrer">DMAT</a>).</p>

<h3>References</h3>

<ul>
<li>Donkin, C., Averell, L., Brown, S.D., &amp; Heathcote, A. (2009) Getting more from accuracy and response time data: Methods for fitting the Linear Ballistic Accumulator model. Behavior Research Methods, 41, 1095-1110. <a href="http://www2.psy.unsw.edu.au/Users/CDonkin/publications/brm09b.pdf" rel="nofollow noreferrer">PDF</a></li>
<li>Vandekerckhove, J., &amp; Tuerlinckx, F. (2008). Diffusion model analysis with MATLAB: A DMAT primer. Behavior Research Methods, 40, 61-72. doi:10.3758/BRM.40.1.61 <a href="http://ppw.kuleuven.be/okp/_pdf/Vandekerckhove2008DMAWM.pdf" rel="nofollow noreferrer">PDF</a></li>
</ul>

CC BY-SA 3.0
2012-10-23T23:25:17.470Z
2016-12-18T03:44:40.473Z
2016-12-18T03:44:40.473Z
Jeromy Anglim
<p>I am looking for an implementation of the linear ballistic accumulator model or Ratcliff's diffusion model (e.g. in R, MATLAB, or Python).</p>

<experimental-psychology><cognitive-modeling><mathematical-psychology><reaction-time>
Is there an R implementation of the linear ballistic accumulator model or Ratcliff's diffusion model for measuring response time and accuracy?
jokel
# Is there an R implementation of the linear ballistic accumulator model or Ratcliff's diffusion model for measuring response time and accuracy?

(Asked by: username_0 on 2012-10-23)

I am looking for an implementation of the linear ballistic accumulator model or Ratcliff's diffusion model (e.g. in R, MATLAB, or Python).

**Tags:** experimental-psychology, cognitive-modeling, mathematical-psychology, reaction-time


---

## 5 answers

### Answer by username_5 on 2012-10-23. Score: 17 | Accepted answer

*Here are a few options. I have not tried them yet personally.*

As mentioned below, the [rtdists](https://cran.r-project.org/web/packages/rtdists/index.html) package in R is able to fit both LBA and diffusion models.

# Other Options

### LBA

Scott Brown has a copy of Donkin et al (2009) on his web page with some code in R, Excel, and WinBUGS for fitting the LBA model:

* <http://www.newcl.org/publications/DonkinAverellEtAl2009BRM.pdf>
* <http://www.newcl.org/members/chris/fitLBA.zip>

There's also the `glba` package on CRAN by Ingmar Visser.

* <http://cran.r-project.org/web/packages/glba/index.html>

### Diffusion model

The Diffussion model is available as a matlab toolbox called ([DMAT](http://ppw.kuleuven.be/okp/software/dmat/)).

### References

* Donkin, C., Averell, L., Brown, S.D., & Heathcote, A. (2009) Getting more from accuracy and response time data: Methods for fitting the Linear Ballistic Accumulator model. Behavior Research Methods, 41, 1095-1110. [PDF](http://www2.psy.unsw.edu.au/Users/CDonkin/publications/brm09b.pdf)
* Vandekerckhove, J., & Tuerlinckx, F. (2008). Diffusion model analysis with MATLAB: A DMAT primer. Behavior Research Methods, 40, 61-72. doi:10.3758/BRM.40.1.61 [PDF](http://ppw.kuleuven.be/okp/_pdf/Vandekerckhove2008DMAWM.pdf)


---

### Answer by username_2 on 2012-11-13. Score: 9

For the diffusion model, there is also Eric-Jan Wagenmakers' "EZ-diffusion model", which you can find [here](http://raoul.socsci.uva.nl/EZ2/).

This paper compares three different pieces of software for estimation of diffusion model parameters:

> von Ravenzwaaij D., & Oberauer, K. (2009). How to use the diffusion
> model: Parameter recovery of three methods: EZ, fast-dm, and DMAT.
> Journal of Mathematical Psychology, 53 (6), 463–473.
> [[PDF]](http://www.donvanravenzwaaij.com/Papers_files/van%20Ravenzwaaij%20%26%20Oberauer,%202009.pdf)


---

### Answer by username_1 on 2015-04-06. Score: 5

The R package diffIRT (<http://www.dylanmolenaar.nl/jss1265.pdf>) estimates both the Q and the D diffusion models (see his website for the van der Maas et al. paper discussing the differences between these models). R code for the EZ2 approach, which is much faster if that is important for your applications, is <http://raoul.socsci.uva.nl/EZ2/>.


---

### Answer by username_3 on 2016-12-18. Score: 3

In the subheading you also mention that you're interested in matlab / python implementations:

I've personally used DMAT in matlab at that's a nice package. However, the python based HDDM package may be one of the best around at the moment (in my opinion) and it has a good user guide.

<http://ski.clps.brown.edu/hddm_docs/abstract.html>

and the paper associated with the package:

Wieki et al (2013): <http://journal.frontiersin.org/article/10.3389/fninf.2013.00014/full>

### References

* Wiecki, T. V., Sofer, I., & Frank, M. J. (2013). HDDM: hierarchical bayesian estimation of the drift-diffusion model in python. Frontiers in neuroinformatics, 7, 14. <http://journal.frontiersin.org/article/10.3389/fninf.2013.00014/full>


---

### Answer by username_4 on 2016-12-16. Score: 2

The R package [`rtdists`](https://cran.r-project.org/web/packages/rtdists/index.html) is another great option:

> Provides response time distributions (density/PDF, distribution function/CDF, quantile function, and random generation): (a) Ratcliff diffusion model based on C code by Andreas and Jochen Voss and (b) linear ballistic accumulator (LBA) with different distributions underlying the drift rate.


---

