sim estimated the operating characteristics (via simulation) of a design returned by des_one_stage or des_two_stage, under given response rate scenarios (see pi).

sim(
  des = ph2rand::des_one_stage(),
  pi = des$opchar[, 1:2],
  k = 1:des$J,
  replicates = 10000,
  summary = FALSE
)

Arguments

des

An object of class ph2rand_des, as returned by des_one_stage or des_two_stage. Defaults to ph2rand::des_one_stage().

pi

A numeric vector with two elements, or a numeric matrix or data.frame with two columns, giving the response rate scenarios to consider. The first element/column should correspond to the control arm and the second element/column to the experimental arm. Defaults to des$opchar[, 1:2].

k

A numeric vector indicating which stages to consider in determining the operating characteristics. That is, it will condition the calculations on the trial ending in the stages given in k. Defaults to 1:des$J (i.e., to all stages of the given design).

replicates

A numeric indicating the number of replicate simulations to use for each value of π. Defaults to 1e4.

summary

A logical variable indicating whether a summary of the function's progress should be printed to the console. Defaults to FALSE.

Value

A list with additional class "ph2rand_sim", containing each of the input parameters along with a tibble in the slot $sim, which gives the estimated operating characteristics.

See also

Examples

# The default two-stage design des <- des_two_stage() # Its operating characteristics under the uninteresting and interesting # scenarios sim <- sim(des) # The same operating characteristics, conditioning on the trial ending in # stage 2 sim <- sim(des, k = 2)