rpact-com / rpact

rpact: Confirmatory Adaptive Clinical Trial Design and Analysis
https://rpact-com.github.io/rpact/
23 stars 5 forks source link

Index Error #47

Closed zhuob closed 2 months ago

zhuob commented 2 months ago

Dear rpact team,

Recently I used the package to do some simple simulation, and I experienced some issue "Error: index error". Below is the minimal code needed to reproduce the error. I looked into the getSimulationSurvival function, and it seems the problem is related to a C function "_rpact_getSimulationSurvivalCpp". Hope you can resolve the issue.

n_subj1 <- 3264

accrual_time1 <- getAccrualTime( accrualTime = c(0, (20/3), (20/3)2, (20/3)3), accrualIntensity = n_subj1 * c(0.10, 0.35, 0.55)/(20/3) )

design1 <- getDesignGroupSequential( typeOfDesign = "asHSD", gammaA = -8, informationRates = c(0.6, 1), beta = 0.1, alpha = 0.025 )

design_plan1 <- getSampleSizeSurvival( design1, pi2 = 0.0781, hazardRatio = 0.76, accrualTime = accrual_time1, eventTime = 12 )

sim1 <- getSimulationSurvival( design = design1, pi2 = 0.0781, directionUpper = FALSE, hazardRatio = 0.76, accrualTime = accrual_time1, eventTime = 12, plannedEvents = as.numeric(ceiling(design_plan1$eventsPerStage)), maxNumberOfIterations = 1e2, longTimeSimulationAllowed = TRUE, maxNumberOfRawDatasetsPerStage = 1e2 )

gwassmer commented 2 months ago

Strange, the code works for n_subj1 <- 3265 (or other values than 3264) Thank you, we will fix the issue!

fpahlke commented 2 months ago

Fixed in pull request 48.