A modified integer-based root-finding algorithm for determining the sample size required to achieve a target power. This function extends the uniroot integer search method to handle cases with stepwise power searches while considering constraints on search limits.
uniroot.integer.mod(
f,
power,
lower = lower,
upper = upper,
step.power = step.power,
step.up = step.up,
pos.side = pos.side,
maxiter = maxiter,
...
)
A list containing:
root
The integer value closest to the root on the correct side.
f.root
Value of f
at the estimated root.
iter
Number of function evaluations performed.
table.iter
A data frame showing estimated sample size (N
) and corresponding power at each iteration.
table.test
A data frame containing endpoint-level test results for each simulation and corresponding N
.
Function for which a root is needed.
Numeric. Target power value.
Integer. Minimum allowable root value.
Integer. Maximum allowable root value.
Numeric. Initial step size defined as 2^step.power
.
Logical. If TRUE
, the search increments from lower
; if FALSE
, it decrements from upper
.
Logical. If TRUE
, finds the closest integer i
such that f(i) > 0
.
Integer. Maximum number of iterations allowed.
Additional arguments passed to f
.