PyDDM Cookbook¶
Here are a list of examples of common model features and how to implement them in PyDDM. If you created an example or model in PyDDM and would like it to be added to the cookbook, please send it to us so we can add it. Include the author(s) of the example or model and optionally a literature reference so that we can give you proper credit and direct users to your paper!
Download cookbook.py (all models in the cookbook)
Drift and noise¶
I want:
- A drift rate which changes over time (see “task paradigms” section above)
- Leaky or unstable integration
A general Ornstein-Uhlenbeck process
- A drift rate which depends linearly on a task parameter (e.g. coherence)
- A biased drift dependent on a task condition (e.g. reward or choice history)
- A leaky integrator with a drift rate which depends linearly on a task parameter (e.g. coherence)
- An urgency gain function
- Drift rate variability (uniform distribution)
- Drift rate or noise which depends on a moment-to-moment signal, unique to each trial
- Something else (Write your own, using these as a guide.)
Collapsing bounds (or time-varying bounds)¶
I instead want bounds which:
Are constant over time
Collapse linearly
Collapse exponentially
- Collapse exponentially after a delay
- Collapse according to a Weibull CDF
- Collapse according to a step function
- Vary based on task conditions, e.g. for a speed vs accuracy task
- Increase over time
- Something else (Write your own, using these as a guide)
Initial conditions¶
I don’t want my initial conditions to be A single point
positioned in the middle of the bounds
(the
default). Instead, I want my initial conditions to be:
- A single point
- A uniform distribution
A Gaussian distribution centered in the middle of the bounds
- A Cauchy distribution
A specific distribution which does not change based on task parameters
- Something else (Write your own, using these as a guide)
Non-decision time¶
I want to use a non-decision time which is:
Mixture models (Contaminant RTs)¶
I want to fit a distribution which has contaminant RTs distributed according to:
A uniform distribution
An exponential distribution (corresponding to a Poisson process)
- Something else (Write your own)
Task paradigms¶
Here are some examples of potential task paradigms that can be simulated with PyDDM.
Objective functions¶
I don’t want to use the default recommended objective function
(negative log likelihood
) but would rather
use:
Squared error
BIC
- Mean RT and P(correct)
- Something which takes undecided trials into account
- Something else (Write your own, using these as a guide)
(Note that changing the objective function to something other than likelihood will not speed up model fitting.)
Fitting methods¶
I don’t want to fit using the default recommended method (differential evolution), but would rather fit using:
(While using a fitting method other than differential evolution will likely reduce the time needed for fitting models, other methods may not offer robust parameter estimation for high-dimensional models.)
Models from specific papers¶
If you have a paper which used PyDDM, please send us your model so we can include them here!
- Shinn et al. (2020) - Confluence of timing and reward biases in perceptual decision-making dynamics
- Shinn et al. (2020) - A flexible framework for simulating and fitting generalized drift-diffusion models
- De Gee et al (2020) - Pupil-linked phasic arousal predicts a reduction of choice bias across species and decision domains
- Shinn et al. (2021) - Transient neuronal suppression for exploitation of new sensory evidence
Other recipes¶
I want to: