Learn R Programming

adoptr (version 0.1.1)

subject_to: Create a collection of constraints

Description

subject_to(...) can be used to generate an object of class ConstraintsCollection from an arbitrary number of (un)conditional constraints.

Usage

subject_to(...)

Arguments

...

arbitrary number of (un)conditional constraints

Value

an object of class ConstraintsCollection

See Also

subject_to can be used for the constraints in minimize.

Examples

Run this code
# NOT RUN {
# Define Type one error rate
toer <- expected(ConditionalPower(Normal(), PointMassPrior(0.0, 1)))

# Define Power at delta = 0.4
pow <- expected(ConditionalPower(Normal(), PointMassPrior(0.4, 1)))

# Define expected sample size at delta = 0.4
ess <- expected(ConditionalSampleSize(Normal(), PointMassPrior(0.4, 1)))

# Compute design minimizing ess subject to power and toer constraints
# }
# NOT RUN {
minimize(
   ess,
   subject_to(
      toer <= 0.025,
      pow  >= 0.9
   ),
   initial_design = TwoStageDesign(50, .0, 2.0, 60.0, 2.0, 5L)
)
# }

Run the code above in your browser using DataLab