| xtr_ci_hdi | R Documentation |
Calculates Bayesian credible intervals using the highest density interval (HDI), i.e., the narrowest CI with the specified minimum coverage.
xtr_ci_hdi(x, level = 0.95, ..., na_rm = FALSE)
x |
A numeric vector of MCMC samples. |
level |
A number > 0 and <= 1 specifying the probability coverage of the interval. |
... |
Currently unused. |
na_rm |
A flag indicating whether to remove missing values. |
A data.frame of the lower and upper limits for the credible
interval.
Note that the interval is not guaranteed to be one-sided or two-sided.
Returns integer limits if the input data are integers and double otherwise.
xtr_ci() and xtr_ci_eti()
xtr_ci_hdi(1:10, level = 0.1) # only 10% of values inside
xtr_ci_hdi(1:10, level = 0.2) # only 20% of values inside
xtr_ci_hdi(1:10, level = 0.2 + 0.01) # at least 20.1% of values inside
xtr_ci_hdi(1:100) # inclusive interval [3, 98] with 95% of values inside
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.