Racing Diffusion Model
The Diffusion Race Model (DRM; Tillman, Van Zandt, & Logan, 2020) is a sequential sampling model in which evidence for options races independently. The DRM is similar to the Linear Ballistic Accumulator, except it assumes noise occurs during the within-trial evidence accumulation process, but the drift rate is constant across trials.
Example
In this example, we will demonstrate how to use the DRM in a generic two alternative forced choice task.
Load Packages
The first step is to load the required packages.
using SequentialSamplingModels
using Plots
using Random
Random.seed!(8741)
Random.TaskLocalRNG()
Create Model Object
In the code below, we will define parameters for the DRM and create a model object to store the parameter values.
Drift Rates
The drift rates control the speed with which information accumulates. Typically, there is one drift rate per option.
ν = [1.0,0.50]
2-element Vector{Float64}:
1.0
0.5
Maximum Starting Point
The starting point of each accumulator is sampled uniformly between $[0,A]$.
A = 0.80
0.8
Threshold - Maximum Starting Point
Evidence accumulates until accumulator reaches a threshold $\alpha = k +A$. The threshold is parameterized this way to faciliate parameter estimation and to ensure that $A \le \alpha$.
k = 0.50
0.5
Non-Decision Time
Non-decision time is an additive constant representing encoding and motor response time.
τ = 0.30
0.3
LBA Constructor
Now that values have been asigned to the parameters, we will pass them to RDM
to generate the model object.
dist = RDM(;ν, k, A, τ)
RDM
┌───────────┬────────────┐
│ Parameter │ Value │
├───────────┼────────────┤
│ ν │ [1.0, 0.5] │
│ k │ 0.50 │
│ A │ 0.80 │
│ τ │ 0.30 │
└───────────┴────────────┘
Simulate Model
Now that the model is defined, we will generate $10,000$ choices and reaction times using rand
.
choices,rts = rand(dist, 10_000)
(choice = [2, 2, 1, 1, 2, 1, 2, 1, 2, 1 … 2, 1, 1, 1, 1, 1, 1, 2, 2, 1], rt = [0.5152837475793244, 0.5610852169725142, 0.7794058802572958, 0.7084110892657379, 0.635485406145567, 1.0603968132096429, 0.6066119504132275, 0.6206523528546303, 1.127295351685876, 0.7764406731925568 … 0.36165412698634686, 1.2130443040503631, 0.5168354334761972, 1.417311060056433, 0.8439158875655, 0.3925492845886786, 0.676411127203635, 1.528251061137812, 0.6390613782188108, 1.2639013524449128])
Compute PDF
The PDF for each observation can be computed as follows:
pdf.(dist, choices, rts)
10000-element Vector{Float64}:
0.7030407559215445
0.6492571375498213
0.5678440067255478
0.6828120210361471
0.5431707019792599
0.27698646477960737
0.5848224263114787
0.845351352480957
0.14076495122553465
0.5722723981701325
⋮
0.19308940048223774
1.012274456400557
0.12324296207113661
0.479535280207717
0.7638491992132445
0.7402449004727317
0.05506693584077902
0.5380705553727201
0.17206888058584463
Compute Log PDF
Similarly, the log PDF for each observation can be computed as follows:
logpdf.(dist, choices, rts)
10000-element Vector{Float64}:
-0.35234041456806897
-0.43192643496898564
-0.5659085340269416
-0.38153568271573235
-0.6103316401656278
-1.2837866376001894
-0.5364470225960212
-0.1680029362939447
-1.9606637922004126
-0.5581401803822162
⋮
-1.644601982394296
0.012199736073500292
-2.0935975705608714
-0.7349378102897736
-0.26938489252698744
-0.30077420094989066
-2.899205818425576
-0.6197655836034861
-1.7598604138124483
Plot Simulation
The code below overlays the PDF on reaction time histograms for each option.
histogram(dist; xlims=(0,2.5))
plot!(dist; t_range=range(.301, 2.5, length=100))
References
Tillman, G., Van Zandt, T., & Logan, G. D. (2020). Sequential sampling models without random between-trial variability: The racing diffusion model of speeded decision making. Psychonomic Bulletin & Review, 27, 911-936.