Inferring the (mu,sigma) of a Gaussian distribution

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


screenshot, a few random gaussians


This demonstration should work if you are running X-windows on a unix machine which 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 ~/itp ; tar cvfh ~/pub/itprnn/code/gaussian/gaussian.tar gaussian/

To run the demonstration:

  1. get the demonstration files (41K) by clicking here http / ftp
  2. unpack thus:
           tar xvf gaussian.tar
    This unpacks a load of files into a directory called gaussian. [If there are any complaints about the clock time use tar xvfm gaussian.tar]
  3.        cd gaussian
  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.        gnuplot
  6. To run the demo:
           load 'DEMO'
    During this sequence, hit return when you are ready for the next picture. Occasionally hitting return takes you through a "buffer" of cautionary steps.
screenshot from rotating surface plot


It's really easy to do Bayesian inference yourself. Read the file DEMO to see the key definitions of the functions that are plotted. It only takes a couple of lines to define the likelihood l(m,s).

The demonstration shows the likelihood of mu and sigma for a single data point first, building up a surface plot gradually; then it shows the likelihood of mu and sigma for five data points. To view the demonstration again it may be necessary to quit gnuplot and restart in order to get the correct defaults.

David MacKay <>
Last modified: Tue Apr 15 13:03:04 2003