This repository contains all the code and (anonymized) data necessary for reproducing Wu, Schulz, & Gershman (Computational Brain and Behavior 2021). The following text provides a summary of each file and it's function, with further comments provided throughout the code.
exp1/contains a csv of the (anonymized) experiment dataexperiment1Full.csvandgraphs.jsondefines the graph structures used in experiment 1banditTask/contains a csv of the (anonymized) experiment datanetworkBandit.csvandnetwork2.jsondefines the graph structures used in experiment 2
brmsModels/contains Bayesian mixed effects models. Becuase of the file sizes being potentially larger than the maximum allowed limit in github, all*.brmfiles are tracked usinggit-lfs. Please refer to the git-lfs manual to install lfs and pull these filesmodelResults/contains the individual cross-validated maximum likelihood estimates from Exp 1 (Exp1/) and Exp 2 (networkBandit/). It also containsmodelFit.csvandparamEstimates.csvas the compiled dataframes describing the model results in Exp 2 for convenience. In addition,Exp1diffevidence.csvandExp2diffevidence.csvcontain the log loss of each model for computing the protected exceedence probabilities, which is then saved asExp1PXP.csvandExp2PXP.csv. Lastly, the model-based analyses of the bonus from from Exp 2 are here for covenience asBanditBonusRoundmodelDF.Rdsplots/contains plots for the paper, where the code will save each plotrationalModels/contains data used in the model simulations for Experiment 2.parameters/holds dataframes for the parameter estimates of each model, where the model simulation (modelSimulations.R) are saved as csv filesutilities.Rcontains data preprocessing functions for each experiment and various vector operations that are used across multiple scriptsstatisticalTests.Rcontains code for performing t-tests and correlations, where the output is formatted for Latex and automatically converted to a set number of significant digits for consistency. Contains code from van Doorn et al., (2018) for computing the Bayes factor for Kendall's rank correlation paperexportImportGraph.Rcontains code by Angelo Antonio Salatino for impoirting and exporting igraph objects as json: original github repomodels.Rcontains code defiing models used in both experiments
Exp1Behavior.Rcontains all the behavioral analysesExp1ModelCV.Rcontains code for model fittingExp1ModelingResults.Rcontains code for all model-based analyses
banditExpBehaviorPlots.Rcontains all the behavioral analysesbanditModelComparisonCV.Rcontains code for model fittingbanditExpBehaviorPlots.Rcontains code for model-based analysesmodelSimulations.Rcontains code for computing the simulated learning curvesbanditBonus.Rcontains code used for analyzing the bonus round data
- We provide two different versions of code in both Matlab and Python for computing the protected probability of exceedence (pxp), each producing equivalent results in our analysis.
- The Matlab version is from Sam Gershman, where
analysis/bms.mcontains the code for computing pxp, whileanalysis/pxp.mdefines the input and output files - The Python version is from Sichao Yang, where
analysis/bms.pycontains the code for computing pxp andPXP.ipynbis an interative notebook that loads the inputs and runs it