05Rhats: Convergence Diagnostics

05RhatsR Documentation

Convergence Diagnostics

Description

These functions are used to gauge whether mi has converged.

Usage

Rhats(imputations, statistic = c("moments", "imputations", "parameters"))
mi2BUGS(imputations, statistic = c("moments", "imputations", "parameters"))

Arguments

imputations

an object of mi-class

statistic

single character string among "moments", "imputations", and "parameters" indicating what statistic to monitor for convergence

Details

If statistic = "moments" (the default), then the mean and standard deviation of each variable will be monitored over the iterations. If statistic = "imputations", then the imputed values will be monitored, which may be quite large and quite slow and is not possible if the save_RAM = TRUE flag was set in the call to the mi function. If statistic = "parameters", then the estimated coefficients and ancillary parameters extracted by the get_parameters-methods will be monitored.

Rhats produces a vector of R-hat convergence statistics that compare the variance between chains to the variance across chains. Values closer to 1.0 indicate little is to be gained by running the chains longer, and in general, values greater than 1.1 indicate that the chains should be run longer. See Gelman, Carlin, Stern, and Rubin, "Bayesian Data Analysis", Second Edition, 2009, p.304 for more information about the R-hat statistic.

mi2BUGS outputs the history of the indicated statistic

Value

mi2BUGS returns an array while Rhats a vector of R-hat convergence statistics.

Author(s)

Ben Goodrich and Jonathan Kropko, for this version, based on earlier versions written by Yu-Sung Su, Masanao Yajima, Maria Grazia Pittau, Jennifer Hill, and Andrew Gelman.

Examples

if(!exists("imputations", env = .GlobalEnv)) {
  imputations <- mi:::imputations # cached from example("mi-package")
}
  dim(mi2BUGS(imputations))
  Rhats(imputations)

mi documentation built on June 7, 2022, 1:04 a.m.