superstats.simulation.cognitive.ddm#
Diffusion Decision Model simulator.
Functions
|
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:
- v
np.ndarrayofshape(num_steps,) Drift rates for each trial.
- a
np.ndarrayofshape(num_steps,) Boundary separation for each trial; decision boundaries are at 0 (lower) and a (upper).
- tau
np.ndarrayofshape(num_steps,) Non-decision times for each trial.
- bias
np.ndarrayofshape(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).
- sigma
float,optional, default: 1.0 Diffusion noise standard deviation.
- dt
float,optional, default: 0.001 Time step size.
- max_steps
int,optional, default: 10000 Maximum number of diffusion steps per trial before timing out.
- v
- Returns:
- data
dictofnp.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,).
- data
- Parameters:
- Return type: