View source: R/power4test_by_pop_es.R
power4test_by_es | R Documentation |
Estimate power for a set of effect sizes (population values of a model parameter).
power4test_by_es(
object,
pop_es_name = NULL,
pop_es_values = NULL,
progress = TRUE,
...,
by_seed = NULL,
by_nrep = NULL,
save_sim_all = TRUE
)
## S3 method for class 'power4test_by_es'
c(..., sort = TRUE, skip_checking_models = FALSE)
as.power4test_by_es(original_object, pop_es_name)
## S3 method for class 'power4test_by_es'
print(x, print_all = FALSE, digits = 3, ...)
object |
A |
pop_es_name |
The name of the
parameter. See the help page
of |
pop_es_values |
A numeric
vector of the population values
of the parameter specified in
|
progress |
Logical. Whether progress of the simulation will be displayed. |
... |
For |
by_seed |
If set to a number,
it will be used to generate the
seeds for each call to |
by_nrep |
If set to a number,
it will be used to generate the
number of replications ( |
save_sim_all |
If |
sort |
WHen combining the
objects, whether they will be sorted
by population values. Default is |
skip_checking_models |
Whether
the check of the data generation model
will be checked. Default is |
original_object |
The object
to be converted to a |
x |
The object to be printed. |
print_all |
If |
digits |
The numbers of digits displayed after the decimal. |
The function power4test_by_es()
regenerates
datasets for a set of effect sizes
(population values of a model parmeter)
and does the stored tests in each of
them.
Optionally, it can also be run
on a object with no stored tests.
In this case, additional arguments
must be set to instruct power4test()
on the tests to be conducted.
It is usually used to examine the power over a sets of effect sizes (population values).
The c
method of power4test_by_es
objects
is used to combine tests from different
runs of power4test_by_es()
.
The function as.power4test_by_es()
is used to convert a power4test
object to a power4test_by_es
object, if it is not already one.
Useful when concatenating
power4test
objects with
power4test_by_es
objects.
The function
power4test_by_es()
returns a
power4test_by_es
object, which is a
list of power4test
objects, one for
each population value of the parameter.
The method c.power4test_by_es()
returns
a power4test_by_es
object with
all the elements (tests for different
values of pop_es_values
) combined.
The function as.power4test_by_es()
returns
a power4test_by_es
object converted
from the input object.
The print
-method of power4test_by_es
objects returns the object invisibly.
It is called for its side-effect.
power4test()
# Specify the model
model_simple_med <-
"
m ~ x
y ~ m + x
"
# Specify the population values
model_simple_med_es <-
"
m ~ x: m
y ~ m: l
y ~ x: n
"
sim_only <- power4test(nrep = 2,
model = model_simple_med,
pop_es = model_simple_med_es,
n = 100,
R = 40,
ci_type = "boot",
fit_model_args = list(fit_function = "lm"),
do_the_test = FALSE,
iseed = 1234)
test_out <- power4test(object = sim_only,
test_fun = test_indirect_effect,
test_args = list(x = "x",
m = "m",
y = "y",
boot_ci = TRUE,
mc_ci = FALSE))
out <- power4test_by_es(test_out,
pop_es_name = "y ~ m",
pop_es_values = c(.10, .20))
out_reject <- rejection_rates(out)
out_reject
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.