Watch for mode trapping. Exact conditional draws can still leave the chain in one population. Extra burn-in does not guarantee visits to the other.
Full conditional
This is a distribution with the other coordinate fixed, not a marginal.
| Parameter | Before | After | Status |
|---|
Contours show relative joint density, not credible regions. Open circle: previous state. Filled circle: current state. Cross: initial state. Plot windows are finite.
Has the chain explored the target?
Trace: parameter 1
Trace: parameter 2
Marginal: parameter 1
Marginal: parameter 2
Curves are exact Gaussian, Student-t or mixture marginals; dashed trace lines mark the target mean and burn-in. Mixture overlays show both populations even if the chain visits only one. The Poisson hierarchy has no analytic marginal overlay here.
| Parameter | Sample mean | Sample SD | Target mean | Target SD |
|---|
Autocorrelation: parameter 1
Autocorrelation: parameter 2
Only complete sweeps already revealed by playback enter these summaries. Burn-in does not remove autocorrelation, and a smooth trace within one population is not proof of convergence.
A systematic-scan Gibbs sweep
- Choose an initial state within the target support.
- Draw theta1 from p(theta1 | current theta2, data): a horizontal move.
- Draw theta2 from p(theta2 | new theta1, data): a vertical move.
- Record this completed pair and repeat.
theta1[t+1] ~ p(theta1 | theta2[t], data) theta2[t+1] ~ p(theta2 | theta1[t+1], data)
Each exact conditional update preserves the joint target. Under suitable irreducibility and convergence conditions, repeated sweeps approach it. These are random draws, not optimisation steps: lower-density moves are allowed and there is no Metropolis accept/reject step. In more dimensions, update every coordinate using the most recently available values.
The selected model
Try these experiments
- Step through the first sweep. The second update conditions on the first update's new value.
- Compare rho = 0 with rho = 0.98. Narrow conditionals can mean slow travel along an elongated posterior.
- For the mixture, use rho = 0 and compare separation 2 with separation 6. Start near either population, then compare different seeds. Unequal weights change the overall mean, not the midpoint.
- For Student-t, move far from the centre: its conditional widens. The conditional has nu + 1 degrees of freedom, not nu.
- For the Poisson hierarchy, change the observed total. Both sampled parameters stay positive.
Reproducibility and limits
A seeded, local pseudorandom generator fixes the complete trajectory. Playback only reveals it; pausing, replaying and changing display settings do not resample. Playback starts paused. JavaScript and R use different random generators, so equal seeds do not give identical paths across implementations.
This is a controlled teaching example, not a fit to a real survey. Finite, correlated samples need not match the target. A Gaussian mixture's parameters are specified here, not inferred; this is not a latent-class parameter-fitting tool.