Calculate Monte Carlo Standard Errors Using Batch Means

diag_mc_stderr(x, b_size = "sqroot", warn = TRUE)

Arguments

x

'mcmc.list' or 'data.table' object

b_size

character, method for determining size of batch (see Details)

warn

logical, give a warning of there are too few samples in the MCMC output

Details

For the batch size, the options are 'sqroot', for using the using the square root of the MCMC output length, or 'cuberoot', for using the cube root of the output length. The default is 'sqroot'.

References

Galin L. Jones, Murali Haran, Brian S. Caffo, and Ronald Neath (2006). "Fixed-Width Output Analysis for Markov Chain Monte Carlo," Journal of the American Statistical Association, 101, 1537--1547

Examples

library(coda) data(line) r <- diag_mc_stderr(line)
#> Warning: likely too few samples (less than 1000) for estimating Monte Carlo standard errors
#> Warning: likely too few samples (less than 1000) for estimating Monte Carlo standard errors
#> Warning: likely too few samples (less than 1000) for estimating Monte Carlo standard errors
#> Warning: likely too few samples (less than 1000) for estimating Monte Carlo standard errors
#> Warning: likely too few samples (less than 1000) for estimating Monte Carlo standard errors
#> Warning: likely too few samples (less than 1000) for estimating Monte Carlo standard errors
r
#> parameter chain mean value #> 1: alpha 1 2.9826146 0.03667355 #> 2: alpha 2 2.9925142 0.03001358 #> 3: beta 1 0.7866946 0.02285799 #> 4: beta 2 0.8116781 0.02778074 #> 5: sigma 1 0.9544249 0.10259971 #> 6: sigma 2 0.9816789 0.04737521