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

olbm

Overlapping Batch Means


Description

Variance of sample mean of time series calculated using overlapping batch means.

Usage

olbm(x, batch.length, demean = TRUE)

Arguments

x

a matrix or time series object. Each column of x is treated as a scalar time series.

batch.length

length of batches.

demean

when demean = TRUE (the default) the sample mean is subtracted from each batch mean when estimating the variance. Using demean = FALSE would essentially assume the true mean is known to be zero, which might be useful in a toy problem where the answer is known.

Value

The estimated variance of the sample mean.

See Also

Examples

h <- function(x) if (all(x >= 0) && sum(x) <= 1) return(1) else return(-Inf)
out <- metrop(h, rep(0, 5), 1000)
out <- metrop(out, scale = 0.1)
out <- metrop(out, nbatch = 1e4)
foo <- olbm(out$batch, 150)
# monte carlo estimates (true means are same by symmetry)
apply(out$batch, 2, mean)
# monte carlo standard errors (true s. d. are same by symmetry)
sqrt(diag(foo))
# check that batch length is reasonable
acf(out$batch, lag.max = 200)

mcmc

Markov Chain Monte Carlo

v0.9-7
MIT + file LICENSE
Authors
Charles J. Geyer <charlie@stat.umn.edu> and Leif T. Johnson <ltjohnson@google.com>
Initial release
2020-03-20

We don't support your browser anymore

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