superstats.simulation.cognitive.ddm#

Diffusion Decision Model simulator.

Functions

sample_ddm(v, a, tau, bias[, sigma, dt, ...])

Sample from the Diffusion Decision Model (DDM) for decision making.

superstats.simulation.cognitive.ddm.sample_ddm(v, a, tau, bias, sigma=1.0, dt=0.001, max_steps=10000)[source]#

Sample from the Diffusion Decision Model (DDM) for decision making.

This function simulates decision processes using the DDM, where evidence accumulates over time with drift rate v, boundary separation a, and noise. The simulation stops when a boundary is reached or max_steps is exceeded.

Parameters:
vnp.ndarray of shape (num_steps,)

Drift rates for each trial.

anp.ndarray of shape (num_steps,)

Boundary separation for each trial; decision boundaries are at 0 (lower) and a (upper).

taunp.ndarray of shape (num_steps,)

Non-decision times for each trial.

biasnp.ndarray of shape (num_steps,)

Starting point, as a fraction of a (i.e. the initial evidence is bias * a). 0.5 starts at the midpoint between the two boundaries; values > 0.5 start closer to the upper boundary, values < 0.5 closer to the lower one. Must lie in (0, 1).

sigmafloat, optional, default: 1.0

Diffusion noise standard deviation.

dtfloat, optional, default: 0.001

Time step size.

max_stepsint, optional, default: 10000

Maximum number of diffusion steps per trial before timing out.

Returns:
datadict of np.ndarray

Named decision data. “response_time” contains response times (or -1.0 on timeout) and “choice” contains choices (1.0 for the upper boundary, 0.0 for the lower boundary, -1.0 on timeout). Each array has shape (num_steps,).

Parameters:
Return type:

dict[str, ndarray]