group_effects {baggr} | R Documentation |
Extract baggr study/group effects
Description
Given a baggr object, returns the raw MCMC draws of the posterior for each group's effect or a summary of these draws. (We use "group" and "study" interchangeably.) If there are no covariates in the model, this effect is a single random variable. If there are covariates, the group effect is a sum of effect of covariates (fixed effects) and the study-specific random variable (random effects). This is an internal function currently used as a helper for plotting and printing of results.
Usage
group_effects(
bg,
summary = FALSE,
transform = NULL,
interval = 0.95,
random_only = FALSE,
rename_int = FALSE
)
study_effects(
bg,
summary = FALSE,
transform = NULL,
interval = 0.95,
random_only = FALSE,
rename_int = FALSE
)
Arguments
bg |
baggr object |
summary |
logical; if |
transform |
a transformation to apply to the result, should be an R function;
(this is commonly used when calling |
interval |
uncertainty interval width (numeric between 0 and 1), if summarising |
random_only |
logical; for meta-regression models, should fixed_effects be included in the returned group effect? |
rename_int |
logical; if |
Details
If summary = TRUE
, the returned object contains, for each study
or group, the following 5 values:
the posterior medians, the lower and upper bounds of the
uncertainty intervals using the central posterior credible interval
of width specified in the argument interval
, the posterior mean, and
the posterior standard deviation.
Value
Either an array with MCMC samples (if summary = FALSE
)
or a summary of these samples (if summary = TRUE
).
For arrays the three dimensions are: N samples, N groups and N effects
(equal to 1 for the basic models).
See Also
fixed_effects for effects of covariates on outcome. To extract random effects
when covariates are present, you can use either random_effects or, equivalently,
group_effects(random_only=TRUE)
.
Examples
fit1 <- baggr(schools)
group_effects(fit1, summary = TRUE, interval = 0.5)