Diffusion Decision Model
Two-choice response times: noisy evidence drifts between two boundaries until it reaches one
No task setting enters the likelihood. A trial is one response time and one of two responses; the density uses those two and nothing else about the trial.
drift favours the upper response (1), a negative one the lower (0); the larger it is in size, the faster and more consistent the responses. At the start, drift = 0 gives P(upper) = 0.5; drift = 1 raises it to 0.73 and shortens the mean response time from 0.47 s to 0.45 s.bound gives slower responses that more often follow the drift: speed traded for accuracy. At drift = 0, the start, only the slowing shows: bound 1 → 2 moves the mean response time from 0.47 s to 1.22 s. At drift = 1 the same step also raises P(upper) from 0.73 to 0.88.drift = 0, moving zr from 0.5 to 0.7 raises P(upper) from 0.5 to 0.7 and shortens the mean upper response time from 0.47 s to 0.39 s.bound from 0.22 to 4.48, the other parameters as set;
circle: now. Dashed: prior means.What the model says
The diffusion decision model (DDM; Ratcliff, 1978; Ratcliff & McKoon, 2008) describes a two-choice decision as the accumulation of noisy evidence. Evidence starts at zr × bound, moves on average at rate drift with noise of standard deviation 1 per second, and the decision is made when it first reaches the upper boundary at bound (response 1) or the lower boundary at 0 (response 0). The response time adds the non-decision time ndt, for encoding the stimulus and executing the response. drift is the quality of the evidence; a positive drift favours the upper response, a negative one the lower. bound is how much evidence the participant waits for, and zr is a bias toward one response before any evidence arrives.
For a response at the lower boundary at decision time \(t\) = rt − ndt, with \(v\) = drift, \(a\) = bound and \(z_r\) = zr, the density is
\[ f_0(t) = \frac{\pi}{a^2}\, e^{-v a z_r - v^2 t / 2} \sum_{k=1}^{\infty} k\, e^{-k^2 \pi^2 t / (2 a^2)} \sin(k \pi z_r), \]
and \(f_1(t)\), the density at the upper boundary, is the same with \(v\) replaced by \(-v\) and \(z_r\) by \(1 - z_r\): the same process seen upside down. Each of the two is a defective density: its area is the probability of that response, and the two areas sum to 1. The noise per unit time, s, is fixed at 1 in bmm; it sets the scale on which the other parameters are measured.
The task
One trial is a choice between two responses, with the response time recorded: a brightness or a lexical decision, for example. bmm codes the responses 0 (lower) and 1 (upper); which response is which is the analyst’s choice, often correct as 1 and error as 0. The task panel draws five evidence paths from the same start under the current parameters, with the noise of each path held fixed while the sliders move. Paths that end at the upper boundary are blue, those that end at the lower boundary orange. The grey band is the non-decision time, the dashed line is the mean path, the start plus drift × time, and the bracket on the right marks bound. The paths illustrate the process; they are not data.
Explore
The density panel shows the two defective densities, upper responses above the axis and lower responses below. Raising drift moves area from the lower to the upper density. Moving it away from 0, in either direction, makes both faster: the response-time distribution of each response depends on the size of drift, not on its sign. Raising bound makes both slower and more spread out and, for a drift other than 0, moves area toward the response the drift favours. ndt shifts both densities without changing their shape. Moving zr toward 1 makes upper responses more frequent and faster and lower responses rarer and slower. P(upper), the probability of response 1, and the mean response times in the readout come from exact formulas for this process, the same ones the EZ diffusion page uses.
Slider ranges come from bmm’s default priors for ddm(). bound is estimated on the log scale with a normal(0, 0.5) prior, ndt on the log scale with normal(−1.5, 0.5), and zr on the logit scale with normal(0, 0.5); each slider spans the prior mean ± 3 SD: bound from 0.22 to 4.48, ndt from 0.05 to 1 s, zr from 0.18 to 0.82. drift has an identity link and a cauchy(0, 1) prior, which has no standard deviation; its slider spans the location ± 3 scale, from −3 to 3. The sliders start at the prior means (dashed): drift = 0, bound = 1, ndt = 0.22 s, zr = 0.5. With no drift and the start in the middle, both responses are equally likely.
Across task settings
The likelihood of ddm() has no task-setting variable. Conditions of an experiment, for example easy and hard stimuli or instructions to be fast or accurate, enter only if the bmm formula lets the parameters differ between them, as in drift ~ 0 + difficulty. What the model then predicts in each condition follows from the estimated parameters.
Speed and accuracy are both outcomes of the same parameters, and the panel Speed and accuracy as bound changes shows how they trade. As bound grows from 0.22 to 4.48 with the other parameters fixed, the mean response time grows, and P(upper) moves toward 1 for a positive drift (toward 0 for a negative one). With drift at 0 the line is flat: waiting for more evidence costs time and buys no accuracy, because the evidence favours neither response. bmm’s DDM article reads bound as response caution, the parameter behind a speed/accuracy trade-off, and drift as the quality of the evidence or the difficulty of the task.
In bmm
The code updates with the controls. ddm() defines the model, dddm() returns the log density of response times and responses, and bmf() writes the formula for bmm(), which estimates the parameters from trial-level data; my_data stands for your own data, and fitting runs Stan through brms. The comment under the dddm() call holds the values this page computes for it. dddm() calls rtdists::ddiffusion(), which sums either the series above or a second series that converges faster at short decision times, whichever needs fewer terms, and stops after enough terms for an absolute error of about 10⁻⁶ in the density. Where a density is very small, far in a tail, an error of that size is large against the value, so the cut-off decides it; this page follows the same rule, so it shows what bmm returns. See the DDM article for the full model and the reference pages for ddm() and dddm().