power | R Documentation |
power()
When you create R6 object "RCTtoolbox"
via link{create_RCTtoolbox}()
and run its method power()
,
the method internally implements a function
that performs power analysis.
The method power()
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 |
sd |
numeric. standard deviation (default is 1).
Absolute mean difference between two groups
is calculated by effect size times |
... |
arguments passed to |
R6 object with "RCTtoolbox.power.analysis" class. The returned object has following field and methods:
result
Field. Data frame including estimated result. See the section "Result Field."
print()
Method.
Print information about the returned object.
Run $print()
.
table()
Method.
Create output table of result.
Run $plot()
.
summary()
Method.
Print result in console.
Run $summary()
.
The R6 object with "RCTtoolbox.power.analysis" class has
result
field.
This field has a data frame with 8 variables:
Number of observations of control arm
Number of observations of each experimental arm
Factor. Experimental arms. The first level is control arm.
Effect size
Significant level
Power
Standard deviation
Absolute mean difference of two groups
A method power()
provided by R6 object RCTtoolbox
implements RCTtoolbox.power.analysis$new()
which generates R6 object with "RCTtoolbox.power.analysis" class.
Initialization of R6 object "RCTtoolbox.ttest" run
power_calculation(private$dvec, self$data, private$dvec.levels,
private$dvec.labels, ...)
where ...
accepts arguments explained in the section "Arguments."
The first four arguments passed to ttest_multi_mod_arm()
are
treat
Character. Treatment Variable.
The method power()
automatically
passes the private field dvec
of R6 object "RCTtoolbox"
to this argument.
data
data.frame/tibble object that you want to use.
The method power()
automatically
passes a public field data
of R6 object "RCTtoolbox"
to this argument.
treat_levels
character vector. Level of experimental arms.
The first element is control arm.
The method power()
automatically
passes the private field dvec.levels
of R6 object "RCTtoolbox"
to this argument.
treat_labels
character vector. Label of experimental arms
corresponding to treat_levels
.
The method power()
automatically
passes the private field dvec.labels
of R6 object "RCTtoolbox"
to this argument.
## Not run: data(RubellaNudge) rct <- create_RCTtoolbox( atest + avacc ~ treat, data = RubellaNudge, treat_levels = LETTERS[1:7] ) # calculate effect size rct$power(alpha = 0.05, power = 0.8)$summary() # calculate effect size with control arm "C" rct$power(alpha = 0.05, power = 0.8, ctrl = "C")$result ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.