MCMC-diagnostics {mcmcsae} | R Documentation |
Compute MCMC diagnostic measures
Description
R_hat
computes Gelman-Rubin convergence diagnostics based on the MCMC output
in a model component, and n_eff
computes the effective sample sizes, .i.e.
estimates for the number of independent samples from the posterior distribution.
Usage
R_hat(dc)
n_eff(dc, useFFT = TRUE, lag.max, cl = NULL)
Arguments
dc |
a draws component (dc) object corresponding to a model parameter. |
useFFT |
whether to use the Fast Fourier Transform algorithm. Default is |
lag.max |
the lag up to which autocorrelations are computed in case |
cl |
a cluster for parallel computation. |
Value
In case of R_hat
the split-R-hat convergence diagnostic for each
component of the vector parameter, and in case of n_eff
the effective
number of independent samples for each component of the vector parameter.
References
A. Gelman and D. B. Rubin (1992). Inference from Iterative Simulation Using Multiple Sequences. Statistical Science 7, 457-511.
A. Gelman, J.B. Carlin, H.S. Stern, D.B. Dunson, A. Vehtari and D.B. Rubin (2013). Bayesian Data Analysis, 3rd edition. Chapman & Hall/CRC.
Examples
ex <- mcmcsae_example()
sampler <- create_sampler(ex$model, data=ex$dat)
sim <- MCMCsim(sampler, burnin=100, n.iter=300, thin=2, n.chain=4, store.all=TRUE)
n_eff(sim$beta)
n_eff(sim$v_sigma)
n_eff(sim$v_rho)
R_hat(sim$beta)
R_hat(sim$llh_)
R_hat(sim$v_sigma)