Package: dRiftDM 0.2.2

Valentin Koob

dRiftDM: Estimating (Time-Dependent) Drift Diffusion Models

Fit and explore Drift Diffusion Models (DDMs), a common tool in psychology for describing decision processes in simple tasks. It can handle both time-independent and time-dependent DDMs. You either choose prebuilt models or create your own, and the package takes care of model predictions and parameter estimation. Model predictions are derived via the numerical solutions provided by Richter, Ulrich, and Janczyk (2023, <doi:10.1016/j.jmp.2023.102756>).

Authors:Valentin Koob [cre, aut, cph], Thomas Richter [aut, cph], Markus Janczyk [aut]

dRiftDM_0.2.2.tar.gz
dRiftDM_0.2.2.tar.gz(r-4.5-noble)dRiftDM_0.2.2.tar.gz(r-4.4-noble)
dRiftDM_0.2.2.tgz(r-4.4-emscripten)dRiftDM_0.2.2.tgz(r-4.3-emscripten)
dRiftDM.pdf |dRiftDM.html
dRiftDM/json (API)
NEWS

# Install 'dRiftDM' in R:
install.packages('dRiftDM', repos = 'https://cloud.r-project.org')

Bug tracker:https://github.com/bucky2177/driftdm/issues1 issues

Pkgdown site:https://bucky2177.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

Conda:

cpp

3.48 score 203 downloads 35 exports 17 dependencies

Last updated 26 days agofrom:2e2d9b14b4. Checks:3 OK. Indexed: no.

TargetResultLatest binary
Doc / VignettesOKMar 04 2025
R-4.5-linux-x86_64OKMar 04 2025
R-4.4-linux-x86_64OKMar 04 2025

Exports:b_codingb_coding<-calc_statscoef<-comp_funscomp_funs<-component_shelfcondsconds<-ddm_optsddm_opts<-dmc_dmdrift_dmestimate_modelestimate_model_idsflex_prmsflex_prms<-get_example_fits_idsload_fits_idsmodify_flex_prmsobs_dataobs_data<-pdfsprms_solveprms_solve<-ratcliff_dmre_evaluate_modelsimulate_datasimulate_tracessimulate_valuessolversolver<-ssp_dmunpack_objunpack_traces

Dependencies:clicrayonDEoptimdfoptimgluehmslifecyclepkgconfigprettyunitsprogressR6rbibutilsRcppRdpackrlangvctrswithr

How to Convert DMC's parameters

Rendered fromconvert_dmc_parameters.Rmdusingknitr::rmarkdownon Mar 04 2025.

Last update: 2025-03-04
Started: 2025-03-04

How To Customize DDMs

Rendered fromcustomize_ddms.Rmdusingknitr::rmarkdownon Mar 04 2025.

Last update: 2025-03-04
Started: 2025-03-04

Introduction to dRiftDM

Rendered fromdRiftDM.Rmdusingknitr::rmarkdownon Mar 04 2025.

Last update: 2025-03-04
Started: 2025-03-04

Citation

Koob V, Richter T, Janczyk M (2024). dRiftDM: An R package for fitting non-stationary drift diffusion models. R package version 0.2.1.

Corresponding BibTeX entry:

  @Manual{,
    title = {dRiftDM: An R package for fitting non-stationary drift
      diffusion models},
    author = {Valentin Koob and Thomas Richter and Markus Janczyk},
    year = {2024},
    note = {R package version 0.2.1},
  }

Readme and manuals

dRiftDM

The package dRiftDM was developed to assist psychology researchers in applying and fitting diffusion models to empirical data within the R environment. Its most important feature is the ability to handle non-stationary problems, specifically diffusion models with time-dependent parameters. The package includes essential tools for standard analyses, such as building models, estimating parameters for multiple participants (individually for each participant), and creating summary statistics. The pre-built models available in the package are:

  • The Standard (Ratcliff) Diffusion Model (Ratcliff, 1978, Psychological Review)
  • The Diffusion Model for Conflict Tasks (Ulrich et al., 2015, Cognitive Psychology)
  • The Shrinking Spotlight Model (White et al., 2011, Cognitive Psychology)

Users can flexibly create custom models and utilize the dRiftDM machinery for estimating them.

Starting with version 0.2.0, model predictions (i.e., first-passage times) are derived by numerically solving the Kolmogorov-Forward Equation or a coupled set of integral equations, based on code provided by Richter et al. (2023, Journal of Mathematical Psychology).

Notes

Compared to the previous version 0.1.1, versions >0.2.0 make greater use of the S3 object system. Additionally, beginning with version 0.2.0, models use “flex_prms” objects to handle parameters across conditions.

To install the older version (0.1.1), you can use:

devtools::install_github("bucky2177/dRiftDM", ref = "0.1.1")

Installation

You can install the development version of dRiftDM from GitHub with:

# install.packages("devtools")
devtools::install_github("bucky2177/dRiftDM")

The CRAN version can be installed with:

install.packages("dRiftDM")

How to use dRiftDM

If you are interested in getting started with dRiftDM, we recommend reading the OSF pre-print. More information on functions and model customization can be found in dRiftDM’s vignettes. These vignettes are also available from the “Getting started” and “Articles” tabs on our Github.io page.

If you have any questions, feel free to contact us!

Help Manual

Help pageTopics
The Coding of the Boundariesb_coding b_coding.drift_dm b_coding.fits_ids_dm b_coding<- b_coding<-.drift_dm
Calculate Statisticscalc_stats calc_stats.data.frame calc_stats.drift_dm calc_stats.fits_ids_dm print.stats_dm print.stats_dm_list
Access Coefficients of a Modelcoef.drift_dm coef.fits_ids_dm coef<- coef<-.drift_dm print.coefs_dm
The Component Functions of A Modelcomp_funs comp_funs.drift_dm comp_funs.fits_ids_dm comp_funs<- comp_funs<-.drift_dm
Diffusion Model Componentscomponent_shelf
The Conditions of an Objectconds conds.data.frame conds.drift_dm conds.fits_ids_dm conds.traces_dm_list conds<- conds<-.drift_dm
Optional Arguments for the Component Functionsddm_opts ddm_opts.drift_dm ddm_opts<- ddm_opts<-.drift_dm
Create the Diffusion Model for Conflict Tasksdmc_dm
A synthetic data set with two conditionsdmc_synth_data
Create a drift_dm objectdrift_dm print.drift_dm
Estimate the Parameters of a drift_dm Modelestimate_model
Fit Multiple Individuals and Save Resultsestimate_model_ids
Flex_Prmsflex_prms flex_prms.drift_dm flex_prms.flex_prms flex_prms.numeric flex_prms<- flex_prms<-.drift_dm print.flex_prms
Auxiliary Function to create a fits_ids objectget_example_fits_ids
Plot Parameter Distribution(s)hist.coefs_dm
Load Estimates of a Fit Procedureload_fits_ids print.fits_ids_dm
Extract Log-Likelihood for a drift_dm ObjectlogLik.drift_dm
Extract Model Statistics for fits_ids_dm ObjectAIC.fits_ids_dm BIC.fits_ids_dm logLik.fits_ids_dm
Set Instructions to a flex_prms objectmodify_flex_prms modify_flex_prms.drift_dm modify_flex_prms.flex_prms
Get the Number of Observations for a drift_dm Objectnobs.drift_dm
The Observed Dataobs_data obs_data.drift_dm obs_data.fits_ids_dm obs_data<- obs_data<-.drift_dm
Access the Probability Density Functions of a Modelpdfs pdfs.drift_dm
Plot Conditional Accuracy Functions (CAFs)plot.cafs
Plot Delta Functionsplot.delta_funs
Plot Components of a Drift Diffusion Modelplot.drift_dm
Plot Quantilesplot.quantiles
Plot Multiple Statisticsplot.stats_dm_list
Plot Traces of a Drift Diffusion Modelplot.traces_dm plot.traces_dm_list
Summary and Printing for fits_ids_dm Objectsprint.summary.fits_ids_dm summary.fits_ids_dm
The Parameters for Deriving Model Predictionsprms_solve prms_solve.drift_dm prms_solve.fits_ids_dm prms_solve<- prms_solve<-.drift_dm
Create a Basic Diffusion Modelratcliff_dm
A synthetic data set with one conditionratcliff_synth_data
Re-evaluate the modelre_evaluate_model
Simulate Synthetic Responsessimulate_data simulate_data.drift_dm
Simulate Trajectories/Traces of a Modelprint.traces_dm print.traces_dm_list simulate_traces simulate_traces.drift_dm simulate_traces.fits_ids_dm
Simulate Traces for One Conditionssimulate_traces_one_cond
Simulate Valuessimulate_values
The Solver for Deriving Model Predictionssolver solver.drift_dm solver.fits_ids_dm solver<- solver<-.drift_dm
Create the Shrinking Spotlight Modelssp_dm
Summary for 'coefs_dm' Objectsprint.summary.coefs_dm summary.coefs_dm
Summary for 'drift_dm' Objectsprint.summary.drift_dm summary.drift_dm
Summarizing Flex Parametersprint.summary.flex_prms summary.flex_prms
Summary for 'stats_dm' Objectsprint.summary.cafs print.summary.delta_funs print.summary.fit_stats print.summary.quantiles print.summary.stats_dm print.summary.stats_dm_list print.summary.sum_dist summary.cafs summary.delta_funs summary.fit_stats summary.quantiles summary.stats_dm summary.stats_dm_list summary.sum_dist
Summary for traces_dm and traces_dm_list Objectsprint.summary.traces_dm print.summary.traces_dm_list summary.traces_dm summary.traces_dm_list
Exemplary Flanker Dataulrich_flanker_data
Exemplary Simon Dataulrich_simon_data
Unpack/Destroy dRiftDM Objectsunpack_obj unpack_obj.coefs_dm unpack_obj.stats_dm unpack_obj.stats_dm_list unpack_obj.traces_dm unpack_obj.traces_dm_list
Unpack/Destroy Traces Objectsunpack_traces unpack_traces.traces_dm unpack_traces.traces_dm_list