powered by
Compute quantiles of a sample and return them in a format consistent with other summary functions in the posterior package.
quantile2(x, probs = c(0.05, 0.95), na.rm = FALSE, ...)# S3 method for default quantile2(x, probs = c(0.05, 0.95), na.rm = FALSE, names = TRUE, ...)# S3 method for rvar quantile2(x, probs = c(0.05, 0.95), na.rm = FALSE, names = TRUE, ...)
# S3 method for default quantile2(x, probs = c(0.05, 0.95), na.rm = FALSE, names = TRUE, ...)
# S3 method for rvar quantile2(x, probs = c(0.05, 0.95), na.rm = FALSE, names = TRUE, ...)
A numeric vector of length length(probs). If names = TRUE, it has a names attribute with names like "q5", "q95", etc, based on the values of probs.
length(probs)
names = TRUE
"q5"
"q95"
probs
(multiple options) One of:
A matrix of draws for a single variable (iterations x chains). See extract_variable_matrix().
extract_variable_matrix()
An rvar.
rvar
(numeric vector) Probabilities in [0, 1].
[0, 1]
(logical) Should NA and NaN values be removed from x prior to computing quantiles? The default is FALSE.
NA
NaN
x
FALSE
Arguments passed to individual methods (if applicable) and then on to stats::quantile().
stats::quantile()
(logical) Should the result have a names attribute? The default is TRUE, but use FALSE for improved speed if there are many values in probs.
names
TRUE
mu <- extract_variable_matrix(example_draws(), "mu") quantile2(mu)
Run the code above in your browser using DataLab