| predictive_interval {rstantools} | R Documentation |
See predictive_interval.stanreg in the
rstanarm package for an example.
predictive_interval(object, ...) ## Default S3 method: predictive_interval(object, prob = 0.9, ...)
object |
The object to use. |
... |
Arguments passed to methods. See the methods in the rstanarm package for examples. |
prob |
A number p (0 < p < 1) indicating the desired probability mass to include in the intervals. |
predictive_interval methods should return a matrix with two
columns and as many rows as data points being predicted. For a given value
of prob, p, the columns correspond to the lower and upper
100p% interval limits and have the names 100α/2% and
100(1 - α/2)%, where α = 1-p. For example, if
prob=0.9 is specified (a 90% interval), then the column names
would be "5%" and "95%", respectively.
The default method just takes object to be a matrix and computes
quantiles, with prob defaulting to 0.9.
The guidelines for developers of R packages interfacing with Stan, a
copy of which can be found in the package vignettes. See
browseVignettes("rstantools") or vignette(package =
"rstantools"). The document is also available online at the
rstantools page on the
CRAN
website.
# Default method takes a numeric matrix (of draws from posterior
# predictive distribution)
ytilde <- matrix(rnorm(100 * 5, sd = 2), 100, 5) # fake draws
predictive_interval(ytilde, prob = 0.8)
# Also see help("predictive_interval", package = "rstanarm")