minimize | R Documentation |
minimize
takes an unconditional score and
a constraint set (or no constraint) and solves the corresponding
minimization problem using
nloptr
(using COBYLA by default).
An initial design has to be defined. It is also possible to define
lower- and upper-boundary designs. If this is not done, the boundaries are
determined automatically heuristically.
minimize(
objective,
subject_to,
initial_design,
lower_boundary_design = get_lower_boundary_design(initial_design),
upper_boundary_design = get_upper_boundary_design(initial_design),
c2_decreasing = FALSE,
check_constraints = TRUE,
opts = list(algorithm = "NLOPT_LN_COBYLA", xtol_rel = 1e-05, maxeval = 10000),
...
)
objective |
objective function |
subject_to |
constraint collection |
initial_design |
initial guess (x0 for nloptr) |
lower_boundary_design |
design specifying the lower boundary. |
upper_boundary_design |
design specifying the upper boundary |
c2_decreasing |
if TRUE, the c2_pivots are forced to be monotonically decreasing |
check_constraints |
if TRUE, it is checked if constrains are fulfilled |
opts |
options list passed to nloptr |
... |
further optional arguments passed to |
a list with elements:
design |
The resulting optimal design |
nloptr_return |
Output of the corresponding nloptr call |
call_args |
The arguments given to the optimization call |
# Define Type one error rate
toer <- Power(Normal(), PointMassPrior(0.0, 1))
# Define Power at delta = 0.4
pow <- Power(Normal(), PointMassPrior(0.4, 1))
# Define expected sample size at delta = 0.4
ess <- ExpectedSampleSize(Normal(), PointMassPrior(0.4, 1))
# Compute design minimizing ess subject to power and toer constraints
minimize(
ess,
subject_to(
toer <= 0.025,
pow >= 0.9
),
initial_design = TwoStageDesign(50, .0, 2.0, 60.0, 2.0, 5L)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.