| set_vars | R Documentation |
This function is used to define the names of key variables within the data.frame's
that are provided as input arguments to draws() and ancova().
set_vars(
subjid = "subjid",
visit = "visit",
outcome = "outcome",
group = "group",
covariates = character(0),
strata = group,
strategy = "strategy",
group_contrasts = NULL
)
subjid |
The name of the "Subject ID" variable. A length 1 character vector. |
visit |
The name of the "Visit" variable. A length 1 character vector. |
outcome |
The name of the "Outcome" variable. A length 1 character vector. |
group |
The name of the "Group" variable. A length 1 character vector. |
covariates |
The name of any covariates to be used in the context of modelling. See details. |
strata |
The name of the any stratification variable to be used in the context of bootstrap sampling. See details. |
strategy |
The name of the "strategy" variable. A length 1 character vector. |
group_contrasts |
Optional specification of the treatment-group contrasts to be
estimated by
Each element must be named; the name is used as the output |
In both draws() and ancova() the covariates argument can be specified to indicate
which variables should be included in the imputation and analysis models respectively. If you wish
to include interaction terms these need to be manually specified i.e.
covariates = c("group*visit", "age*sex"). Please note that the use of the I() function to
inhibit the interpretation/conversion of objects is not supported.
The group_contrasts argument is only used by ancova(). If NULL (default) a
treatment effect is estimated for every non-reference group versus the reference group
(the first factor level of group). Alternatively a bespoke set of contrasts can be
requested. Pairwise contrasts are given as length-2 character vectors, e.g.
group_contrasts = list(c("A", "Placebo"), c("B", "Placebo")) requests the contrasts
A - Placebo and B - Placebo. More general linear contrasts are given as named
numeric weight vectors over the group levels, e.g.
group_contrasts = list(pooled_vs_pbo = c(Placebo = -1, A = 0.5, B = 0.5)) contrasts
the average of A and B against Placebo. List names are carried through to the
contrast_label column of the pool() output; weight-vector contrasts must be named.
See ancova() for the resulting parameter naming scheme.
Currently strata is only used by draws() in combination with method_condmean(type = "bootstrap")
and method_approxbayes() in order to allow for the specification of stratified bootstrap sampling.
By default strata is set equal to the value of group as it is assumed most users will want to
preserve the group size between samples. See draws() for more details.
Likewise, currently the strategy argument is only used by draws() to specify the name of the
strategy variable within the data_ice data.frame. See draws() for more details.
A vars object; a named list of class ivars recording the names of the key
variables (subjid, visit, outcome, group, covariates, strata and
strategy) used throughout rbmi by functions such as draws(), ancova()
and analyse().
draws()
ancova()
## Not run:
# Using CDISC variable names as an example
set_vars(
subjid = "usubjid",
visit = "avisit",
outcome = "aval",
group = "arm",
covariates = c("bwt", "bht", "arm * avisit"),
strategy = "strat"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.