Multivariate Monte Carlo standard errors for expectations.
Function returns the estimate of the covariance matrix in the Markov Chain CLT using batch means or spectral variance methods (with different lag windows). The function also returns the Monte Carlo estimate.
mcse.multi(x, method = "bm", r = 3, size = NULL, g = NULL, adjust = TRUE, blather = FALSE)
x |
a matrix or data frame of Markov chain output. Number of rows is the Monte Carlo sample size. |
method |
any of |
r |
the lugsail parameter that converts a lag window into its lugsail equivalent. Larger values of |
size |
represents the batch size in “bm” and the truncation point in “bartlett” and “tukey”. Default is |
g |
a function that represents features of interest. g is applied to each row of |
adjust |
Defaults to |
blather |
if |
A list is returned with the following components,
cov |
a covariance matrix estimate. |
est |
estimate of g(x). |
nsim |
number of rows of the input |
method |
method used to calculate matrix |
size |
value of size used to calculate |
adjust.used |
whether an adjustment was used to calculate |
Vats, D., Flegal, J. M., and, Jones, G. L (2019) Multivariate Output Analysis for Markov chain Monte Carlo, Biometrika.
Vats, D., Flegal, J. M., and, Jones, G. L. (2018) Strong Consistency of multivariate spectral variance estimators for Markov chain Monte Carlo, Bernoulli.
batchSize
, which computes an optimal batch size.
mcse.initseq
, which computes an initial sequence estimator.
mcse
, which acts on a vector.
mcse.mat
, which applies mcse
to each
column of a matrix or data frame.
mcse.q
and mcse.q.mat
, which
compute standard errors for quantiles.
library(mAr) p <- 3 n <- 1e3 omega <- 5*diag(1,p) ## Making correlation matrix var(1) model set.seed(100) foo <- matrix(rnorm(p^2), nrow = p) foo <- foo %*% t(foo) phi <- foo / (max(eigen(foo)$values) + 1) out <- as.matrix(mAr.sim(rep(0,p), phi, omega, N = n)) mcse.bm <- mcse.multi(x = out) mcse.tuk <- mcse.multi(x = out, method = "tukey") # If we are only estimating the mean of the first component, # and the second moment of the second component g <- function(x) return(c(x[1], x[2]^2)) mcse <- mcse.multi(x = out, g = g)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.