Learn R Programming

rtdists (version 0.2-6)

LBA: The linear Ballistic Accumulator (LBA)

Description

Density, distribution function, and random generation for the LBA model with the following parameters: A (upper value of starting point), b (response threshold), t0 (non-decision time), and driftrate (v). All functions are available with different distributions underlying the drift rate: Normal (norm), Gamma (gamma), Frechet (frechet), and log normal (lnorm).

Usage

dlba_norm(t, A, b, t0, mean_v, sd_v, posdrift = TRUE, robust = FALSE)

plba_norm(t, A, b, t0, mean_v, sd_v, posdrift = TRUE, robust = FALSE)

rlba_norm(n, A, b, t0, mean_v, sd_v, st0 = 0, posdrift = TRUE)

dlba_gamma(t, A, b, t0, shape_v, rate_v, scale_v)

plba_gamma(t, A, b, t0, shape_v, rate_v, scale_v)

rlba_gamma(n, A, b, t0, shape_v, rate_v, scale_v, st0 = 0)

dlba_frechet(t, A, b, t0, shape_v, scale_v)

plba_frechet(t, A, b, t0, shape_v, scale_v)

rlba_frechet(n, A, b, t0, shape_v, scale_v, st0 = 0)

dlba_lnorm(t, A, b, t0, meanlog_v, sdlog_v, robust = FALSE)

plba_lnorm(t, A, b, t0, meanlog_v, sdlog_v, robust = FALSE)

rlba_lnorm(n, A, b, t0, meanlog_v, sdlog_v, st0 = 0)

Arguments

t
a vector of RTs.
A
start point interval or evidence in accumulator before beginning of decision process. Start point varies from trial to trial in the interval [0, A] (uniform distribution). Average amount of evidence before evidence accumulation across trials
b
response threshold. (b - A/2) is a measure of "response caution".
t0
non-decision time or response time constant (in seconds). Average duration of all non-decisional processes (encoding and response execution).
mean_v,sd_v
mean and standard deviation of normal distribution for drift rate (norm). See Normal
posdrift
logical. Should driftrates be forced to be positive? Default is TRUE. (Uses truncated normal for random generation).
robust
logical. Should robust normal distributions be used for norm and lnorm? Can be helpful in rare cases but is approximately three times slower than the non-robust versions. Default is FALSE.
n
desired number of observations (scalar integer).
st0
variability of non-decision time. Uniformly distributed around t0 + st0 (i.e., t0 is the lower bound). Only available in random number generation functions rlba_.
shape_v,rate_v,scale_v
shape, rate, and scale of gamma (gamma) and scale and shape of Frechet (frechet) distributions for drift rate. See GammaDist or frechet

Value

  • All functions starting with a d return the density (PDF), all functions starting with p return the distribution function (CDF), and all functions starting with r return random response times and responses (in a data.frame).

Details

For random number generation at least one of the distribution parameters (i.e., mean_v, sd_v, shape_v, scale_v, rate_v, meanlog_v, and sdlog_v) should be of length > 1 to receive RTs from multiple responses. Shorter vectors are recycled as necessary. Note that for random number generation from a normal distribution for the driftrate the number of returned samples may be less than the number of requested samples if posdrifts==FALSE.

References

Brown, S. D., & Heathcote, A. (2008). The simplest complete model of choice response time: Linear ballistic accumulation. Cognitive Psychology, 57(3), 153-178. doi:10.1016/j.cogpsych.2007.12.002 Donkin, C., Averell, L., Brown, S., & Heathcote, A. (2009). Getting more from accuracy and response time data: Methods for fitting the linear ballistic accumulator. Behavior Research Methods, 41(4), 1095-1110. doi:10.3758/BRM.41.4.1095 Heathcote, A., & Love, J. (2012). Linear deterministic accumulator models of simple choice. Frontiers in Psychology, 3, 292. doi:10.3389/fpsyg.2012.00292

Examples

Run this code
## random number generation using different distributions for v:
rlba_norm(10, A=0.5, b=1, t0 = 0.5, mean_v=c(1.2, 1), sd_v=c(0.2,0.3))
rlba_gamma(10, A=0.5, b=1, t0 = 0.5, shape_v=c(1.2, 1), scale_v=c(0.2,0.3))
rlba_frechet(10, A=0.5, b=1, t0 = 0.5, shape_v=c(1.2, 1), scale_v=c(0.2,0.3))
rlba_lnorm(10, A=0.5, b=1, t0 = 0.5, meanlog_v=c(1.2, 1), sdlog_v=c(0.2, 0.3))

# use somewhat plausible values for plotting:
A <- 0.2
b <- 0.5
t0 <- 0.3

# plot density:
curve(dlba_norm(x, A=A, b=b, t0=t0, mean_v = 1.0, sd_v = 0.5), ylim = c(0, 4),
      xlim=c(0,3), main="Density/PDF of LBA versions", ylab="density", xlab="response time")
curve(dlba_gamma(x, A=A, b=b, t0=t0, shape_v=1, scale_v=1), add=TRUE, lty = 2)
curve(dlba_frechet(x, A=A, b=b, t0=t0, shape_v=1,scale_v=1.0), add=TRUE, lty = 3)
curve(dlba_lnorm(x, A=A, b=b, t0=t0, meanlog_v = 0.5, sdlog_v = 0.5), add=TRUE, lty = 4)
legend("topright", legend=c("Normal", "Gamma", "Frechet", "Log-Normal"), 
      title = expression("Distribution of"~~italic(v)), lty = 1:4)


# plot cdf:
curve(plba_norm(x, A=A, b=b, t0=t0, mean_v=1.0, sd_v=1.0), 
      xlim = c(0, 3),ylim = c(0,1), 
      ylab = "cumulative probability", xlab = "response time",
      main = "Distribution/CDF of LBA versions")
curve(plba_gamma(x, A=A, b=b, t0=t0, shape_v=1,scale_v=1), add=TRUE, lty = 2)
curve(plba_frechet(x, A=A, b=b, t0=t0, shape=1, scale=1), add=TRUE, lty = 3)
curve(plba_lnorm(x, A=A, b=b, t0=t0, meanlog_v=0.5, sdlog_v = 0.5), add=TRUE, lty = 4)
legend("bottomright", legend=c("Normal", "Gamma", "Frechet", "Log-Normal"), 
       title = expression("Distribution of"~~italic(v)), lty = 1:4)

Run the code above in your browser using DataLab