Allows one-way conversion from full to summary data. Input must be pre-formatted appropriately.
prepare_ma(data, log = FALSE, cfb = FALSE, summarise = TRUE,
treatment = "treatment", baseline = NULL, group = "group",
outcome = "outcome")
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)
logical; log-transform the outcome variable?
logical; calculate change from baseline? If yes, the outcome
variable is taken as a difference between values in outcome
and
baseline
columns
logical; convert to aggregate level data?
name of column with treatment variable
name of column with baseline variable
name of the column with grouping variable
name of column with outcome variable
data.frame with columns mu
, se.mu
,
tau
and se.tau
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:
conversion to log scale,
calculating change from baseline,
summarising data.
convert_inputs for how data is converted into Stan inputs;