knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
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`. ### Parameterization of analysis notebooks 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 to `FALSE` when fitting the model to the data); * `optimize`: whether or not to optimize the parameter values (i.e. set to `FALSE` when only visualizing the data); * `pars_from_file`: whether to use parameter values stored on disk (i.e. set to `TRUE` 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 (see `NP` in `DEoptimR::JDEoptim` and `DEoptim::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 | | | | | | | ## Licenses Manuscript: CC-BY-4.0 [http://creativecommons.org/licenses/by/4.0/](http://creativecommons.org/licenses/by/4.0/) Code: MIT [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT), year: 2019, copyright holder: Bram B. Zandbelt ## Dependencies Below is the output of `sessionInfo()`, showing version information about R, the OS, and attached or loaded packages: ```r sessionInfo()
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 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.