cmdsddfeitc - Research compendium for the report on the cognitive mechanisms of the defer-speedup and date-delay framing effects in intertemporal choice by Zandbelt
The files at the URL above will generate the results as found in the preprint. The files hosted at https://github.com/bramzandbelt/cmdsddfeitc/ are the development versions and may have changed since the preprint was published.
Bram Zandbelt (bramzandbelt@gmail.com)
TBA
The packagae cmdsddfeitc
is a research compendium of the research project Cognitive Mechanisms of the Defer-Speedup and Date-Delay Framing Effects in Intertemporal Choice by Bram Zandbelt. This project was conducted at the Donders Institute, Radboud University / Radboucumc, Nijmegen, the Netherlands, and registered at the Donders Centre for Cognitive Neuroimaging under project number 3017051.01 (DCCN PI: Roshan Cools).
This research compendium contains all data, code, and text associated with the above-mentioned publication and is organized as follows:
.
├── R
├── analysis
│ ├── bash
│ └── notebooks
├── data
│ ├── derivatives
│ └── raw
├── documents
│ ├── content
│ └── context
├── figures
│ ├── 03_computational_modeling_analysis
│ ├── 04_sanity_check_control_trial_performance
│ ├── 05_eda_grp
│ ├── 06_model_comparison_grp
│ ├── 07_observed_vs_predicted_performance_grp
│ ├── 08_analysis_of_model_parameters
│ └── 09_sanity_check_effect_framing_on_model_predicted_auc
├── man
├── metadata
│ └── raw
├── packrat
│ ├── lib
│ ├── lib-R
│ ├── lib-ext
│ └── src
└── reports
│ ├── 01_preprocessing_idv
│ ├── 02_eda_idv
│ ├── 03_computational_modeling_analysis_idv
│ ├── 04_sanity_check_control_trial_performance_grp
│ ├── 05_eda_grp
│ ├── 06_model_comparison_grp
│ ├── 07_observed_vs_predicted_performance_grp
│ ├── 08_analysis_of_model_parameters_grp
│ └── 09_sanity_check_effect_framing_on_model_predicted_auc_grp
``
The `R/` directory contains:
- R code specific to the present project; functions are organized into files (e.g. functions for plotting are in `plot_functions.R`)
The `analysis/` directory contains:
- R Markdown notebooks implementing the analyses (`notebooks/` directory), numbered in the order in which they should be run;
- shell scripts running the R Markdown notebooks with appropriate parameters, if any (`bash/` directory).
The `data/` directory contains:
- the raw performance data (`raw/` directory);
- the data derived from the raw data (`derivatives/` directory), organized by notebook name.
The `documents/` directory contains:
- documents describing the content of the experimental data (`content/` directory), such as codebooks;
- documents describing the context of the data (`context/` directory), such as ethics documents, data management plan, and preregistration;
- documents related to the report of this research project (`manuscript/` directory).
The `figures/` directory contains:
- visualizations of descriptive and inferential statistics, organized by notebook name.
The `man/` directory contains:
- documentation of objects inside the package, generated by `roxygen2`.
The `packrat/` directory contains:
- R packages the research compendium depends on; for more info see [https://rstudio.github.io/packrat/](https://rstudio.github.io/packrat/).
The `reports/` directory contains:
- static HTML versions of the knitted R Markdown notebooks, organized by notebook name.
Finally, this research compendium is associated with a number of online objects, including:
| object | archived version | development version |
| ------ | -------------------------------- | -------------------------------- |
| preregistration | [https://osf.io/rzqh9/](https://osf.io/rzqh9/) | NA |
| data management plan | [https://doi.org/10.6084/m9.figshare.4720978](https://doi.org/10.6084/m9.figshare.4720978) | NA |
| stimulus presentation code | [https://doi.org/10.5281/zenodo.3243777](https://doi.org/10.5281/zenodo.3243777) | [github.com/bramzandbelt/itch_time_framing_task](github.com/bramzandbelt/itch_time_framing_task) |
| cognitive modeling code | [https://doi.org/10.5281/zenodo.3243806](https://doi.org/10.5281/zenodo.3243806) | [https://github.com/bramzandbelt/itchmodel](https://github.com/bramzandbelt/itchmodel) |
## How to use
This repository is organized as an R package, called `cmdsddfeitc`. The R package structure was used to help manage dependencies, to take advantage of continuous integration for automated code testing and documentation, and to be able to follow a standard format for file organization. The package `cmdsddfeitc` depends on other R packages and non-R programs, which are listed below under [Dependencies](#Dependencies).
To download the package source as you see it on GitHub, for offline browsing, use this line at the shell prompt (assuming you have Git installed on your computer):
Install `cmdsddfeitc` package from Github:
- From R:
devtools::install_github("bramzandbelt/cmdsddfeitc")
- From the command line:
git clone https://github.com/bramzandbelt/cmdsddfeitc.git ```
Once the download is complete, open the file cmdsddfeitc.Rproj
in RStudio to begin working with the package and compendium files. To reproduce all analyses, run the shell script analysis/bash/run_all_analyses.sh
. This will run all RMarkdown notebooks in correct order. Note, however, that this will not reproduce the computational modeling analyses performed in the document 03_computational_modeling_analysis.Rmd
), only the result of the optimizations. This is because optimization of all 708 models (59 participants (defer-speedup, N = 28; date-delay, N = 31), 6 parameterizations, 2 architectures) was done on a computer cluster and would take simply too long to run on a regular computer. In order to reproduce the computational modeling analyses, run 03_computational_modeling_analysis.Rmd
as a parameterized report with argument optimize=TRUE
.
The analyses can be customized, by specifying a number of parameters. Below is an overview of the parameters that can be set and the notebooks in which they are used.
participant_id
: the participant identifier (ranging from 1 to 93);task
: the task from which to process the data:defer_speedup
: intertemporal choice task with neutral, defer, and speedup frames;date_delay
: intertemporal choice task with delay and date frames;visualize
: whether or not to visualize the results (e.g. set toFALSE
when fitting the model to the data);optimize
: whether or not to optimize the parameter values (i.e. set toFALSE
when only visualizing the data);pars_from_file
: whether to use parameter values stored on disk (i.e. set toTRUE
when visualizing the data)algorithm
: specification of the optimization algorithm:DEoptim
: differential evolution algorithm with (lower and upper) bound constraints;DEoptimR
: differential evolution algorithm with (lower and upper) bound and nonlinear constraints (i.e. ensuring that P(LL choice|SS amount = 0) > 0.75 and P(LL choice| SS amount = LL amount) < 0.25);model_name
: name of the model class to fit to the data, can be any of the following:DDM
: Drift-diffusion model (fits choices and response times);DFT_CRT
: Decision field theory (fits choices and response times);DFT_C
: Decision field theory (fits choices only);parameterization
: name of the parameterization to fit to the data:time_scaling
: lets\kappa
parameter of the time function vary between frames;value_scaling
: lets\mu
parameter of the value function vary between frames;time_and_value_scaling
: lets\kappa
parameter of the time function and\mu
parameter of the value function vary between frames;time_scaling_t0
: lets\kappa
parameter of the time function and non-decision time (t0
) vary between frames;value_scaling_t0
: lets\mu
parameter of the value function and non-decision time (t0
) vary between frames;time_and_value_scaling_t0
: lets\kappa
parameter of the time function,\mu
parameter of the value function, and non-decision time (t0
) vary between frames;bound_setting
: controls the lower and upper bounds on the model parameters:standard
: uses parameter bounds specified in the preregistration document;wide
: uses wider parameter bounds, allowing parameters values to account for 'reverse' framing effects (e.g. more LL choices for delay than date frames);max_iter
: maximum iterations performed before optimization algorithm stops;rel_tol
: tolerance of the optimization algorithm's stopping criterion;n_pop_per_free_param
: number of population members per free parameter (seeNP
inDEoptimR::JDEoptim
andDEoptim::DEoptim.control
).
These parameter are used in the following analysis notebooks (indicated by their number only)
parameter | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 |
---|---|---|---|---|---|---|---|---|---|
participant_id |
X | X | X | ||||||
task |
X | X | X | X | X | X | |||
visualize |
X | X | X | ||||||
optimize |
X | ||||||||
pars_from_file |
X | ||||||||
algorithm |
X | X | X | X | X | ||||
model_name |
X | ||||||||
parameterization |
X | ||||||||
bound_setting |
X | ||||||||
max_iter |
X | ||||||||
rel_tol |
X | ||||||||
n_pop_per_free_param |
X |
Manuscript: CC-BY-4.0 http://creativecommons.org/licenses/by/4.0/
Code: MIT http://opensource.org/licenses/MIT, year: 2019, copyright holder: Bram B. Zandbelt
Below is the output of sessionInfo()
, showing version information about R, the OS, and attached or loaded packages:
sessionInfo()
#> R version 3.6.0 (2019-04-26)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Mojave 10.14.5
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] compiler_3.6.0 magrittr_1.5 htmltools_0.3.6 tools_3.6.0
#> [5] yaml_2.2.0 Rcpp_1.0.1 stringi_1.4.3 rmarkdown_1.13
#> [9] knitr_1.23 stringr_1.4.0 xfun_0.7 digest_0.6.19
#> [13] packrat_0.4.9-3 evaluate_0.14
Packrat takes care of dependencies.
Model optimization (notebook) was performed in R 3.5.1. on the Donders Institute computer cluster.
This research project was funded through European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 703141 to Bram B. Zandbelt and through a Vici grant from the Netherlands Organization for Scientific Research (NWO; grant number 453-14-015) to Roshan Cools. I thank Roshan Cools (RC) for financial support and constructive feedback. I thank Ben Marwick for inspiration on how to create, organize, and describe research compendia.
We specify the contribution of all people involved in the research (contributing non-authors included), according to the Contributor Role Taxonomy.
BBZ | RC | |
---|---|---|
Conceptualization | X | - |
Methodology | X | - |
Software | X | - |
Validation | X | - |
Formal analysis | X | - |
Investigation | X | - |
Resources | X | - |
Data curation | X | - |
Writing - original draft | X | - |
Writing - review and editing | X | - |
Visualization | X | - |
Supervision | X | - |
Project administration | X | - |
Funding acquisition | X | X |