Simulation-Based Sample Size with Delayed Onset

library(progme)

Ignoring a 6-month delayed onset inflates the apparent treatment effect and underestimates the required sample size. power_pmrm() simulates the full operating characteristic:

p <- power_pmrm(n_per_arm = 100, effect_size = -0.5, delay = 6,
                n_sims = 50, seed = 1)
p[c("power", "bias", "non_convergence_rate")]
#> $power
#> [1] 1
#> 
#> $bias
#> [1] -0.01605068
#> 
#> $non_convergence_rate
#> [1] 0

Search a grid of sample sizes (keep simulations small for the demo):

ss <- find_sample_size(target_power = 0.8, n_grid = c(80, 120),
                       effect_size = -0.5, delay = 6,
                       n_sims = 30, seed = 2)
#> Simulating n = 80
#> Simulating n = 120
ss$power_curve
#>     n power
#> 1  80     1
#> 2 120     1