credIntSamp: Calculate a credible interval from a numerically specified...

Description Usage Arguments Details Value Examples

View source: R/credIntSamp.r

Description

Calculates a lower, upper, or two-sided credible interval from the numerical posterior CDF.

Usage

1
credIntSamp(theta, conf = 0.95, type="twosided")

Arguments

theta

a sample from the posterior density

conf

the desired 'confidence' level

type

the type of interval to return, 'lower' = one sided lower bound, 'two-sided' = two - sided, or 'upper' = one sided upper bound. It is sufficient to use 'l','t' or 'u'

Details

This function uses linear interpolation to calculate bounds for points that may not be specified by CDF

Value

a list containing the elements lower.bound, uppper.bound or both depending on type

Examples

1
2
3
4
5
## posterior is N(0,1)
theta <- rnorm(1000)
ci<-credIntSamp(theta)
plot(density(theta))
abline(v=c(unlist(ci)))

Bolstad2 documentation built on May 29, 2017, 3:35 p.m.

Search within the Bolstad2 package
Search all R packages, documentation and source code