Learn R Programming

ream (version 1.0-10)

DDM: 7 Parameter Drift Diffusion Model

Description

Density (PDF), distribution function (CDF), and random sampler for the 7 parameter drift diffusion model (DDM).

Usage

dDDM(rt, resp, phi, x_res = "default", t_res = "default")

pDDM(rt, resp, phi, x_res = "default", t_res = "default")

rDDM(n, phi, dt = 1e-05)

Value

For the density a list of PDF values, log-PDF values, and the sum of the log-PDFs, for the distribution function a list of of CDF values, log-CDF values, and the sum of the log-CDFs, and for the random sampler a list of response times (rt) and response thresholds (resp).

Arguments

rt

vector of response times

resp

vector of responses ("upper" and "lower")

phi

parameter vector in the following order:

  1. non-decision time distribution. Must be an integer of either 0 = delta distribution (i.e., single point), 1 = uniform distribution, 2 = truncated normal distribution, or 3 = inverse Gauss distribution.

  2. Mean non-decision time (\(t_{nd}\)). Time for non-decision processes such as stimulus encoding and response execution. Total decision time t is the sum of the decision and non-decision times.

  3. Width of non-decision time (\(s_{t_{nd}}\)). If the non-decision time distribution is delta (0) then this value is ignored, if it is 1 (uniform) then this value is half of the range, if it is truncated normal (2) then this value is is the standard deviation, and if it is inverse Gauss (3) then this value is the shape (\(\lambda\)).

  4. relative start distribution. Must be an integer of either 0 = delta distribution (i.e., single point), 1 = uniform distribution, or 2 = truncated normal distribution.

  5. Mean relative start (\(w\)). Sets the start point of accumulation as a ratio of the two decision thresholds. Related to the absolute start z point via equation \(z = b_l + w*(b_u - b_l)\).

  6. Width of the relative start (\(s_w\)). If the relative start distribution is delta (0) then this value is ignored, if it is uniform (1) then this value is half of the range and if it is truncated normal (2) then this value is the standard deviation.

  7. Stimulus strength distribution. Must be an integer of either 0 = uniform distribution or 1 = normal distribution.

  8. Mean stimulus strength (\(\mu\)). Strength of the stimulus and used to set the drift rate. For the DDM, \(v(x,t) = \mu\).

  9. Width of stimulus strength (\(s_{\mu}\)). If the distribution is uniform (0) then this value is half of the range and if it is normal (1) then this value is the standard deviation.

  10. Noise scale (\(\sigma\)). Model scaling parameter.

  11. Decision thresholds (\(b\)). Sets the location of each decision threshold. The upper threshold \(b_u\) is above 0 and the lower threshold \(b_l\) is below 0 such that \(b_u = -b_l = b\). The threshold separation \(a = 2b\).

  12. Contamination (\(g\)). Sets the strength of the contamination process. Contamination process is a uniform distribution \(f_c(t)\) where \(f_c(t) = 1/(g_u-g_l)\) if \(g_l <= t <= g_u\) and \(f_c(t) = 0\) if \(t < g_l\) or \(t > g_u\). It is combined with PDF \(f_i(t)\) to give the final combined distribution \(f_{i,c}(t) = g*f_c(t) + (1-g)*f_i(t)\), which is then output by the program. If \(g = 0\), it just outputs \(f_i(t)\).

  13. Lower bound of contamination distribution (\(g_l\)). See parameter \(g\).

  14. Upper bound of contamination distribution (\(g_u\)). See parameter \(g\).

x_res

spatial/evidence resolution

t_res

time resolution

n

number of samples

dt

step size of time. We recommend 0.00001 (1e-5)

Author

Raphael Hartmann & Matthew Murrow

References

Ratcliff, R. (1978). A theory of memory retrieval. Psychological Review, 85(2), 59-108.

Ratcliff, R., & McKoon, G. (2008). The Diffusion Decision Model: Theory and Data for Two-Choice Decision Tasks. Neural Computation, 20(4), 873-922.

Examples

Run this code
# Probability density function
dDDM(rt = c(1.2, 0.6, 0.4), resp = c("upper", "lower", "lower"),
     phi = c(1, 0.3, 0.05, 1, 0.586, 0.174, 1, 1.0, 2.0, 1.0, 0.75, 0.0, 0.0, 1.0))

# Cumulative distribution function
pDDM(rt = c(1.2, 0.6, 0.4), resp = c("upper", "lower", "lower"),
     phi = c(1, 0.3, 0.05, 1, 0.586, 0.174, 1, 1.0, 2.0, 1.0, 0.75, 0.0, 0.0, 1.0))

# Random sampling
rDDM(n = 100, phi = c(1, 0.3, 0.05, 1, 0.586, 0.174, 1, 1.0, 2.0, 1.0, 0.75, 0.0, 0.0, 1.0))

Run the code above in your browser using DataLab