Last chance! 50% off unlimited learning
Sale ends in
Last chance! 50% off unlimited learning
Sale ends in
The function effect_draw
and its alias, posterior_predict
, take the sample
of hyperparameters from a baggr model
(typically hypermean and hyper-SD, which you can see using treatment_effect)
and draws values of new realisations of treatment effect, i.e. an additional draw from the "population of studies".
This can be used for both prior and posterior draws, depending on baggr model.
By default this is done for a single new effect, but for meta-regression models
you can specify values of covariates with the newdata
argument, same as in predict.
effect_draw(
object,
draws = NULL,
newdata = NULL,
transform = NULL,
summary = FALSE,
message = TRUE,
interval = 0.95
)
A vector (with draws
values) for models with one treatment effect parameter,
a matrix (draws
rows and same number of columns as number of parameters) otherwise.
If newdata
are specified, an array is returned instead, where the first dimension
corresponds to rows of newdata
.
A baggr
class object.
How many values to draw? The default is as long as the number of samples
in the baggr
object (see Details).
an optional data frame containing new values of covariates
that were used when fitting the baggr
model
a transformation (an R function) to apply to the result of a draw.
logical; if TRUE returns summary statistics rather than samples from the distribution;
logical; use to disable messages prompted by using this function with no pooling models
uncertainty interval width (numeric between 0 and 1), if summary=TRUE
The predictive distribution can be used to "combine" heterogeneity between treatment effects and uncertainty in the mean treatment effect. This is useful both in understanding impact of heterogeneity (see Riley et al, 2011, for a simple introduction) and for study design e.g. as priors in analysis of future data (since the draws can be seen as an expected treatment effect in a hypothetical study).
The default number of samples is the same as what is returned by Stan model implemented in baggr,
(depending on such options as iter
, chains
, thin
). If n
is larger than what is available
in Stan model, we draw values with replacement. This is not recommended and warning is printed in
these cases.
Under default settings in baggr, a posterior predictive distribution is obtained. But
effect_draw
can also be used for prior predictive distributions when
setting ppd=T
in baggr. The two outputs work exactly the same way.
If the baggr
model used by the function is a meta-regression
(i.e. a baggr
model with covariates
), by specifying
the predicted values can be adjusted for known levels of fixed covariates by
passing newdata
(same as in predict). If no adjustment is made, the
returned value should be interpreted as the effect when all covariates are 0.
Riley, Richard D., Julian P. T. Higgins, and Jonathan J. Deeks. "Interpretation of Random Effects Meta-Analyses". BMJ 342 (10 February 2011)..
treatment_effect returns samples from hypermean(s) and hyper-SD(s) which are used by this function