Computes credible (uncertainty) intervals for a given vector, given quantiles or the size of the middle interval
rvci(obj, interval = 0.95, one.sided = FALSE, left = TRUE)
random scalar or vector
size of the middle interval or the quantile range of the interval
logical, FALSE if two-sided interval is desired
logical, indicating if the left one-sided interval is desired
For two-sided intervals, an array of numbers of dimension
c(2,length(x))
, for one-sided intervals, a vector of the same length
as x
.
If interval
is of length two or more, the return value will be the
quantiles given by range(interval)
.
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv")
.
rvci(rvnorm(1), interval=0.683) # Should be about c(-1,1).
#> 15.85% 84.15%
#> [1,] -0.8456459 0.9557299