chain_convergence: Perform checks for convergence of multiple Markov chains.

Description Usage Arguments Details Value Notes See Also

View source: R/diagnostics.R

Description

chain_convergence checks convergence of multiple Markov chains.

Usage

1

Arguments

chain

(array) of MCMC samples, N rows (sampled) by M columns (variables).

Details

Return and plot Gelman & Rubin's R.hat statistic for each parameter, comparing within-chain and between-chain variances. Plot a comparison between the 80% regions for each parameter.

Value

The values of R.hat for each of the M variables.

Notes

This requires the input array be a two-dimensional array such as produced by mh_sampler or gw_sampler, with results from each chain/walker merged. The intervals are scaled so that each variable has mean 0 and std.dev 1 to make it easier to compare variables which might have very different scales.

If the chains are ‘well mixed’ R.hat should be close to 1.0 (ideally <1.1) and the intervals for each chain should share a lot of overlap. Note that this is more useful for the output of the MH method. (The GW method works best with a large ensemble of walkers - nwalkers >= 50 - but requires fewer iterations of the full ensemble, so the inter-walker comparisons are less useful.)

See Also

Rhat


svdataman/tonic documentation built on Aug. 2, 2019, 3:21 p.m.