Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mcse.initseq

Multivariate Monte Carlo standard errors for expectations with the initial sequence method of Dai and Jones (2017).


Description

Function returns the estimate of the covariance matrix in the Markov Chain central limit theorem using initial sequence method. This method is designed to give an asymptotically conservative estimate of the Monte Carlo standard error.

Usage

mcse.initseq(x, g = NULL, adjust = FALSE, blather = FALSE)

Arguments

x

a matrix or data frame of Markov chain output. Number of rows is the Monte Carlo sample size.

adjust

logical; if TRUE, an adjustment is made to increase slightly the eigenvalues of the initial sequence estimator. The default is FALSE.

g

a function that represents features of interest. g is applied to each row of x and thus g should take a vector input only. If g is NULL, g is set to be identity, which is estimation of the mean of the target density.

blather

if TRUE, outputs under the hood information about the function.

Value

A list is returned with the following components,

cov

a covariance matrix estimate using intial sequence method.

cov.adj

a covariance matrix estimate using adjusted initial sequence method if the input adjust=TRUE.

est

estimate of g(x).

nsim

number of rows of the input x. Only if blather = TRUE

adjust

logical of whether an adjustment was made to the initial sequence estimator. Only if blather = TRUE

References

Dai, N and Jones, G.L. (2017+) Multivariate initial sequence estimators in Markov chain Monte Carlo, Journal of Multivariate Analysis.

See Also

initseq{mcmc}, which is a different univariate 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. mcse.multi, which estimates the covariance matrix in the Markov Chain CLT using batch means or spectral variance methods.

Examples

library(mAr)
p <- 3
n <- 1000
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)

dat <- as.matrix(mAr.sim(rep(0,p), phi, omega, N = n))

out.mcse <- mcse.initseq(x = dat)
out.mcse.adj  <- mcse.initseq(x = dat,adjust = TRUE)

# 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))
out.g.mcse <- mcse.initseq(x = dat, g = g)

mcmcse

Monte Carlo Standard Errors for MCMC

v1.4-1
GPL (>= 2)
Authors
James M. Flegal <jflegal@ucr.edu>, John Hughes <j.hughes@ucdenver.edu>, Dootika Vats <dootika@iitk.ac.in>, and Ning Dai <daixx224@umn.edu>
Initial release
2020-01-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.