asym.var | R Documentation |
Estimates the asymptotic covariance matrix for Monte Carlo estimators, compatible with multiple chains. If a single chain is input, it calls mcmcse::mcse.multi
.
asym.var( x, multivariate = TRUE, method = "lug", size = NULL, autoburnin = FALSE, adjust = TRUE )
x |
a list of matrices, where each matrix is n \times p. Each row of the matrices represents one step of the chain. Each column of the matrices represents one variable. A list with a single matrix (chain) is allowed. Optionally, this can be an |
multivariate |
a logical flag indicating whether the full matrix is returned (TRUE) or only the diagonals (FALSE) |
method |
the method used to compute the matrix. This is one of “ |
size |
options are |
autoburnin |
a logical flag indicating whether only the second half of the series should be used in the computation. If set to TRUE and |
adjust |
this argument is now obselete due to package updates. |
The function returns estimate of the univariate or multivariate asymptotic (co)variance of Monte Carlo estimators. If X_1, … X_n are the MCMC samples, then function returns the estimate of \lim_{n\to ∞} n Var(\bar{X}). In other words, if a Markov chain central limit holds such that, as n \to ∞
√{n}(\bar{X} - μ) \to N(0, Σ)
then the function returns an estimator of Σ from the m different chains. If multivariate == FALSE
, then only the diagonal of Σ are returned.
The asymptotic variance estimate (if multivariate = FALSE
) or the asymptotic covariance matrix (if multivariate = TRUE
) in the Markov chain central limit theorem.
Vats, D. and Knudson, C. Revisiting the Gelman-Rubin Diagnostic. arXiv:1812.09384.
Vats, D. and Flegal, J. Lugsail lag windows and their application to MCMC. arXiv: 1809.04541.
Flegal, J. M. and Jones, G. L. (2010) Batch means and spectral variance estimators in Markov chain Monte Carlo. The Annals of Statistics, 38, 1034–1070.
Gelman, A and Rubin, DB (1992) Inference from iterative simulation using multiple sequences, Statistical Science, 7, 457-511.
Brooks, SP. and Gelman, A. (1998) General methods for monitoring convergence of iterative simulations. Journal of Computational and Graphical Statistics, 7, 434-455.
library(stableGR) set.seed(100) p <- 2 n <- 100 # n is tiny here purely for demo purposes. # use n much larger for real problems! sig.mat = matrix(c(1, .8, .8, 1), ncol = 2, nrow = 2) # Making 3 chains chain1 <- mvn.gibbs(N = n, p = p, mu = rep(1,p), sigma = sig.mat) chain2 <- mvn.gibbs(N = n, p = p, mu = rep(1,p), sigma = sig.mat) chain3 <- mvn.gibbs(N = n, p = p, mu = rep(1,p), sigma = sig.mat) # find GR diagnostic using all three chains x <- list(chain1, chain2, chain3) asym.var(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.