Data and Matlab code used to produce figures in "A causal role for right frontopolar cortex in directed, but not random, exploration"

Raw data is in: TMS_horizonTask.csv 
Each row corresponds to a single game.  Each column corresponds to a separate variable

* expt_name - stimulation condition = "vertex" or "RFPC"
* replicationFlag - 0 for first set of subjects, 1 for second set.
* subjectID - subject number
* order - stimulation order
* age - participant age in years
* iswoman - participant gender 1 for female, 0 for male
* sessionNumber - 1 or 2
* game - game number in experiment
* gameLength - number of trials in this game, including four forced trials
* uc - uncertainty condition, number of times option 2 is played in forced trials
* m1 - true mean of option 1
* m2 - true mean of option 2
* r1, r2, etc ... - reward outcome on each trial, = nan if no outcome (e.g. on trial 6 in horizon 1 games)
* c1, c2, etc ... - choice on trial t, 1 for left, 2 for right
* rt1, rt2, etc ... - reaction time on trial t in seconds


To generate figures from paper run: main_TMSanalysis_v3.m

Note: to run the model-based analysis requires JAGS and matjags to be installed