05Rhats | R Documentation |
These functions are used to gauge whether mi
has converged.
Rhats(imputations, statistic = c("moments", "imputations", "parameters")) mi2BUGS(imputations, statistic = c("moments", "imputations", "parameters"))
imputations |
an object of |
statistic |
single character string among |
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
mi2BUGS
returns an array while Rhats
a vector of R-hat convergence statistics.
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.
if(!exists("imputations", env = .GlobalEnv)) { imputations <- mi:::imputations # cached from example("mi-package") } dim(mi2BUGS(imputations)) Rhats(imputations)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.