## Instructions for Use ##
This component contains the data and analysis scripts for Experiment 1 reported in our Journal of Neurophysiology paper.
Contents:
**Exp1_SubjectExclusionLog** is a record of which subjects were excluded from our final sample (and were therefore replaced).
**SpatialWM_LongDelay.m** is the script used to run the experiment (this script requires PsychToolbox; see http://psychtoolbox.org/; Brainard, 1997; Pelli, 1997).
**AnalysisScripts** – this folder contains all analysis scripts needed to reproduce the analyses in the paper.
**Data** – this folder contains the behavior data files. This folder is also the destination for all files generated by the analysis scripts.
**EEG** – this folder contains the segmented EEG data.
You can find more detailed descriptions of the contents of each of these folders in the sections below.
You should download these three folders and save them in the same place. All scripts in the ‘AnalysisScripts’ folder will run from within that folder as long as it is saved in the same folder as the ‘Data’ and ‘EEG’ folders.
----------
## 'AnalysisScripts' folder ##
This folder contains the analysis and plotting scripts used for our paper. Here is a brief description of what each script does:
**fitMixModel:** Fit mixture model to behavioral response errors using MemToolbox. (http://visionlab.github.io/MemToolbox/; Suchow, Brady, Fougnie, & Alvarez, 2013).
**SpatialEM:** Runs the spatial encoding model on alpha-band (8-12 Hz) activity.
**SpatialEM_DeltaBasis:** Runs the spatial encoding model on alpha-band activity using a delta basis function.
**SpatiaEM_AllFs:** Runs the spatial encoding model on 1-Hz frequency bands from 4-29 Hz.
**SpatialEM_HighFs:** Run the spatial encoding model on 1-Hz frequency bands from 30-50 Hz.
**SpatialEM..._Permute:** SpatialEM scripts ending in ‘Permute’ runs the relevant spatial encoding model routine 1000 times, each time with the location bin labels permuted within each analysis block. The output of these scripts is the basis for the permutation tests we report in the paper.
**calculateSlopes_...** Calculate CTF slope metric for the both the unpermuted (output of the SpatialEM…) and permuted (output of SpatialEM_...Permute) data.
**PermTest_...** Use the output of the calculateSlopes scripts to run the permutation test using the CTF slope metric.
**baselineEOG:** create baselined EOG data files (baselined to 500 ms prestimulus period) for the eye movement control analysis.
**EyeMovementControl:** Run the eye movement control analysis.
**plot_EyeMovementControl:** Plot the eye movement control analysis (see Fig 5 in the paper).
**PlotFig3_CTFbyBins:** Use the output of SpatialEM.m to plot the mean delay period channel responses for each location bin separately (see Fig 3 in the paper).
**bootstrapSEs:** bootstrap standard error bars for time-averaged CTF (see Fig 4A & B in the paper).
**plot_bootstrapSEs:** plot output of bootstrapSEs (see Fig 4 in the paper).
**plotTimexFreq:** plot the results of the time x frequency search (see Fig 2 in the paper). Uses output of permTest_AllFs and permTest_HighFreqs.
**eegfilt:** EEGLAB’s filtering function (http://sccn.ucsd.edu/eeglab/; Delorme & Makeig, 2004).
**shadedPlot:** the function used for generating shaded error bars (retrieved from: http://www.mathworks.com/matlabcentral/fileexchange/18738-shaded-area-plot/content/shadedplot.m).
----------
## 'Data' folder ##
This folder contains the behavior data for each subject. The file for each subject includes the following variables:
**beh.trial.pos:** the exact angular location of the sample stimulus (0-359 degrees) for each trial. 0 degrees is 3 O’Clock.
**beh.trial.posBin:** the location bin the stimulus was drawn from for each trial. Each bin spanned 45 degrees. Bins were centered at 0 degrees, 45 degrees, 90 degrees, etc.
**beh.trial.error:** error offset for each trial (i.e., the angular difference between the reported and presented angular location).
For the subject that were excluded from the final sample, the filenames end in “_Behavior_REJECT.mat”
For the subjects that were included in the final sample, the filenames end in “_MixModel_wBias.mat” and also include the estimated model parameters:
**beh.sd:** the estimated sd parameter for the mixture model.
**beh.pf:** the estimated pf parameter for the mixture model.
**beh.mu:** the estimated mu parameter for the mixture model.
----------
## 'EEG' folder ##
This folder contains the EEG data for each subject. The file for each subject includes the following variables:
**eeg.data:** a Trials x Electrodes x Samples matrix of segmented EEG data.
**eeg.chanLabels:** the names of the electrodes recorded from.
**eeg.arf.artIndCleaned:** index of trials with artifacts (1 = artifact, 0 = clean trial).
**eeg.preTime:** the start of the segment in milliseconds relative to onset of the sample stimulus.
**eeg.postTime:** the end of the segment in milliseconds relative to onset of the sample stimulus.
**eeg.sampRate:** sampling rate in Hz.
A brief note on our artifact rejection procedures…
In these experiments, participants were replaced if more than 25% of trials were lost due to recording or ocular artifacts, and/or if the participant did not complete all trials during the session.
Our artifact rejection procedure involved two steps:
**Step 1:** We applied an automated artifact detection algorithm.
**Step 2:** We manually inspected the data to ensure that automatic routine was catching artifacts and was not throwing away clean trials. Usually, we inspect all trials and correct any errors the automatic routine made. However, for some subjects with a lot of artifacts, we did not inspect all trials because it was clear early on that the automated routine correctly identified a lot of artifacts. These subjects are marked as “not fully hand cleaned” in the subject exclusion log files.