Ex-Gaussian Model

The Ex-Gaussian is the convolution of a Gaussian and exponential distribution sometimes used to model reaction time distributions:

\[\mathrm{rt} \sim \mathrm{normal}(\mu,\sigma) + \mathrm{exponential}(\tau)\]

When the Ex-Gaussian was initially developed, some researchers thought that the Gaussian and exponential components represented motor and decision processes, respectively. More recent evidence casts doubt on this interpretation and shows that the parameters do not have a simple mapping to psychologically distinct processes in the drift diffusion model (Matzke & Wagenmakers, 2009). Perhaps this is unsurprising given that the models do not have the same number of parameters. Although the Ex-Gaussian is not technically a sequential sampling model, it is included in the package due to its historical role in reaction time modeling and its simple implementation.

Example

In this example, we will demonstrate how to use the Ex-Gaussian for a simulated detection task in which a stimulus appears and the subject responds as quickly as possible.

Load Packages

The first step is to load the required packages.

using SequentialSamplingModels
using Plots
using Random

Random.seed!(21095)
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.

Mean of Gaussian Component

The parameter $\mu$ represents the mean processing time of each accumulator in log space.

μ = .80
0.8

Standard Deviation of Gaussian Component

The parameter $\sigma$ represents the standard deviation of the Gaussian component.

σ = .20
0.2

Mean of Exponential Component

The parameter $\tau$ represents the mean of the exponential component.

τ = 0.30
0.3

Ex-Gaussian Constructor

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

dist = ExGaussian(μ, σ, τ)
ExGaussian
┌───────────┬───────┐
│ Parameter │ Value │
├───────────┼───────┤
│ μ         │  0.80 │
│ σ         │  0.20 │
│ τ         │  0.30 │
└───────────┴───────┘

Simulate Model

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

rts = rand(dist, 10_000)
10000-element Vector{Float64}:
 1.0954545786203158
 0.7975758183331387
 1.5997660801502085
 1.2623527233183027
 0.8757198878877115
 1.0410654136324768
 1.1826416852639556
 0.9208350483209031
 1.0369792012382697
 1.4855698819465282
 ⋮
 1.5771748217731343
 0.7016109750610431
 0.8786378203822389
 0.7613815245634052
 1.1758160349499218
 0.9495869444837122
 0.6575507046181691
 0.7566691482001159
 1.2017057305912535

Compute PDF

The PDF for each observation can be computed as follows:

pdf.(dist, rts)
10000-element Vector{Float64}:
 1.2301635021797126
 1.0434278188091224
 0.2893486641100843
 0.8468365299849266
 1.2505130496682588
 1.3139005197321285
 1.0391019964889818
 1.3220076883668987
 1.318526069456362
 0.42234967706773796
 ⋮
 0.31191310280636686
 0.712541025686941
 1.2563307868035631
 0.9230860964118113
 1.0554092655553722
 1.3460638393066433
 0.5619290793495987
 0.9067765316437989
 0.9930866242326277

Compute Log PDF

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

logpdf.(dist, rts)
10000-element Vector{Float64}:
  0.20714708915149493
  0.0425112729424415
 -1.2401228678380436
 -0.16624760179391349
  0.22355390684146959
  0.2730002092300095
  0.038356875238280685
  0.2791515571212815
  0.276514498672139
 -0.8619216894170971
  ⋮
 -1.165030646611879
 -0.3389177885854946
  0.2281953986609182
 -0.08003276994345332
  0.053928621139231886
  0.29718465900320257
 -0.5763796303796103
 -0.09785924109412214
 -0.006937383864939958

Plot Simulation

The code below overlays the PDF on reaction time histograms for each option.

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

References

Matzke, D., & Wagenmakers, E. J. (2009). Psychological interpretation of the ex-Gaussian and shifted Wald parameters: A diffusion model analysis. Psychonomic bulletin & review, 16, 798-817.