
Workflow of 'x_from_power()' Using the 'power_curve' Algorithm
Source:vignettes/articles/x_from_power_workflow.Rmd
x_from_power_workflow.Rmd
Goal
This technical appendix describes the workflow of
x_from_power()
in power4mome when using
the "power_curve"
algorithm.
x_from_power()
The following is the workflow of x_from_power()
, when
the algorithm "power_curve"
is used. Simulation is to be
done for each value of x
, and this can be slow when Monte
Carlo or bootstrapping confidence intervals are involved in the test. It
is not feasible, and also not necessary, to accurately estimate the
levels of power along many values across a range of x
, if
the goal is to find the value of x
with the target
power. Therefore, steps are taken to balance speed and precision when
finding the solution.
From Power to x (Sample Size or Effect Size [Parameter Value])
In x_from_power
, x
can be a sample size
(n
) or a population value (es
, “effect size”)
of the selected model parameter.
Annotation
-
by_x_1
- The collection of all values tried and their results. It is updated whenever new value(s) is/are tried.
-
fit_1
- The latest power curve estimated by
power_curve
, using the values tried, stored inby_x_1
. It is updated wheneverby_x_1
is updated.
- The latest power curve estimated by
-
x_j
- The value(s) for which power levels will be estimated in a trial.
-
nrep_j
- The number of replications to be used when estimate the power level
for a value of
x
. In a trial, the numbers of replications can be different for different values, for efficiency.
- The number of replications to be used when estimate the power level
for a value of
-
by_x_j
- The results for of
power4test_by_n()
orpower4test_by_es()
givenx_j
for a trial.
- The results for of
-
x_out
- The value of
x
which is a candidate solution (e.g., with estimated power closest to the target value).
- The value of
-
power_out
,nrep_out
,ci_out
,by_x_out
- Results based on
x_out
.
- Results based on
-
ci_hit
- Logical. Set to
TRUE
if there is at least one value ofx
with the confidence interval of the estimated power including the target power.
- Logical. Set to
-
final_nrep
- The desired number of replications for the solution. This value determines the desired level of precision (the width of the confidence interval) in the solution.
-
The sequences of values for
nrep
,R
, and the number ofx
in a trial.- The initial number of replications (
nrep
) can be smaller thanfinal_nrep
, such that the initial trials, though with lower precision (wider confidence intervals), are faster to run. As the solution is likely to be be found (values ofx
with estimated power close to the target value found),nrep
will be increased successively tofinal_nrep
, such that a trial is slower to run but has a higher precision. Other values that affect the speed, such as the number of values ofx
(xs_per_trial
) and the number of iterations (R
) in Monte Carlo confidence intervals and bootstrapping, are also increased successively.
- The initial number of replications (
-
x_final
- The value of
x
in the solution (e.g., with estimated power closest to the target value), if found.
- The value of
-
power_final
,nrep_final
,ci_final
,by_x_final
- Results based on
x_final
.
- Results based on
-
Main functions used
power4test_by_n()
andpower4test_by_es()
, for estimating the power levels for a set of values ofx
.power_curve()
, for estimating the relation between power and the value ofx
, based on the values ofx
having been examined.The internal function
estimate_x_range()
, for determining the value(s) ofx
to be examined in a trial, given the value(s) examined so far and the tentative power curve.