Lognormal Race Model

The Lognormal Race model (LNR) assumes evidence for each option races independently and that the first passage time for each option is lognormally distributed. One way in which the LNR has been used is to provide a likelihood function for the ACT-R cognitive architecture. An example of such an application can be found in ACTRModels.jl. We will present a simplified version below.

Example

In this example, we will demonstrate how to use the LNR 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 LBA and create a model object to store the parameter values.

Mean Log Time

The parameter $\nu$ represents the mean processing time of each accumulator in log space.

ν = [-1,-1.5]
2-element Vector{Float64}:
 -1.0
 -1.5

Log Standard Deviation

The parameter $\sigma$ represents the standard deviation of processing time in log space.

σ = 0.50
0.5

Non-Decision Time

Non-decision time is an additive constant representing encoding and motor response time.

τ = 0.30
0.3

LNR Constructor

Now that values have been asigned to the parameters, we will pass them to LNR to generate the model object.

dist = LNR(ν, σ, τ)
LNR
┌───────────┬──────────────┐
│ Parameter │ Value        │
├───────────┼──────────────┤
│ ν         │ [-1.0, -1.5] │
│ σ         │  0.50        │
│ τ         │  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, 2, 2, 2, 1, 2, 2, 1, 1  …  2, 1, 2, 2, 1, 2, 2, 2, 2, 2], rt = [0.5284763207797445, 0.48267873010783957, 0.44032397928290745, 0.6437382290157518, 0.5532541679569261, 0.6121618789928376, 0.4537471611863404, 0.48120901356434786, 0.5461841032691223, 0.4901729278308987  …  0.45203066378683576, 0.5302903730855698, 0.3781620286425013, 0.4960131048155889, 0.4124525895307052, 0.5000283816472462, 0.4149261106183591, 0.4400940001768211, 0.48366631398201726, 0.5059093257359599])

Compute PDF

The PDF for each observation can be computed as follows:

pdf.(dist, choices, rts)
10000-element Vector{Float64}:
 2.893933713353151
 3.706240571191987
 3.5983104899395717
 0.8851584793472358
 2.3566079596199976
 0.6077189197307741
 3.773027674800382
 3.721402084206158
 0.9906133787321555
 1.0984568608062004
 ⋮
 1.0607423671628675
 1.1292158990007106
 3.526837681589226
 0.39093734361367666
 3.4604315706050928
 2.8498488628275926
 3.593998733692935
 3.6954823000465993
 3.3551541321164993

Compute Log PDF

Similarly, the log PDF for each observation can be computed as follows:

logpdf.(dist, choices, rts)
10000-element Vector{Float64}:
  1.0626167230931887
  1.3100180397315186
  1.2804644269523144
 -0.12198857729707013
  0.8572232798777513
 -0.49804280698536785
  1.3278777759142926
  1.3141005016309444
 -0.009430953233600659
  0.0939063410711296
  ⋮
  0.05896900937595628
  0.1215234971782671
  1.2604016285303623
 -0.9392079783499512
  1.2413933126800751
  1.0472659622875784
  1.2792654360221105
  1.3071110736349603
  1.2104977103867194

Plot Simulation

The code below overlays the PDF on reaction time histograms for each option.

histogram(dist)
plot!(dist; t_range=range(.301, 1, length=100))

References

Heathcote, A., & Love, J. (2012). Linear deterministic accumulator models of simple choice. Frontiers in psychology, 3, 292.

Rouder, J. N., Province, J. M., Morey, R. D., Gomez, P., & Heathcote, A. (2015). The lognormal race: A cognitive-process model of choice and latency with desirable psychometric properties. Psychometrika, 80, 491-513.