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.649829489878363
0.6024324563630785
0.40005038019256944
0.6961394901860647
1.4519521752257625
0.7353340404614099
0.5889490412780038
0.46151804985690803
0.639618844029588
0.5106345272138088
⋮
0.5862752423379771
0.6862750952292604
0.48521753075255025
0.5993631055837709
0.6550705621267163
0.6230963399968912
0.5271898372239768
0.7006172770357693
1.0903427014593263
Compute PDF
Similarly, the log PDF for each observation can be computed as follows:
pdf.(dist, rts)
1000-element Vector{Float64}:
2.2692649939841587
2.4433118766913005
0.26859732000973674
1.9922053434900164
0.05114439639721592
1.731799777716515
2.457302773951708
1.274091588381257
2.3195238956203044
2.033859655103181
⋮
2.4576543097133556
2.05577379300089
1.6797170602614508
2.4482020147214367
2.2414782496588876
2.3876624749963176
2.2069006559816264
1.9628977349877188
0.31346433526698836
Compute Log PDF
Similarly, the log PDF for each observation can be computed as follows:
logpdf.(dist, rts)
1000-element Vector{Float64}:
0.8194559878652177
0.8933544454830099
-1.3145419725684775
0.6892422379309412
-2.9731023449373937
0.5491612016775395
0.8990643150685319
0.24223344497512977
0.8413619472132045
0.7099352957881665
⋮
0.8992073624059808
0.7206523186804707
0.5186253627204733
0.8953538835988256
0.8071355810904305
0.8703148434117703
0.7915891131131431
0.6744218176498067
-1.1600696884843797
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))
References
Heathcote, A., & Bohlscheid, E. Analysis and Modeling of Response Time using the Shifted Lognormal Distribution.