power_test | R Documentation |
Conducts a Monte-Carlo study on the test-power and alpha-error probability of a statistical function.
power_test(
design,
method = c("plm_level", "rand", "tauU"),
effect = "level",
n_sim = 100,
design_is_one_study = TRUE,
alpha_test = TRUE,
power_test = TRUE,
binom_test = FALSE,
binom_test_alpha = FALSE,
binom_test_power = FALSE,
binom_test_correct = FALSE,
ci = FALSE,
alpha_level = 0.05
)
design |
An object returned from the |
method |
A (named) list that defines the methods the power analysis is
based on. Each element can contain a function (that takes an scdf file and
returns a p value) or a character string (the name of predefined
functions). default |
effect |
Either "level" or "slope". The respective effect of the provided design is set to 0 when computing the alpha-error proportion. |
n_sim |
Number of sample studies created for the the Monte-Carlo study.
Default is |
design_is_one_study |
If TRUE, the design is assumed to define all cases
of one study that is repeatedly randomly created |
alpha_test |
Logical. If TRUE, alpha error is calculated. |
power_test |
Logical. If TRUE, power is calculated. |
binom_test |
Shortcut. When set TRUE, binom_test_power is set to 0.80, binom_test_alpha is set to 0.05, and binom_test_correct is set to 0.875. |
binom_test_alpha |
Either FALSE or a value. If a value is provided, a binomial test is calculated testing if the alpha error proportion is less than the provided value. |
binom_test_power |
Either FALSE or a value. If a value is provided, a binomial test is calculated testing if the power is greater than the provided value. |
binom_test_correct |
Either FALSE or a value. If a value is provided, a binomial test is calculated testing if the correct proportion is greater than the provided value. |
ci |
Either FALSE or a value. If a value is provided, confidence intervals at the provided level are calculated for power, alpha error, and correct proportions. |
alpha_level |
Alpha level used to calculate the proportion of
significant tests. Default is |
Based on a design()
object, a large number of single-cases are generated
and re-analyzed with a provided statistical function. The proportion of
significant analyzes is the test power. In a second step, a specified effect
of the design object is set to 0 and again single-cases are generated and
reanalyzed. The proportion of significant analyzes is the alpha error
probability.
Juergen Wilbert
random_scdf()
, design()
## Assume you want to conduct a single-case study with 15 measurements
## (phases: A = 6 and B = 9) using a highly reliable test and
## an expected level effect of d = 1.4.
## A (strong) trend effect is trend = 0.05. What is the power?
## (Note: n_sims is set to 10. Set n_sims to 1000 for a serious calculation.)
design <- design(
n = 1, phase_design = list(A = 6, B = 9),
rtt = 0.8, level = 1.4, trend = 0.05
)
power_test(design, n_sim = 10)
## Would you achieve higher power by setting up a MBD with three cases?
design <- design(
n = 3, phase_design = list(A = 6, B = 9),
rtt = 0.8, level = 1.4, trend = 0.05
)
power_test(design, n_sim=10, method=list("hplm_level", "rand", "tauU_meta"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.