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 drift rate variability. The current implementation does include an inter-trial drift rate parameter $\eta$. When $\eta = 0$, the model reduces to the standard Wald model.

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 Plots
using Random

Random.seed!(8741)
Random.TaskLocalRNG()

Create Model Object

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

Drift Rate

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

ν = 3.0
3.0

Drift Rate Variability

The parameter $\eta$ represents the standard deviation of the evidence accumulation rate across trials.

η = 0.20
0.2

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.20 │
│ α         │  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.2985775398659861
 0.17056209415234508
 0.21388694034995456
 0.3436694210903711
 0.21823360160709887
 0.21917496349703433
 0.4758371809230722
 0.20036866651357083
 0.173209720589727
 0.21385464340675164
 ⋮
 0.7107341747898386
 0.16124506250720577
 0.2554216281785783
 0.22521218639371396
 0.19911919126131303
 0.17327926070615948
 0.40659294373568594
 0.2277291677905871
 0.2184825080497489

Compute PDF

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

pdf.(dist, rts)
1000-element Vector{Float64}:
 2.871964872946792
 4.19175319202873
 5.682007549785643
 1.9203604984566418
 5.5575769843773575
 5.528504708950896
 0.6451426557841964
 5.907167178010558
 4.549480096499134
 5.68286356619519
 ⋮
 0.12163115258234845
 2.5810406465630438
 4.215602199230551
 5.328598295768449
 5.90984477982044
 4.558217463699222
 1.12274967259383
 5.240003784307956
 5.5499553638068395

Compute Log PDF

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

logpdf.(dist, rts)
1000-element Vector{Float64}:
  1.0549964202430715
  1.4331190693381397
  1.7373046121508673
  0.6525129280278946
  1.7151622190998774
  1.7099173827591854
 -0.4382838148827882
  1.7761663896023783
  1.5150129619284882
  1.737455254670687
  ⋮
 -2.1067621532612923
  0.9481926689902505
  1.4387924517661297
  1.6730882196830628
  1.776619567083329
  1.5169316400186994
  0.11578074137473957
  1.6563222205288646
  1.7137898851686753

Compute CDF

The cumulative probability density $\Pr(T \leq t)$ is computed by passing the model and a value $t$ to cdf.

cdf(dist, .4)
0.8409867370628834

Plot Simulation

The code below overlays the PDF on reaction time histogram.

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

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: Statistical Methodology, 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.