Wrapper function for complete binomial and normal function to compute power and type I error.

simulate(input, no_of_sim = 10000, .data = NULL)

Arguments

input

list. Input function for all inputs in binomial, normal, and survival.

no_of_sim

numeric. Number of simulations to run.

.data

NULL. Stores the proportion of control and treatment, please do not fill it in.

Value

A list with results of the simulation (power and type I error) and the input.

input

A list of input values used in the trial simulation.

power

data frame. A data frame with the interim look and power at each look.

type1_error

scalar. The type I error or the proportion of times the trial rejects the null when the parameters are simulated under the null hypothesis.

est_final

vector. The final estimate of the difference in posterior estimate of treatment and posterior estimate of the control group for all the simulations.

post_prob_accept_alternative

vector. The final probability of accepting the alternative for the simulations.

N_enrolled

vector. The number of patients enrolled in the trial (sum of control and experimental group for each simulation).

stop_futility

vector. Did the trial stop for futility during imputation of patient who had loss to follow up? 1 for yes and 0 for no.

stop_expected_success

vector. Did the trial stop for early success during imputation of patient who had loss to follow up? 1 for yes and 0 for no.