Shifted Lognormal Model

The shifted lognormal model a sequential sampling model for single choice decisions in which the first passage time follows a lognormal distribution. The decision time distribution is shifted by a constant representing encoding and response execution processing time. Note that the shifted lognormal model is a special case of the log normal race model with a single accumulator.

Example

In this example, we will demonstrate how to use the shifted lognormal 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 LBA and create a model object to store the parameter values.

$\nu$

We will set the parameter $\nu = -1$.

ν = -1
-1

$\sigma$

We will set the parameter $\sigma = .50$

σ = .50
0.5

The lognormal has the following relationship to the normal distribution:

\[X \sim \mathrm{lognormal(\nu, \sigma)} \iff \log(X) \sim \mathrm{normal}(\nu, \sigma)\]

.

This means that $E[\log(X)] = \nu$ and $\mathrm{Var}[\log(X)] = \sigma^2$. Note that $\nu$ and $\sigma$ affect both the mean and variance of the lognormal distribution. See ACT-R for a possible theoretical intepretation of parameters $\nu$ and $\sigma$.

Non-Decision Time

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

τ = 0.30
0.3

Shifted Lognormal Constructor

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

dist = ShiftedLogNormal(ν, σ, τ)
ShiftedLogNormal
┌───────────┬───────┐
│ Parameter │ Value │
├───────────┼───────┤
│ ν         │ -1.00 │
│ σ         │  0.50 │
│ τ         │  0.30 │
└───────────┴───────┘

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.7508248728869664
 0.6766937699208705
 0.990338436931782
 0.601186308033283
 1.2486316912034008
 0.5313551294330137
 0.6468439490566509
 0.8667285297310623
 0.6168743943507293
 0.7175455336040467
 ⋮
 0.9577409929696037
 0.5410872091693524
 0.6508298270193421
 0.8938013541232601
 0.45082452325592215
 0.686007568628175
 0.9684914935001823
 0.6868129417505656
 0.5805419602930735

Compute PDF

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

pdf.(dist, rts)
1000-element Vector{Float64}:
 1.6293871063309224
 2.115751612181454
 0.5233138249933329
 2.4454126810930763
 0.1397807783743098
 2.2429379174523416
 2.2845182695212207
 0.9691065356883722
 2.4082671119547836
 1.8505738798822071
 ⋮
 0.6174857255797932
 2.3155089476257418
 2.2640582305023593
 0.8495403765660948
 1.0787569952657483
 2.057474793564867
 0.5847804441995023
 2.052349936554963
 2.4554841694064145

Compute Log PDF

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

logpdf.(dist, rts)
1000-element Vector{Float64}:
  0.48820393572385534
  0.7494101215583133
 -0.6475739470855042
  0.8942138944072674
 -1.9676799523815545
  0.8077865768011806
  0.8261551791532395
 -0.031380729183915435
  0.8789074481861633
  0.6154957963282378
  ⋮
 -0.4820993272171651
  0.8396295111617117
  0.8171588801967327
 -0.1630598091984845
  0.07580944799771872
  0.7214794024927641
 -0.5365188112570325
  0.7189854471526982
  0.8983239594824542

Compute CDF

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

cdf(dist, .75)
0.6565202259861354

Plot Simulation

The code below overlays the PDF on reaction time histogram.

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

References

Heathcote, A., & Bohlscheid, E. Analysis and Modeling of Response Time using the Shifted Lognormal Distribution.