AM function

The Adaptive Metropolis Algorithm