Simulates choice reaction times from a two-accumulator Racing Diffusion Model (RDM). This is a specialized version where exactly two accumulators race towards a common threshold. The model assumes variability in the starting point of the diffusion process, drawn from a uniform distribution. This version is optimized for performance using vectorized operations and allows one (but not both) drift rate to be zero.
Arguments
- n
Number of trials to simulate. Must be a positive integer.
- vzero
Drift rate for the first accumulator. Must be a single non-negative number.
- vone
Drift rate for the second accumulator. Must be a single non-negative number. At least one of
vzero
orvone
must be positive.- bs
Threshold parameter, defined as
bs = b - bias
, whereb
is the decision threshold andbias
is the maximum starting point. Must be a single positive number.- bias
Maximum starting point parameter. The starting point for each accumulator on each trial is drawn from
Uniform(0, bias)
. Must be a single positive number.- ndt
Non-decision time (encoding and motor time offset). Must be a single non-negative number.
- x
Vector of quantiles (observed reaction times).
- log
Logical; if TRUE, probabilities p are given as log(p).
Value
bias data frame with n
rows and two columns:
- rt
The simulated reaction time (minimum finishing time across the two accumulators).
- choice
The index of the winning accumulator (1 for
vzero
, 2 forvone
).
Details
The RDM implemented here follows the formulation where the two accumulators
have drift rates vzero
and vone
. The diffusion process starts at a point z
drawn
from Uniform(0, bias)
. The process terminates when either accumulator reaches
a threshold b
. The parameter bs
is defined as bs = b - bias
, representing
the distance from the maximum starting point bias
to the threshold b
.
Therefore, the effective distance to threshold for a given trial is
bs = b - z = bs + bias - z
.
The finishing time for a single accumulator, given its drift rate v
, bs
, bias
, and ndt
,
is simulated by:
Sampling a starting point
z ~ Uniform(0, bias)
.Calculating the distance
bs = bs + bias - z
.If
v > 0
, simulating the time to reachbs
from an Inverse Gaussian distribution with meanbs / v
and shapebs^2
. This simulation uses an internal implementation based on Michael et al. (1976).If
v = 0
, the finishing time is considered infinite (Inf
).Adding the non-decision time
ndt
to finite finishing times.
The function simulates this process for both accumulators using vectorized operations.
The accumulator that finishes first determines the choice (1 for vzero
, 2 for vone
)
and the reaction time (RT) for that trial. If one drift rate is zero, the
accumulator with the positive drift rate will always win.
This implementation is based on the description and parameters used in:
Tillman, G., Van Zandt, T., & Logan, G. D. (2020). Sequential sampling models
without random between-trial variability: The racing diffusion model of
speeded decision making. Psychonomic Bulletin & Review, 27, 911-936.
doi:10.3758/s13423-020-01738-8
(specifically matching the WaldA
component
used within their RDM simulation).
References
Michael, J. R., Schucany, W. R., & Haas, R. W. (1976). Generating Random Variates Using Transformations with Multiple Roots. The American Statistician, 30(2), 88–90. doi:10.2307/2683801
Tillman, G., Van Zandt, T., & Logan, G. D. (2020). Sequential sampling models without random between-trial variability: The racing diffusion model of speeded decision making. Psychonomic Bulletin & Review, 27, 911-936. doi:10.3758/s13423-020-01738-8
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.