Skip to contents

simulate_mini repeatedly generates random data and then minimises with different specified burnin periods and/or minimisation probabilities. Its purpose is to guide decisions when designing a randomisation strategy for a randomised controlled trial.

Usage

simulate_mini(
  sampsize,
  factors,
  Nsims = 100,
  groups = 3,
  burnin,
  minprob,
  ratio = rep(1, groups)
)

Arguments

sampsize

the desired sample size of the data, i.e., the sample size of your prospective trial.

factors

a list of factors, each a list containing two items. The first is levels which is either a vector of the level names OR the number of levels. The second item is either props, a vector of proportions equal to the number of levels in the factor; OR prop.dist which is a named vector containing the mean and sd of the proportions.

Nsims

an integer, the number of simulations to run per scenario, default is 100.

groups

an integer, the number of groups to randomise, default is 3.

burnin

a vector of integers of possible burnin lengths before minimisation kicks in. Individual values must be > 0 and < total sample size.

minprob

a vector of the possible minimisation probabilities.

ratio

a numeric vector of randomisation ratios (must be of length equal to the number of groups).

Examples

simulate_mini(sampsize = 150,
              factors = list(sex = list(levels = c("M", "F"),
                                        props = c(0.5, 0.5)),
                             site = list(levels = 12,
                                         prop.dist = c(mean = 0.1, sd = 0.05))),
              Nsims = 10, groups = 3, burnin = c(10, 15),
              minprob = c(0.7, 0.8, 0.9), ratio = c(1,1,1))
#> Simulation of Multi-arm Minimisation 
#> --------------------------------------------------------------------------------
#> Number of simulations per scenario: 10 
#> Factors: sex, site 
#> Burnin options: 10, 15 
#> Minimisation probability options: 0.7, 0.8, 0.9 
#> Average group sizes:
#> | burnin| minprob|    A|    B|    C|
#> |------:|-------:|----:|----:|----:|
#> |     10|     0.7| 50.1| 49.6| 50.3|
#> |     15|     0.7| 49.2| 50.6| 50.2|
#> |     10|     0.8| 50.5| 49.4| 50.1|
#> |     15|     0.8| 50.2| 50.0| 49.8|
#> |     10|     0.9| 50.3| 49.9| 49.8|
#> |     15|     0.9| 50.5| 49.6| 49.9|
#> Average imbalance:
#> | burnin| minprob| imbalance|
#> |------:|-------:|---------:|
#> |     10|     0.7|      12.9|
#> |     15|     0.7|      12.2|
#> |     10|     0.8|       9.7|
#> |     15|     0.8|      10.4|
#> |     10|     0.9|       8.2|
#> |     15|     0.9|       8.9|