Learn R Programming

mcmcse (version 1.5-1)

confRegion: Confidence regions (ellipses) for Monte Carlo estimates

Description

Constructs confidence regions (ellipses) from the Markov chain output for the features of interest Function uses the ellipse package.

Usage

confRegion(mcse.obj, which = c(1,2), level = .95)

Value

Returns a matrix of x and y coordinates for the ellipse. Use plot function on the matrix to plot the ellipse.

Arguments

mcse.obj

The list returned by the mcse.multi or mcse.initseq command, or an mcmcse class object.

which

Integer vector of length 2 indicating the component for which to make the confidence ellipse. Chooses the first two by default.

level

confidence level for the ellipse.

Examples

Run this code

## Bivariate Normal with mean (mu1, mu2) and covariance sigma
n <- 1e3
mu <- c(2, 50)
sigma <- matrix(c(1, 0.5, 0.5, 1), nrow = 2)

out <- BVN_Gibbs(n, mu, sigma)

mcerror <- mcse.multi(out, blather = TRUE)

## Plotting the ellipse
plot(confRegion(mcerror), type = 'l')

Run the code above in your browser using DataLab