Racing Diffusion Model
The Racing Diffusion Model (RDM; Tillman, Van Zandt, & Logan, 2020) is a sequential sampling model in which evidence for options races independently. The RDM is similar to the Linear Ballistic Accumulator (LBA), except it assumes that 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 RDM 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 RDM 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
RDM Constructor
Now that values have been assigned 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] │
│ A │ 0.50 │
│ k │ 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, 1, 1, 2, 1, 1, 1, 1, 1, 1 … 2, 1, 1, 1, 1, 2, 1, 1, 2, 1], rt = [0.4261252869183349, 0.7972780554571337, 0.5626104946052586, 0.709356356770205, 0.47920902310738883, 1.8152686671350737, 1.0603968132096429, 0.38991099679639674, 0.6206523528546303, 1.6505907453116413 … 0.7888321659958766, 0.5921379499413524, 1.2366558717646412, 0.44494442746499724, 0.945687762519527, 0.8134378742077351, 0.7190376150001438, 0.3551308652948572, 1.103503275499708, 0.8243406918226641])
Compute PDF
The PDF for each observation can be computed as follows:
pdf.(dist, choices, rts)
10000-element Vector{Float64}:
0.6812870492546116
0.5418501066765354
0.9505477125260924
0.4434948183057127
1.0282226389507736
0.05632148757361826
0.27698646477960737
0.7441997519730676
0.845351352480957
0.07688104603728428
⋮
0.8988136318313844
0.18297381769392043
0.9918778088571767
0.36868563648003216
0.3296695179829067
0.6644503768117955
0.38738935575430167
0.1495938427500118
0.504737288418596
Compute Log PDF
Similarly, the log PDF for each observation can be computed as follows:
logpdf.(dist, choices, rts)
10000-element Vector{Float64}:
-0.38377155025649884
-0.6127658717384906
-0.05071692102144627
-0.8130691609406383
0.027831718438863104
-2.8766791545973174
-1.2837866376001894
-0.29544579634961177
-0.1680029362939447
-2.5654959083085482
⋮
-0.10667957208439144
-1.69841220908741
-0.008155355839384558
-0.9978109317017789
-1.109664586976242
-0.40879508110146934
-0.9483250044984833
-1.8998313723769338
-0.6837172060219201
Compute Choice Probability
The choice probability $\Pr(C=c)$ is computed by passing the model and choice index to cdf
along with a large value for time as the second argument.
cdf(dist, 1, Inf)
NaN
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.