View source: R/Method-internal-ttest.r
ttest | R Documentation |
ttest()
When you create R6 object "RCTtoolbox"
via create_RCTtoolbox
and run its method ttest()
,
the method internally implements a function
that performs two-sided t-test or permutation test.
The method ttest()
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. If NULL (default), unbiased unweighted average and std.err. is calculated. |
bootse |
integer. Number of bootstrap samples to calculate std.err. of mean. If 0 (default), theoretical std.err. of mean is calculated. |
bootp |
integer. If 0 (default), welch two-sided t-test is implemented. If 1 or more, the permutation test is implemented (the number of permutations that randomly reallocate assignment to keep the sample size collected from each group). |
seed |
integer.
Seed value passed to the argument of |
R6 object with "RCTtoolbox.ttest" 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()
.
plot()
Method.
Visualization of result.
Run $plot()
.
summary()
Method.
Print result in console.
Run $summary()
.
The R6 object with "RCTtoolbox.ttest" class has result
field.
This field has a data frame with 13 variables:
Outcome average of each experimental arm
Std.err. of outcome average of each experimental arm
Number of observations of each experimental arm
Outcome average of control arm
Std.err. of outcome average of control arm
Number of observations of control arm
Difference between "mean1" - "mean0"
t-statistics when bootp = 0L
(Two-sided t-test)
degree of freedom of t-distribution
when bootp = 0L
(Two-sided t-test)
p-value of difference mean test.
Pr(>|t|) when bootp = 0L
(Two-sided t-test).
Pr(>|diff|) when bootp > 0L
(Permutation test).
Character. Method of difference mean test.
Factor. Experimental arms. The first level is control arm.
Character. Outcome variable.
A method ttest()
provided by R6 object RCTtoolbox
implements RCTtoolbox.ttest$new()
which generates R6 object with "RCTtoolbox.ttest" class.
Initialization of R6 object "RCTtoolbox.ttest" run
ttest_multi_mod_arm(private$formula.yd, 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
baseline
list of two-sided formula outcome ~ treat
.
The method ttest()
automatically
passes the private field formula.yd
of R6 object "RCTtoolbox"
to this argument.
data
data.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_levels
character 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_labels
character 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, data = RubellaNudge, treat_levels = LETTERS[1:7] ) # two-sided t-test rct$ttest() # permutation test with control arm "C" rct$ttest(bootp = 50, ctrl = "C") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.