batchSize {mcmcse} | R Documentation |
Batch size (truncation point) selection
Description
Function returns the optimal batch size (or truncation point) for a given chain and method.
Usage
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 “ |
g |
A function that represents features of interest. |
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
## 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")