# Time Bandits ## Table of Contents * [General info](#general-info) * [Data](#experimental-data) * [Behavioral Analyses](#behavioral-analyses) * [RL model](#rl-model) * [Model-based Analyses](#model-based-analyses) * [Other](#other) ## General info This repository contains all the code and (anonymized) data necessary for reproducing [Wu, Schulz, Pleskac, & Speekenbrink (*bioRxiv* 2021)](https://charleywu.github.io/downloads/wu2021time.pdf). The following text provides a summary of each file and it's function, with further comments provided throughout the code. ## Experiment data * Data/fullData.csv contains the anonymized participant data ## Behavioral Analyses * behavioralPlots.R contains the behavioral plots presented in the paper * behavioralRegressions.R contains the mixed effects regressions performed on the behavioral data ## RL model * models.R defines the RL models, specifically the Bayesian mean tracker (BMT) * generatebmtpredictions.R reads in participant data and generates predictions at each timepoint about the expected reward and uncertainty of each arm, based on the RL model (BMT). The predictions are saved in modelPreds/. In addition, BMTpredictionsPlot.R examines the pattern of predictions, separated by time pressure and payoff condition ## Model-based Analyses * hierarchicalSoftmax.R runs a softmax regression, using the model(s) defined in STANmodels/*.stan to predict choices as a function of the posterior means and variances estimated from generatebmtpredictions.R * hierarchicalRT.R runs a hierarchical regression predicting reaction time based on the posterior means and variances estimated from generatebmtpredictions.R. The model posteriors are stored in brmsModels/. * lba.R estimates a linear ballistic accumulator model using code from [Annis, Miller, \& Palmeri (2017)](https://link.springer.com/article/10.3758/s13428-016-0746-9), which is located in LBA/lba_single.stan. The parameter estimates of the LBA model are then analyzed and plottedin lbaParams.R. * analyseLBA.R fits a Bayesian mixed effects regression using the posterior means and variances estimated from generatebmtpredictions.R to predict the estimated drift rates estimated from lba.R, The model posteriors are stored in brmsModels/ * posteriorPlots.R puts together the results of all model-based analyses into a single plot (in addition to more detailed SI figures) * modelComparison.R is compares the different softmax models * modelInteractions.R visualized the different interactions of the RT and LBA regression models * modelsVsBehavior.R links the outcomes of the model-based analysis with behavioral patterns ## Other * statFormat.R is used to provide LaTeX formatted outputs for the statistical tests