simulate function

Simulation wrapper for binomial and normal.

Simulation wrapper for binomial and normal.

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

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

Arguments

  • input: list. Input function for all inputs in binomial and normal .
  • no_of_sim: numeric. Number of simulations to run
  • .data: NULL. stores the proportion of control and treatment, please do not fill it in.

Returns

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 1 error or the number 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 simulation.
  • 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.