Software for Bayesian analysis of interleaved learning

Anne C Smith,

This page outlines how to estimate learning curves using Winbugs from Matlab. The script files generate Figures 1 and 2 in Smith, Wirth, Suzuki and Brown (Bayesian Analysis of Interleaved Learning and Bias in Behavioral Experiments, J. Neurophys., 2006).

Before the code can be run:

  1. Install Winbugs from

  2. Download "matbugs.m" from

  3. For the single learning example, download and unzip the directory Single.

  4. For the TMaze example, download and unzip the directory TMaze.

  5. Copy "matbugs.m" to directories Single and/or TMaze.

The "Single" and "TMaze" directories contain Matlab files and a .txt file. The model is specified in the .txt file.

From Matlab,

  1. Single Learning Example

    Type “RunSingleExample” in the “Single” directory from Matlab. Adjustments to the input and output as well as number, burn-in and length of MC chains can be made in "RunSingleExample.m". Adjustments to the model specification are made in the .txt file “Model.txt”

  2. T Maze example

    Type “RunTMazeExample” in the "TMaze" directory from Matlab.


  • In the examples shown the MCMC chains mix and converge. In general I have found this to be the case for these models. However, it is very important to check convergence. Details of convergence diagnostics can be found in the WinBUGs documentation.

  • Some convergence problems and trap errors can occur if the prior on the random walk variance is too diffuse.

  • To force the script to stay in WinBUGS, change the ‘view’ parameter in the "matbugs.m" function call from "0" to "1".

This work was supported by NIMH grant (MH-71847).