50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

imt (version 1.0.0)

credibleInterval: Calculate credible interval from MCMC draws

Description

This function calculates a credible interval of the specified width from a vector of MCMC draws.

Usage

credibleInterval(draws, width)

Value

A named list containing three elements:

  • width: The specified width of the credible interval.

  • lower_bound: The lower bound of the credible interval.

  • upper_bound: The upper bound of the credible interval.

Arguments

draws

A numeric vector containing MCMC draws.

width

A numeric value between 0 and 1 specifying the desired width of the credible interval.

Details

The function calculates the lower and upper bounds of the credible interval using the quantile function based on the specified width.

Examples

Run this code
# Generate example draws
draws <- rnorm(1000)

# Calculate 95% credible interval
credibleInterval(draws, width = 0.95)

Run the code above in your browser using DataLab