Leaky Competing Accumulator

The Leaky Competing Accumulator (LCA; Usher & McClelland, 2001) is a sequential sampling model in which evidence for options races independently. The LBA makes an additional simplification that evidence accumulates in a linear and ballistic fashion, meaning there is no intra-trial noise. Instead, evidence accumulates deterministically and linearly until it hits the threshold.

Example

In this example, we will demonstrate how to use the LBA 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.

Drift Rates

The drift rates control the speed with which information accumulates. Typically, there is one drift rate per option.

ν = [2.5,2.0]
2-element Vector{Float64}:
 2.5
 2.0

Threshold

The threshold $\alpha$ represents the amount of evidence required to make a decision.

α = 1.5
1.5

Lateral Inhibition

The parameter $\beta$ inhibits evidence of competing options proportionally to their evidence value.

β = 0.20
0.2

Leak Rate

The parameter $\lambda$ controls the rate with which evidence decays or "leaks".

λ = 0.10
0.1

Diffusion Noise

Diffusion noise is the amount of within trial noise in the evidence accumulation process.

σ = 1.0
1.0

Time Step

The time step parameter $\Delta t$ is the precision of the discrete time approxmation.

Δt = .001
0.001

Non-Decision Time

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

τ = 0.30
0.3

LCA Constructor

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

dist = LCA(; ν, α, β, λ, τ, σ, Δt)
LCA
┌───────────┬────────────┐
│ Parameter │ Value      │
├───────────┼────────────┤
│ ν         │ [2.5, 2.0] │
│ α         │  1.50      │
│ β         │  0.20      │
│ λ         │  0.10      │
│ τ         │  0.30      │
│ σ         │  1.00      │
│ Δt        │  0.00      │
└───────────┴────────────┘

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)
([1, 2, 1, 2, 1, 2, 1, 2, 1, 1  …  1, 2, 1, 2, 1, 1, 2, 2, 1, 2], [0.7440000000000003, 0.5470000000000002, 0.4920000000000001, 1.0710000000000006, 0.9610000000000005, 1.1610000000000007, 1.0110000000000006, 0.6840000000000003, 0.9360000000000004, 0.4860000000000001  …  0.7760000000000004, 0.6660000000000003, 0.7850000000000004, 0.6650000000000003, 0.9400000000000004, 0.8100000000000003, 1.1680000000000006, 0.5110000000000001, 0.8130000000000004, 0.8290000000000004])

Plot Simulation

The code below plots a histogram for each option.

# rts for option 1
rts1 = rts[choices .== 1]
# rts for option 2
rts2 = rts[choices .== 2]
# probability of choosing 1
p1 = length(rts1) / length(rts)
# histogram of retrieval times
hist = histogram(layout=(2,1), leg=false, grid=false,
     xlabel="Reaction Time", ylabel="Density", xlims = (0,2), ylims=(0,1.75))
histogram!(rts1, subplot=1, color=:grey, bins = 50, norm=true, title="Choice 1")
histogram!(rts2, subplot=2, color=:grey, bins = 50, norm=true, title="Choice 2")
# weight histogram according to choice probability
hist[1][1][:y] *= p1
hist[2][1][:y] *= (1 - p1)
hist

References

Usher, M., & McClelland, J. L. (2001). The time course of perceptual choice: The leaky, competing accumulator model. Psychological Review, 108 3, 550–592. https://doi.org/10.1037/0033-295X.108.3.550