getCI | R Documentation |
Calculates simultaneous confidence intervals for means and quantiles as indicated for the desired MCMC output
getCI(x, Q = c(0.1, 0.9), alpha = 0.05, thresh = 0.001, iid = FALSE,
mean = TRUE)
x |
: a ‘Smcmc’ class object |
Q |
: vector of quantiles |
alpha |
: confidence levels of the simulatenous intervals |
thresh |
: threshold for the optimization methodology that calculates the simultaneous CIs |
iid |
: logical argument for constructing density plot for iid samples. Defaults to |
mean |
: logical indicating whether mean is to be plotted |
adds segments for confidence intervals into an already existing plot environment
Robertson, N., Flegal, J. M., Vats, D., and Jones, G. L., “Assessing and Visualizing Simultaneous Simulation Error”, Journal of Computational and Graphical Statistics, 2020.
chain <- matrix(0, ncol = 1, nrow = 1e3)
chain[1,] <- 0
err <- rnorm(1e3)
for(i in 2:1e3)
{
chain[i,] <- .3*chain[i-1,] + err[i]
}
chain <- Smcmc(list(chain))
plot(density(chain$stacked[,1]))
CIs <- getCI(chain)
addCI(chain, CIs, component = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.