| balance | R Documentation |
balance()When you create R6 object "RCTtoolbox"
via create_RCTtoolbox
and run its method balance(),
the method internally implements a function
that performs balance test.
The method balance() provides some arguments.
See the section "Arguments."
ctrl |
character. New control arm.
If NULL (default),
the first element of |
subset |
subset condition.
If NULL (default),
full observations of |
weights |
weight variable for weighted least squares. If NULL (default), implement ordinary least squares. |
cluster |
cluster variable for clustered standard error. If NULL (default), standard error is not clustered. |
... |
arguments passed to |
R6 object with "RCTtoolbox.balance.test" class. The returned object has following field and methods:
resultField. Data frame including estimated result. See the section "Data Field."
print()Method.
Print information about the returned object.
Run $print().
table()Method.
Create output table of balance test.
Run $table().
The R6 object with "RCTtoolbox.balance.test" class has result field.
This field has a data frame with 3 variables:
Character. Covariates.
Factor. Label of experimental arms, f-value, degree of freedoms of F-distribution, p-value of F.
Numeric. Value corresponding to item.
The method balance() provided by R6 object RCTtoolbox
implements RCTtoolbox.balance.test$new()
which generates R6 object with "RCTtoolbox.balance.test" class.
Initialization of R6 object "RCTtoolbox.balance.test" run
balance_test_multi_var(private$xvec, private$dvec,
self$data, private$dvec.levels, private$dvec.labels, ...)
where ... accepts arguments explained in the section "Arguments."
The first five arguments passed to balance_test_multi_var() are
covariateCharacter vector. Covariate.
The method balance() automatically
passes the private field xvec of R6 object "RCTtoolbox"
to this argument.
treatCharacter vector. Treatment.
The method balance() automatically
passes the private field dvec of R6 object "RCTtoolbox"
to this argument.
datadata.frame/tibble object that you want to use.
The method ttest() automatically
passes a public field data of R6 object "RCTtoolbox"
to this argument.
treat_levelscharacter vector. Level of experimental arms.
The first element is control arm.
The method ttest() automatically
passes the private field dvec.levels of R6 object "RCTtoolbox"
to this argument.
treat_labelscharacter vector. Label of experimental arms
corresponding to treat_levels.
The method ttest() automatically
passes the private field dvec.labels of R6 object "RCTtoolbox"
to this argument.
## Not run:
data(RubellaNudge)
rct <- create_RCTtoolbox(
atest + avacc ~ treat,
~ age + educ,
RubellaNudge,
LETTERS[1:7]
)
# balance test
rct$balance()$result
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.