View source: R/credibleInterval.R
credibleInterval | R Documentation |
This function calculates a credible interval of the specified width from a vector of MCMC draws.
credibleInterval(draws, width)
draws |
A numeric vector containing MCMC draws. |
width |
A numeric value between 0 and 1 specifying the desired width of the credible interval. |
The function calculates the lower and upper bounds of the credible interval using the quantile function based on the specified width.
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.
# Generate example draws
draws <- rnorm(1000)
# Calculate 95% credible interval
credibleInterval(draws, width = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.