batchSize: Batch size (truncation point) selection

Description Usage Arguments Details Value References See Also Examples

View source: R/batchSize.R

Description

Function returns the optimal batch size (or truncation point) for a given chain and method.

Usage

1
batchSize(x, method = c("bm", "obm", "bartlett", "tukey", "sub"), g = NULL, fast = TRUE)

Arguments

x

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

method

Any of “bm”,“obm”,“bartlett”,“tukey”. “bm” represents batch means estimator, “obm” represents the overlapping batch means estimator, and “bartlett” and “tukey” represent the modified-Bartlett window and the Tukey-Hanning windows for the spectral variance estimators.

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.

fast

Boolean variable for fast estimation using a reasonable subset of the Markov chain.

Details

batchSize fits a stationary autoregressive process to the marginals of x, selecting the order of the process as the one with the maximum AIC among the models with coefficients greater than a threshold.

Value

A value of the optimal batch size (truncation point or bandwidth) is returned.

References

Liu, Y., Vats, D., and Flegal, J. M. (2021) Batch size selection for variance estimators in MCMC, Methodology and Computing in Applied Probability, to appear.

See Also

mcse.multi and mcse, which calls on batchSize.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Bivariate Normal with mean (mu1, mu2) and covariance sigma
n <- 1e3
mu <- c(2, 50)
sigma <- matrix(c(1, 0.5, 0.5, 1), nrow = 2)

out <- BVN_Gibbs(n, mu, sigma)

batchSize(out)
batchSize(out, method = "obm")
batchSize(out, method = "bartlett")

mcmcse documentation built on Sept. 9, 2021, 9:06 a.m.