# MCMC proposal scales / MCMC 三种步长练习 Entirely simulated 30-observation data: y=1+2x+error, x/error independent standard normals, seed 42. The inference model fixes intercept 1 and error SD 1, with slope prior N(0,5²). It is a one-parameter normal posterior with an analytic reference; neither intercept nor variance is estimated. This deliberately simple target is not general Bayesian regression. ## Offline rerun / 离线复做 Extract into a fresh directory, retaining a reference copy of results/. From the package root: ```sh python -m venv .venv # macOS/Linux source .venv/bin/activate # Windows: .venv\Scripts\activate python -m pip install -r requirements.txt python analyze.py ``` Dependency installation accesses a software repository; analysis itself is offline. Default output overwrites named files only under this package's results/. Python 3.11.11/macOS tested; Windows hardware untested. The symmetric random-walk Metropolis proposals use SD .01, .35 and 3, start 0, same seed 42 in each setting. Each run has 5000 post-transition states; first 1000 discarded for the teaching comparison, leaving 4000 per setting. These settings are NOT independent multiple chains for convergence diagnosis; do not pool them as one posterior sample or compute a convergence claim from them. chain-states.csv contains 15000 rows, with step_sd, iteration, state, accepted and retained. Rejected proposals repeat the previous state; they are retained, not deleted. Acceptance rate covers all 5000 transitions; summaries use the 4000 retained states and sample SD ddof=1. Their empirical quantiles need not approximate the posterior reliably when exploration is poor. Check MCMC_SCALES_COMPLETED. Compare result.json and numeric CSVs, not SVG/PNG bytes. results/summary.csv contains each setting's estimates; result.json also gives the analytic posterior mean/SD/quantiles and fixed model parameters. ```sh python analyze.py --seed 7 --output-dir exercise-seed-7 python analyze.py --iterations 10000 --discard 2000 --output-dir exercise-longer ``` The --seed option changes BOTH simulated data and proposal RNG. Longer runs with an unchanged seed preserve the same data and target. Require 0<=discard