Adapting the Conditional Cooperation Model: Evaluating its Application in One-shot Public Goods Games
This repository contains the code for my exam project in the course 'Decision making' as a part of my Master in Cognitive Science, Aarhus University.
Start by cloning the repository to your local machine using the following command:
$ git clone "https://github.com/SMosegaard/DecisionMaking_exam.git"
$ cd DecisionMaking_exam/srcInstall JAGS using the following command:
$ sudo apt update
$ sudo apt install jagsTo restore the package environment, run the following command in your R console:
$ renv::restore()Once the environment is restored, you are ready to run the analysis. Below are the steps for different stages of the project:
Run the following scripts to perform parameter recovery for both models:
$ Rscript hier_CC_recovery.R
$ Rscript hier_CC_recovery_no_rho.RTo perform parameter estimation for both models, use:
$ Rscript group_estimation.R
$ Rscript group_estimation_no_rho.RFinally, run these scripts to perform group comparison:
$ Rscript group_comparison.R
$ Rscript group_comparison_no_rho.RThe project structure is as follows:
.
├── jags_output/ # Contains BUGS objects, MPD values, and summary tables
├── plots/ # Stores all plots generated by the scripts in the src/ folder
├── renv/ # The reproducible environment for the R project
├── src/ # Includes the main R scripts for parameter recovery, estimation, and group comparison
├── CC.R
├── CC_no_rho.R
├── CC.txt
├── CC_no_rho.txt
├── hier_CC_recovery.R
├── hier_CC_recovery_no_rho.R
├── group_estimation.R
├── group_estimation_no_rho.R
├── group_comparison.txt
├── group_comparison_no_rho.txt
├── group_comparison.R
├── group_comparison_no_rho.R
└──plot_functions.R
├── .gitignore
├── DecisionMaking_exam.Rproj
└── README.md
- R version: This project was developed and tested using R version 4.4.1 To check your current R version, run
R --versionin your terminal. - Platform: This analysis was written and executed on the interactive HPC system UCloud using a standard machine with 8 CPU. Performance may vary depending on your system specifications.
- Run time: The parameter recovery step will take around 1.5 hour per model to complete, while the parameter estimation and group comparison scripts run significantly faster, typically just a few minutes.