SequentialSamplingModels.jl

Sequential sampling models (SSM), also known as an evidence accumulation models, are a broad class of dynamic models of human decision making in which evidence for each option accumulates until the evidence for one option reaches a decision threshold. Models within this class make different assumptions about the nature of the evidence accumulation process (see the references below for a broad overview).

Despite their usefulness in psychology, models such as Drift-Diffusion Models and their variants are notoriously hard to implement, with packages such as Python's HDDM and PyDDM, or R's fddm, sometimes lacking coverage (implementing only specific model subtypes) or flexibility (hard to use in bespoke real-life cases).

This package provides a unified interface for all the popular sequential sampling models (such as DDM, LBA, LNR, LCA, ...) in Julia, based on the Distributions.jl API, that can be used with Turing for Bayesian estimation.

An example of the evidence accumulation process is illustrated below for the Leaking Competing Accumulator (LCA):

Installation

You can install a stable version of SequentialSamplingModels by running the following in the Julia REPL:

] add SequentialSamplingModels

The package can then be loaded with:

using SequentialSamplingModels

Quick Example

The package implements sequential sampling models as distributions, that we can use you estimate the likelihood, or generate data from. In the example below, we instantiate a Linear Ballistic Accumulator (LBA) model, and generate data from it.

using SequentialSamplingModels
using StatsPlots
using Random

Random.seed!(2054)

# Create LBA distribution with known parameters
dist = LBA(; ν=[2.75,1.75], A=0.8, k=0.5, τ=0.25)
# Sample 10,000 random data points from this distribution
choice, rt = rand(dist, 10_000)

# Plot the RT distribution for each choice
histogram(layout=(2, 1), xlabel="Reaction Time", ylabel="Frequency", xlims = (0,1),
    grid=false, ylims = (0, 650))
histogram!(rt[choice.==1], subplot=1, color=:grey, leg=false, bins=200)
histogram!(rt[choice.==2], subplot=2, color=:grey, leg=false, bins=200)

References

Evans, N. J. & Wagenmakers, E.-J. Evidence accumulation models: Current limitations and future directions. Quantitative Methods for Psychololgy 16, 73–90 (2020).

Forstmann, B. U., Ratcliff, R., & Wagenmakers, E. J. (2016). Sequential sampling models in cognitive neuroscience: Advantages, applications, and extensions. Annual Review of Psychology, 67, 641-666.

Jones, M., & Dzhafarov, E. N. (2014). Unfalsifiability and mutual translatability of major modeling schemes for choice reaction time. Psychological Review, 121(1), 1.