binary_to_individual function

Generate individual-level binary outcome data from an aggregate statistics

Generate individual-level binary outcome data from an aggregate statistics

This is a helper function that is typically used automatically by some of baggr functions, such as when running model="logit" in baggr , when summary-level data are supplied.

binary_to_individual( data, group = "group", covariates = c(), rename_group = TRUE )

Arguments

  • data: A data frame with columns a, c and b/n1, d/n2. (You can also use ai, ci, n1i, n2i instead.)

  • group: Column name storing group

  • covariates: Column names in data that contain group-level variables to retain when expanding into individual-level data.frame

  • rename_group: If TRUE (default), this will rename the grouping variable to "group", making it easier to work with baggr

    See vignette("baggr_binary") for an example of use and notation details.

Returns

A data frame with columns group, outcome and treatment.

Examples

df_yusuf <- read.table(text=" trial a n1i c n2i Balcon 14 56 15 58 Clausen 18 66 19 64 Multicentre 15 100 12 95 Barber 10 52 12 47 Norris 21 226 24 228 Kahler 3 38 6 31 Ledwich 2 20 3 20 ", header=TRUE) bti <- binary_to_individual(df_yusuf, group = "trial") head(bti) # to go back to summary-level data prepare_ma(bti, effect = "logOR") # the last operation is equivalent to simply doing prepare_ma(df_yusuf, group="trial", effect="logOR")

See Also

prepare_ma uses this function

  • Maintainer: Witold Wiecek
  • License: GPL (>= 3)
  • Last published: 2024-02-12