This applet runs a simple (random-walk) Metropolis MCMC algorithm on a simple target distribution (the blue bars) supported on just a few points (default=6). The black bars represent the chain's empirical distribution; over time, they should converge in height to the blue bars, thus illustrating convergence of the Metropolis algorithm to its target distribution.

The applet accepts the following keyboard inputs. (You may need to "click" on the applet first.)

- Use the numbers '0' though '9' to set the animation speed level higher or lower.
- Use 'r' to restart the simulation, or 'z' to just zero the empirical count, or 's' to toggle whether to show the empirical distribution.
- Use '>' and '<' to increase/decrease the target probability of state 2 (and restart the simulation).
- Use '+' and '-' to increase/decrease the number of states (and restart the simulation).
- Use 'p' and 'm' to increase/decrease the current value of Gamma, the spread of the (uniform) proposal distribution (default=1).

Applet by Jeffrey S. Rosenthal (contact me).

[Return to my Applets Page / Home Page]