predict: Posterior Predictive Distribution

Description Usage Arguments Details Value Examples

View source: R/prediction_interval.R

Description

Draw sample from the posterior predictive distribution.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
predict(
  object,
  newdata = NULL,
  newdata_scale2 = NULL,
  newdata_scale3 = NULL,
  summary = TRUE,
  new_level = TRUE,
  cred = 0.95,
  digits = 3,
  ...
)

Arguments

object

An object of class blsmeta.

newdata

An optional data.frame for which to compute fit fitted values. Defaults to NULL, which then uses the original data used in blsmeta.

newdata_scale2

An optional data.frame for which to compute predictions for the level 2 variance component. Defaults to NULL, which then uses the original data used in blsmeta.

newdata_scale3

An optional data.frame for which to compute predictions for the level 3 variance component. Defaults to NULL, which then uses the original data used in blsmeta

summary

logical. Should the posterior samples be summarized (defaults to TRUE)?

new_level

logical. Should the predictive distribution be for new levels (defaults to TRUE)? See Details.

cred

numeric. credible interval (defaults to 0.95).

digits

numeric. The desired number of digits for the summarized estimates (defaults to 3).

...

Currently ignored.

Details

When new_level = TRUE, this provides the predictive distribution with respect to the moderators for the sub-models. For obtaining the predictive distribution for the observed levels, set this to FALSE which then includes the "random" effects.

Value

A data frame of fitted values (when summary = TRUE), or a matrix of the unsummarized posterior samples.

Examples

1
2
3
4
5
6
7
8
library(psymetadata)

fit <-  blsmeta(yi = yi, 
                vi = vi, 
                es_id = es_id,
                data = gnambs2020)
                
predict(fit)

donaldRwilliams/blsmeta documentation built on Dec. 20, 2021, 12:12 a.m.