group_effects: Extract baggr study effects

View source: R/group_effects.R

group_effectsR Documentation

Extract baggr study effects


Given a baggr object, returns the raw MCMC draws of the posterior for each group's effect or a summary of these draws. 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.


  summary = FALSE,
  transform = NULL,
  interval = 0.95,
  random_only = FALSE,
  rename_int = FALSE



baggr object


logical; if TRUE returns summary statistics as explained below.


a transformation to apply to the result, should be an R function; (this is commonly used when calling group_effects from other plotting or printing functions)


uncertainty interval width (numeric between 0 and 1), if summarising


logical; for meta-regression models, should fixed_effects be included in the returned group effect?


logical; if TRUE then rather than returning median, lci and uci columns they are renamed to e.g. 50%, 2.5%, 97.5%; this only works if summary=TRUE


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.


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).


fit1 <- baggr(schools)
group_effects(fit1, summary = TRUE, interval = 0.5)

baggr documentation built on March 18, 2022, 7:02 p.m.