Skip to content

Adding 5-Parameter Drift Diffusion Model (DDM) PDF and CDF to Stan Math #2584

@kendalfoster

Description

@kendalfoster

Description

Ratcliff's Diffusion Decision Model (DDM) is a popular model for jointly modelling binary responses and their associated response times. The DDM exists in several parameterizations, and currently Stan Math contains the PDF of the 4-parameter variant (i.e., the parameters for threshold separation, non-decision time, relative starting point of the diffusion process, and drift rate of the diffusion process) via the function wiener_lpdf(). This issue proposes to add the 5-parameter variant of the DDM (i.e., including the parameter for inter-trial variability in the drift rate) to Stan Math by adding the new functions ddm_lpdf() and ddm_lcdf().

I am submitting a pull request to add these two new functions (ddm_lpdf() and ddm_lcdf()). Both functions accept the following parameters: response time, response, threshold separation, drift rate, non-decision time, relative starting point, inter-trial variability in the drift rate. This pull request has been discussed in this Discourse thread.

Example

An example call to the (logged) PDF is ddm_lpdf(1, 1, 1, -1, 0, 0.5, 0.1) and would return the log of the PDF.
An example call to the (logged) CDF is ddm_lcdf(1, 1, 1, -1, 0, 0.5, 0.1) and would return the log of the CDF.

Expected Output

We should expect the example call to ddm_lpdf(1, 1, 1, -1, 0, 0.5, 0.1) to return 0.02250968.
We should expect the example call to ddm_lcdf(1, 1, 1, -1, 0, 0.5, 0.1) to return 0.7264627.

Current Version:

v4.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions