convert_inputs: Convert inputs for baggr models
Description
Converts data to Stan inputs, checks integrity of data
and suggests default model if needed. Typically used
automatically by baggr but useful for debugging.
Usage
convert_inputs(data, model, quantiles, group = "group",
outcome = "outcome", treatment = "treatment", test_data = NULL)
Arguments
data
`data.frame`` with desired modelling input
model
valid model name used by baggr;
see baggr for allowed models
if model = NULL
, this function will try to find appropriate model
automatically
quantiles
vector of quantiles to use (only applicable if model = "quantiles"
)
group
name of the column with grouping variable
outcome
name of column with outcome variable (designated as string)
treatment
name of column with treatment variable
test_data
same format as data
argument, gets left aside for
testing purposes (see baggr)
Value
R structure that's appropriate for use by baggr Stan models;
group_label
, model
and n_groups
are included as attributes
and are necessary for baggr to work correctly
Details
Typically this function is only called within baggr and you do
not need to use it yourself. It can be useful to understand inputs
or to run models which you modified yourself.
Examples
Run this code# NOT RUN {
# simple meta-analysis example:
convert_inputs(schools, "rubin")
# }
Run the code above in your browser using DataLab