Poisson Race

The Poisson race model is one of the first sequential sampling models, with origins dating back to 1962. In this model, evidence accumulates in discrete steps until the first accumulator reaches a threshold. The time between increments follows an exponential distribution. The first passage time follows a gamma distribution because it is the sum of exponential random variables.

Example

In this example, we will demonstrate how to use the Poisson race model 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!(65)
Random.TaskLocalRNG()

Create Model Object

In the code below, we will define parameters for the Poisson race and create a model object to store the parameter values.

Mean processing time

The parameter $\nu$ represents the mean processing of each count. Note that $\nu = \frac{1}{\lambda}$, where $\lambda$ is the rate parameter.

ν = [.04, .05]
2-element Vector{Float64}:
 0.04
 0.05

Threshold

The parameter $\alpha$ is a vector of thresholds. Each threshold is an integer because it represents a discrete count.

α = [4,4]
2-element Vector{Int64}:
 4
 4

Non-Decision Time

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

τ = 0.30
0.3

Poisson race Constructor

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

dist = PoissonRace(;ν, α, τ)
PoissonRace
┌───────────┬──────────────┐
│ Parameter │ Value        │
├───────────┼──────────────┤
│ ν         │ [0.04, 0.05] │
│ α         │ [4, 4]       │
│ τ         │  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, 2, 1, 1  …  2, 2, 2, 2, 1, 1, 1, 1, 2, 1], rt = [0.4559797144683182, 0.3749697591685416, 0.5007783307856986, 0.3893184263316646, 0.4104218262965172, 0.35125354769070133, 0.4843491606953234, 0.36392895777328466, 0.47561893944673495, 0.4805281719975132  …  0.4242886276266836, 0.4061082101636676, 0.4108428594240965, 0.34169826153402333, 0.4574731326007962, 0.3548809891926727, 0.3957452096859603, 0.39505325884732145, 0.37258694097526246, 0.5012963602140261])

Compute PDF

The PDF for each observation can be computed as follows:

pdf.(dist, choices, rts)
10000-element Vector{Float64}:
 2.0266672914930792
 3.934066370450476
 1.4988000652286813
 2.58811252177243
 4.533911107644525
 2.3838465959607738
 2.019447097207539
 1.7874940526937417
 2.3338681039986757
 2.1541656901764754
 ⋮
 2.764419836870549
 2.7631629106085747
 0.8214989108269689
 3.0444070174661584
 2.6592798918606695
 4.549956046405041
 4.54205024141201
 2.1228825232824517
 1.484021302292923

Compute Log PDF

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

logpdf.(dist, choices, rts)
10000-element Vector{Float64}:
  0.7063927156124248
  1.3696735908084066
  0.40466483145799836
  0.9509288539672379
  1.511584946168512
  0.8687153998008347
  0.7028237596928365
  0.5808146684161504
  0.8475270215557812
  0.7674034978633449
  ⋮
  1.0168307890415615
  1.016376005697355
 -0.19662466734018022
  1.1133061424492254
  0.9780553687974393
  1.5151175727854393
  1.5133785051395838
  0.7527748459486417
  0.3947554992869886

Compute Choice Probability

The choice probability $\Pr(C=c)$ is computed by passing the model and choice index to cdf.

cdf(dist, 1)
0.6200385158256305

To compute the joint probability of choosing $c$ within $t$ seconds, i.e., $\Pr(T \leq t \wedge C=c)$, pass a third argument for $t$.

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))
Example block output

References

LaBerge, D. A. (1962). A recruitment model of simple behavior. Psychometrika, 27, 375-395.