Wald Model

The Wald model, also known as the inverse Gaussian, a sequential sampling model for single choice decisions. It is formally equivalent to a drift diffusion model with one decision threshold and no starting point or across trial drift rate variability.

Example

In this example, we will demonstrate how to use the Wald model in a generic single choice decision task.

Load Packages

The first step is to load the required packages.

using SequentialSamplingModels
using SSMPlots
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 Rate

The parameter $\nu$ represents the evidence accumulation rate.

ν = 3.0
3.0

Threshold

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

α = 0.50
0.5

Non-Decision Time

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

τ = 0.130
0.13

Wald Constructor

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

dist = Wald(ν, α, τ)
Wald
┌───────────┬───────┐
│ Parameter │ Value │
├───────────┼───────┤
│ ν         │  3.00 │
│ α         │  0.50 │
│ τ         │  0.13 │
└───────────┴───────┘

Simulate Model

Now that the model is defined, we will generate $10,000$ choices and reaction times using rand.

rts = rand(dist, 1000)
1000-element Vector{Float64}:
 0.2497583726820098
 0.1920991595577212
 0.17014146952687167
 0.3134807873881019
 0.2606956209468081
 0.3477593330864871
 0.4456088972225138
 0.22700077390888354
 0.2174691349711771
 0.1894306820203986
 ⋮
 0.34739112975908426
 0.23404777475758498
 0.47182294361870974
 0.1890244822280275
 0.19650784837737278
 0.382056629035519
 0.35678640400788253
 0.19982543551624948
 0.6838652330138372

Compute PDF

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

pdf.(dist, rts)
1000-element Vector{Float64}:
 4.431118086506131
 5.83627420237889
 4.121878549942996
 2.5204777832727387
 4.037757713178193
 1.8598880211340432
 0.8199529542374244
 5.271504334831883
 5.58414644080938
 5.763831882301298
 ⋮
 1.865892331197024
 5.01626568270468
 0.6664555867849219
 5.750249664065683
 5.899127826928147
 1.3838803476392434
 1.7191260068143188
 5.907109508795003
 0.14314243336782662

Compute Log PDF

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

logpdf.(dist, rts)
1000-element Vector{Float64}:
  1.488651941942618
  1.7640926142001967
  1.4163090181678715
  0.9244484800889811
  1.3956895164010696
  0.6205162822214206
 -0.19850831325091473
  1.6623157743492176
  1.7199315901895131
  1.7516025108661997
  ⋮
  0.623739400437286
  1.6126857689743024
 -0.40578177806542015
  1.7492432737041548
  1.7748045140399604
  0.3248913994402266
  0.5418160261076607
  1.7761566269707618
 -1.943915106901228

Plot Simulation

The code below overlays the PDF on reaction time histogram.

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

References

Anders, R., Alario, F., & Van Maanen, L. (2016). The shifted Wald distribution for response time data analysis. Psychological methods, 21(3), 309.

Folks, J. L., & Chhikara, R. S. (1978). The inverse Gaussian distribution and its statistical application—a review. Journal of the Royal Statistical Society: Series B (Methodological), 40(3), 263-275.

Steingroever, H., Wabersich, D., & Wagenmakers, E. J. (2021). Modeling across-trial variability in the Wald drift rate parameter. Behavior Research Methods, 53, 1060-1076.