MCMC sampler — watch a chain find the posterior

A real Metropolis–Hastings and Gibbs sampler. Turn the proposal width and watch the acceptance rate and mixing move together. Nothing here is drawn — every point is a genuine draw from the chain. STAT 101 · Module 9, Lesson 3

AI-generated Computed, not drawn Optimal-acceptance ~0.234 is a published heuristic

This page does not load a statistics library or a model — it runs the samplers itself, in your browser, with a seeded random-number generator so a given seed reproduces exactly. The sample mean and covariance you see converge to the target's true values; that convergence is the proof the sampler is real. The ~0.234 optimal acceptance rate is a published rule of thumb (Roberts, Gelman & Gilks, 1997), shown as a reference, not a law.

 

 

 

 

 
 

 

 
 

  

 

0.60

 

 

  

 

1.00

 

 

  

7

 

40

 

500

 

 

 — 
 — 
 — 
 — 
 — 
 — 

1 

 

 

2 

 

 

3 

 

 

The arithmetic, in full