brms_forest: Meta-analysis forest plots from brms output

Description Usage Arguments Details Examples

View source: R/brms_forest.R

Description

This function draws a forest plot from a random-effects meta-analysis model fitted with brms.

Usage

1
2
3
brms_forest(data, model, study = "study", label = "label", yi = "yi",
  sei = "sei", level = 0.95, xlim = NULL, show_data = FALSE,
  sort_estimates = FALSE, dens_fill = "grey60", dens_col = NA)

Arguments

data

Data frame with study labels, effect sizes and standard errors. A data.frame or tibble.

model

A meta-analytic model estimated with brms.

study

Variable in data identifying each study.

label

Variable in data labelling each study.

yi

Outcomes in data.

sei

Standard errors in data.

level

The "Confidence" level for the Credible Intervals. Defaults to 0.95.

xlim

Limits for the x-axis. The defaults are the smallest observed ES - 4 Standard errors to the largest observed ES + 4 SEs.

show_data

Logical; whether to show the observed effect size and standard error below the meta-analytic estimates. Defaults to FALSE.

sort_estimates

Logical; whether to sort the estimates in ascending order of magnitude from bottom to top. Defaults to FALSE.

dens_fill

String; color to fill the densities. Defaults to "grey60".

dens_col

String; color for the outlines of the densities. Default: NA.

Details

Requirements for data

The data frame must contain the following columns:

study

Unique sequential integers for each row in the data.

label

Text labels for each study (e.g. '"author (year)"“).

yi

Observed effect sizes.

sei

Standard errors.

Requirements for brms model

The meta-analytic model must be fitted with the following brms formula: yi | se(sei) ~ 1 + (1|study)

This function reproduces code for the geom_flat_violin.R (without which this function wouldn't work) by David Robinson (https://github.com/dgrtwo): https://gist.github.com/dgrtwo/eb7750e74997891d7c20, and Ben Marwick (https://github.com/benmarwick): https://gist.github.com/benmarwick/2a1bb0133ff568cbe28d.

Examples

1
2
3
4
5
6
## Not run: 
## Use a data frame called d
fit <- brm(yi | se(sei) ~ 1 + (1|study), data = d)
brms_forest(data = d, model = fit)

## End(Not run)

mvuorre/vmisc documentation built on May 23, 2019, 10:56 a.m.