Initial Sequence Estimators
Variance of sample mean of functional of reversible Markov chain using methods of Geyer (1992).
initseq(x)
x |
a numeric vector that is a scalar-valued functional of a reversible Markov chain. |
Let
gamma[k] = cov(x[i], x[i + k])
considered as a function of the lag k be the autocovariance function of the input time series. Define
Gamma[k] = gamma[2 k] + gamma[2 k + 1]
the sum of consecutive pairs of autocovariances. Then Theorem 3.1 in Geyer (1992) says that Gamma[k] considered as a function of k is strictly positive, strictly decreasing, and strictly convex, assuming the input time series is a scalar-valued functional of a reversible Markov chain. All of the MCMC done by this package is reversible. This R function estimates the “big gamma” function, Gamma[k] considered as a function of k, subject to three different constraints, (1) nonnegative, (2) nonnegative and nonincreasing, and (3) nonnegative, nonincreasing, and convex. It also estimates the variance in the Markov chain central limit theorem (CLT)
- gamma0 + 2 * sum(gamma) = - gamma0 + 2 * sum(Gamma)
Note: The batch means provided by metrop
are also
scalar functionals of a reversible Markov chain. Thus these initial sequence
estimators applied to the batch means give valid standard errors for the
mean of the match means even when the batch length is too short to provide
a valid estimate of asymptotic variance. One does, of course, have to
multiply the asymptotic variance of the batch means by the batch length
to get the asymptotic variance for the unbatched chain.
a list containing the following components:
gamma0 |
the scalar gamma[0], the marginal variance
of |
Gamma.pos |
the vector Gamma, estimated so as to be nonnegative,
where, as always, R uses one-origin indexing so |
Gamma.dec |
the vector Gamma, estimated so as to be nonnegative
and nonincreasing, where, as always,
R uses one-origin indexing so |
Gamma.con |
the vector Gamma, estimated so as to be nonnegative
and nonincreasing and convex, where, as always,
R uses one-origin indexing so |
var.pos |
the scalar |
var.dec |
the scalar |
var.con |
the scalar |
Not precisely a bug, but var.pos
, var.dec
, and var.con
can be negative. This happens only when the chain is way too short to estimate
the variance, and even then rarely. But it does happen.
Geyer, C. J. (1992) Practical Markov Chain Monte Carlo. Statistical Science 7 473–483.
n <- 2e4 rho <- 0.99 x <- arima.sim(model = list(ar = rho), n = n) out <- initseq(x) ## Not run: plot(seq(along = out$Gamma.pos) - 1, out$Gamma.pos, xlab = "k", ylab = expression(Gamma[k]), type = "l") lines(seq(along = out$Gamma.dec) - 1, out$Gamma.dec, col = "red") lines(seq(along = out$Gamma.con) - 1, out$Gamma.con, col = "blue") ## End(Not run) # asymptotic 95% confidence interval for mean of x mean(x) + c(-1, 1) * qnorm(0.975) * sqrt(out$var.con / length(x)) # estimated asymptotic variance out$var.con # theoretical asymptotic variance (1 + rho) / (1 - rho) * 1 / (1 - rho^2) # illustrating use with batch means bm <- apply(matrix(x, nrow = 5), 2, mean) initseq(bm)$var.con * 5
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.