olbm                  package:mcmc                  R Documentation

_O_v_e_r_l_a_p_p_i_n_g _B_a_t_c_h _M_e_a_n_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

       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.

_V_a_l_u_e:

     The estimated variance of the sample mean.

_S_e_e _A_l_s_o:

     'ts'

_E_x_a_m_p_l_e_s:

     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)
     olbm(out$batch, 150)
     # monte carlo estimates (true means are same by symmetry)
     apply(out$batch, 1, mean)
     # monte carlo standard errors (true s. d. are same by symmetry)
     sqrt(diag(olbm(out$batch, 150)))
     # check that batch length is reasonable
     acf(out$batch, lag.max = 200)

