Description Usage Arguments Value See Also Examples
View source: R/predictive_interval.R
The predictive_interval
function computes Bayesian predictive intervals.
The method for stapreg objects calls posterior_predict
internally, whereas the method for objects of class "ppd"
accepts the
matrix returned by posterior_predict
as input and can be used to avoid
multiple calls to posterior_predict
.
1 2 3 4 5 6 7 8 | ## S3 method for class 'stapreg'
predictive_interval(object, prob = 0.9,
newsubjdata = NULL, newdistdata = NULL, newtimedata = NULL,
draws = NULL, subject_ID = NULL, group_ID = NULL, re.form = NULL,
fun = NULL, seed = NULL, offset = NULL, ...)
## S3 method for class 'ppd'
predictive_interval(object, prob = 0.9, ...)
|
object |
Either a fitted model object returned by one of the
rstap modeling functions (a stapreg
object) or, for the |
prob |
A number p (0 < p < 1) indicating the desired
probability mass to include in the intervals. The default is to report
90% intervals ( |
newsubjdata |
Optionally, a data frame of the subject-specific data
in which to look for variables with which to predict.
If omitted, the original datasets are used. If |
newdistdata |
If newsubjdata is provided a data frame of the subject-distance must also be given for models with a spatial component |
newtimedata |
If newsubjdata is provided, a data frame of the subject-time data |
draws, fun, offset, re.form, seed |
Passed to
|
subject_ID |
same as |
group_ID |
same as |
... |
Currently ignored. |
A matrix with two columns and as many rows as are in newsubjdata
.
If newsubjdata
is not provided then the matrix will have as many rows as
the data used to fit the model. For a given value of prob
, p,
the columns correspond to the lower and upper 100p% central 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 will be
"5%"
and "95%"
, respectively.
predictive_error
, posterior_predict
,
posterior_interval
1 2 3 4 5 6 7 8 9 10 11 12 | if (!exists("example_model")) example(example_model)
predictive_interval(example_model)
newdata <- data.frame(subj_ID = c(1,1), measure_ID = c(1,2),
centered_income = c(-1,-.7), sex = c(0,0),
centered_age = c(-1,-.7))
# newdata
predictive_interval(example_model, newsubjdata = newdata,
newdistdata = distdata,
newtimedata = timedata,
subject_ID = "subj_ID",
group_ID = "measure_ID")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.