Anne C Smith

Software for Deep Brain Stimulation


A Bayesian statistical analysis of behavioral facilitation associated with deep brain stimulation, Journal of Neuroscience Methods (2009) Anne C Smith, Sudhin A Shah, Andrew E Hudson, Keith P Purpura, Jonathan D Victor, Emery N Brown and Nicholas D Schiff.  PDF


We include the software to run all four models presented in the paper on binary and binomial data sets using Matlab on a Windows computer. They are located in directories Binary and Binomial, respectively.  The data is specified in the script “getdata.m” in the each directory.  This is the file one would adjust to import a new data set.  Before the code can be run:

  1. Install Winbugs from http://www.mrc-bsu.cam.ac.uk/bugs/
  2. Download "matbugs.m" from http://www.cs.ubc.ca/~murphyk/Software/MATBUGS/matbugs.html

More details of setting up Winbugs etc are given below:

  1.  “The Tutorial” written for our behavioral learning algorithms in a zip file athttp://www.neurostat.mit.edu/behaviorallearning
  2.  Here


One known minor, easily-avoided problem:
Don’t install the code in a directory that has a very long name.  For example, Matbugs\WinBugs crashes if the source code is in a directory as follows:
C:\DocumentsandSettings\asmith.ANESTHOFFICE\MyDocuments\Projects\ JNeuroscienceMethods\code\Binary\]
Feel free to email asmith3142@gmail.com with any problems you encounter.

Binary Models

Download zipped binary directory 

The time series in “data.mat” is loaded into Matlab with the script “getdata.m” which also specifies the stimulation ON and OFF times.  The script asks the user whether they want to run a shortened version of the data shown in the paper.  (The code runs faster on the shorter data set making it easier to check your set-up is correct.)  Edit “getdata.m” to import new data.  The 4 models are run in Matlab using the 4 commands

>> runLRAB
>> runLRABC1
>> runLRABC2
>> runSTATESPACE

Binomial Models

Download zipped binomial directory 

Again the data is loaded with “getdata.m”.  Scripts are run with

>> runLRABBinomial;
>> runLRABC1Binomial;
>> runLRABC2Binomial;
>> runSTATESPACEBinomial;


This research was was supported by R01 MH-071847 (ENB, ACS), DP1 OD003646 (ENB), NS02172 (NDS) and IntElect Medical (NDS, KPP, SS).