Inferring the (mu,sigma) of a Gaussian distribution, or a mixture of Gaussians, using Gibbs Sampling

(c) David J.C. MacKay | Lecture course | Book | Other demonstrations |


single-gaussian Gibbs sampling screenshot


This demonstration should work if you are running X-windows on a unix machine that has gnuplot.
If you have got gnuplot on some other system (eg cygwin under Windoze), it may work.
If you have not got gnuplot, I recommend you install cygwin or get a linux machine.

Note to me: create tar using

cd ~/octave ; tar cvfh ~/pub/itprnn/code/gibbsdemo/gibbsdemo.tar gibbsdemo/

To run the demonstration:

  1. get the demonstration files (41K) by clicking here http / ftp
  2. unpack thus:
           tar xvf gibbsdemo.tar
    This unpacks a load of files into a directory called gibbsdemo. [If there are any complaints about the clock time use tar xvfm gibbsdemo.tar]
  3.        cd gibbsdemo
  4. (optional) modify your X windows defaults so that the gnuplot colours and fonts come out right. (Execute this command on the machine running X windows.)
           xrdb -load Xdefaults.gnu
  5.  octave
    (Works fine with octave-2.0 but not with octave-2.1.33, which seems to have plotting bugs.)
  6. To run the demo:
           load 'DEMO'
    Select from a range of demonstrations. Options [1] single-gaussian inference; gibbs sampling, [2] single-gaussian inference; priors on, [3] single-gaussian inference; silly data N=13, and [4] two-gaussian mixture model all work OK.


two-gaussian early screenshot
two-gaussian late screenshot

David MacKay <>
Last modified: Mon Feb 17 14:53:31 2003