getBands: Posterior Credible Bands

View source: R/qrjoint.R

getBandsR Documentation

Posterior Credible Bands

Description

Calculate and display credible bands of a vector of parameters from a sample of draws. Most suitable when the vector represents a discretized version of a function.

Usage

 
getBands(b, col = 2, lwd = 1, plot = TRUE, add = FALSE, 
x = seq(0,1,len=nrow(b)), remove.edges = TRUE, ...)

Arguments

b

a matrix of sampled draws of a vector, columns giving samples and rows giving elements of the vector

col

color of the median line and 95% bands, usual color codes could be used

lwd

line width for the median line

plot

logical indicating whether plots are to be drawn, default is TRUE

add

logical indicating whether plot is to be added to existing plot, default is FALSE

x

indexing the parameter coordinates. When b represents a (discretized) function, x can be taken as the function argument values. Needed when plot is to be created. Default sets it to a uniform grid of points over [0,1].

remove.edges

logical indicating whether the first and last entries of b are to be removed from plotting. This is helpful in qrjoint plots, where the two extremes could be Inf or nearly Inf.

...

limited number of plotting parameters

Value

returns median, 2.5th and 97.5th percentiles as a 3-column matrix.

See Also

coef.qrjoint

Examples

 
## toy example

x <- 2*pi*seq(0,1,.01)
fsamp <- replicate(100, rnorm(1,0,0.1) + rnorm(1,1,0.2) * cos(x))
getBands(fsamp)
getBands(fsamp, x = x, col = 3, remove.edges = FALSE, xlab = "x", ylab = "f", bty = "n")
getBands(fsamp, x = x, col = "darkgreen", remove.edges = FALSE, xlab = "x", ylab = "f")

qrjoint documentation built on April 6, 2023, 1:07 a.m.

Related to getBands in qrjoint...