Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

prepare_ma

Convert from individual to summary data in meta-analyses


Description

Allows one-way conversion from full to summary data. Input must be pre-formatted appropriately.

Usage

prepare_ma(
  data,
  effect = c("mean", "logOR", "logRR"),
  rare_event_correction = 0.25,
  log = FALSE,
  cfb = FALSE,
  summarise = TRUE,
  treatment = "treatment",
  baseline = NULL,
  group = "group",
  outcome = "outcome"
)

Arguments

data

data.frame of individual-level observations with columns for outcome (numeric), treatment (values 0 and 1) and group (numeric, character or factor); column names can be user-defined (see below)

effect

what effect to calculate? a mean (and SE) of outcome in groups or (for binary data) logOR (odds ratio), logRR (risk ratio);

rare_event_correction

If effect is logOR or logRR, this correction is used when working with binary data only. The value of correction is added to all arms in trials where some arms had 0 events. Using corrections may bias results but is the only alternative to avoid infinite values.

log

logical; log-transform the outcome variable?

cfb

logical; calculate change from baseline? If yes, the outcome variable is taken as a difference between values in outcome and baseline columns

summarise

logical; TRUE by default, but you can disable it to obtain converted (e.g. logged) data with columns renamed

treatment

name of column with treatment variable

baseline

name of column with baseline variable

group

name of the column with grouping variable

outcome

name of column with outcome variable

Details

The conversions done by this function are not typically needed and may happen automatically when data is fed to baggr. However, this function can be used to explicitly convert from full to reduced (summarised) data without analysing it in any model. It can be useful for examining your data.

If multiple operations are performed, they are taken in this order:

  1. conversion to log scale,

  2. calculating change from baseline,

  3. summarising data (using appropriate effect)

Value

  • If you summarise data.frame with columns for group tau and se.tau (for effect = "mean", also baseline means, for "logRR" or "logOR" also a, b, c, d, which correspond to typical contingency table notation).

  • If you do not summarise data, individual level data will be returned, but some columns may be renamed or transformed (see above).

Author(s)

Witold Wiecek

See Also

convert_inputs for how any type of data is (internally) converted into Stan inputs;


baggr

Bayesian Aggregate Treatment Effects

v0.4.0
GPL (>= 3)
Authors
Witold Wiecek [cre, aut], Rachael Meager [aut], Brice Green [ctb] (predict(), loo_compare, many visuals), Trustees of Columbia University [cph] (tools/make_cc.R)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.