Defining Accrual Time and Accrual Intensity with rpact

Utilities
Survival
This document provides a technical overview on the different alternatives to define accrual time and accrual intensity with rpact.
Author
Published

February 16, 2024

Load the rpact package

library(rpact)
packageVersion("rpact") # version should be version 3.0 or later
[1] '4.0.0'

Case 1

End of accrual, absolute accrual intensity and maxNumberOfSubjects are given, followUpTime shall be calculated.

Example: vector based definition

accrualTime <- getAccrualTime(
    accrualTime = c(0, 6, 30),
    accrualIntensity = c(22, 33), maxNumberOfSubjects = 924
)
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity maxNumberOfSubjects piecewiseAccrualEnabled
TRUE FALSE TRUE TRUE TRUE 0 22 924 TRUE
TRUE FALSE TRUE TRUE TRUE 6 33 924 TRUE
TRUE FALSE TRUE TRUE TRUE 30 NA 924 TRUE

Example: list based definition

accrualTime <- getAccrualTime(
    list(
        "0 - <6" = 22,
        "6 - <= 30" = 33
    ),
    maxNumberOfSubjects = 924
)
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity maxNumberOfSubjects piecewiseAccrualEnabled
TRUE FALSE TRUE TRUE TRUE 0 22 924 TRUE
TRUE FALSE TRUE TRUE TRUE 6 33 924 TRUE
TRUE FALSE TRUE TRUE TRUE 30 NA 924 TRUE

Example: how to use accrual time object

kable(getSampleSizeSurvival(accrualTime = accrualTime, pi1 = 0.23, pi2 = 0.3))
stages pi1 thetaH0 typeOfComputation directionUpper pi2 median1 median2 lambda1 lambda2 hazardRatio maxNumberOfSubjects maxNumberOfEvents allocationRatioPlanned eventTime totalAccrualTime kappa followUpTime dropoutRate1 dropoutRate2 dropoutTime eventsFixed nFixed nFixed1 nFixed2 analysisTime studyDuration criticalValuesEffectScale
1 0.23 1 Schoenfeld FALSE 0.3 31.82436 23.3203 0.0217804 0.0297229 0.7327814 924 324.7912 1 12 30 1 3.655763 0 0 12 324.7912 924 462 462 33.65576 33.65576 0.8045209

Case 2

End of accrual, relative accrual intensity and maxNumberOfSubjects are given, absolute accrual intensity and followUpTime shall be calculated.

Example: vector based definition

accrualTime <- getAccrualTime(
    accrualTime = c(0, 6, 30),
    accrualIntensity = c(0.22, 0.33), maxNumberOfSubjects = 1000
)
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity accrualIntensityRelative maxNumberOfSubjects remainingTime piecewiseAccrualEnabled
TRUE FALSE TRUE TRUE FALSE 0 23.80952 0.22 1000 24 TRUE
TRUE FALSE TRUE TRUE FALSE 6 35.71429 0.33 1000 24 TRUE
TRUE FALSE TRUE TRUE FALSE 30 NA NA 1000 24 TRUE

Example: list based definition

accrualTime <- getAccrualTime(
    list(
        "0 - <6" = 0.22,
        "6 - <= 30" = 0.33
    ),
    maxNumberOfSubjects = 1000
)
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity accrualIntensityRelative maxNumberOfSubjects remainingTime piecewiseAccrualEnabled
TRUE FALSE TRUE TRUE FALSE 0 23.80952 0.22 1000 24 TRUE
TRUE FALSE TRUE TRUE FALSE 6 35.71429 0.33 1000 24 TRUE
TRUE FALSE TRUE TRUE FALSE 30 NA NA 1000 24 TRUE

Example: how to use accrual time object

kable(getSampleSizeSurvival(accrualTime = accrualTime, pi1 = 0.23, pi2 = 0.3))
stages pi1 thetaH0 typeOfComputation directionUpper pi2 median1 median2 lambda1 lambda2 hazardRatio maxNumberOfSubjects maxNumberOfEvents allocationRatioPlanned eventTime totalAccrualTime kappa followUpTime dropoutRate1 dropoutRate2 dropoutTime eventsFixed nFixed nFixed1 nFixed2 analysisTime studyDuration criticalValuesEffectScale
1 0.23 1 Schoenfeld FALSE 0.3 31.82436 23.3203 0.0217804 0.0297229 0.7327814 1000 324.7912 1 12 30 1 2.07338 0 0 12 324.7912 1000 500 500 32.07338 32.07338 0.8045209

Case 3

End of accrual and absolute accrual intensity are given, maxNumberOfSubjects and followUpTime shall be calculated.

Example: vector based definition

accrualTime <- getAccrualTime(accrualTime = c(0, 6, 30), accrualIntensity = c(22, 33))

Example: list based definition

accrualTime <- getAccrualTime(list(
    "0 - <6" = 22,
    "6 - <= 30" = 33
))
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity maxNumberOfSubjects remainingTime piecewiseAccrualEnabled
TRUE FALSE FALSE TRUE TRUE 0 22 924 24 TRUE
TRUE FALSE FALSE TRUE TRUE 6 33 924 24 TRUE
TRUE FALSE FALSE TRUE TRUE 30 NA 924 24 TRUE

Example: how to use accrual time object

kable(getSampleSizeSurvival(accrualTime = accrualTime, pi1 = 0.23, pi2 = 0.3))
stages pi1 thetaH0 typeOfComputation directionUpper pi2 median1 median2 lambda1 lambda2 hazardRatio maxNumberOfSubjects maxNumberOfEvents allocationRatioPlanned eventTime totalAccrualTime kappa followUpTime dropoutRate1 dropoutRate2 dropoutTime eventsFixed nFixed nFixed1 nFixed2 analysisTime studyDuration criticalValuesEffectScale
1 0.23 1 Schoenfeld FALSE 0.3 31.82436 23.3203 0.0217804 0.0297229 0.7327814 924 324.7912 1 12 30 1 3.655763 0 0 12 324.7912 924 462 462 33.65576 33.65576 0.8045209

Case 4

End of accrual, relative accrual intensity and followUpTime are given, absolute accrual intensity and maxNumberOfSubjects shall be calculated.

Example: vector based definition

accrualTime <- getAccrualTime(accrualTime = c(0, 6, 30), accrualIntensity = c(0.22, 0.33))
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity piecewiseAccrualEnabled
TRUE FALSE FALSE FALSE FALSE 0 0.22 TRUE
TRUE FALSE FALSE FALSE FALSE 6 0.33 TRUE
TRUE FALSE FALSE FALSE FALSE 30 NA TRUE

Example: list based definition

accrualTime <- getAccrualTime(list(
    "0 - <6" = 0.22,
    "6 - <= 30" = 0.33
))
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity piecewiseAccrualEnabled
TRUE FALSE FALSE FALSE FALSE 0 0.22 TRUE
TRUE FALSE FALSE FALSE FALSE 6 0.33 TRUE
TRUE FALSE FALSE FALSE FALSE 30 NA TRUE

Example: how to use accrual time object

kable(getSampleSizeSurvival(accrualTime = accrualTime, pi1 = 0.23, pi2 = 0.3, followUpTime = 6))
stages thetaH0 typeOfComputation directionUpper pi1 pi2 median1 median2 lambda1 lambda2 hazardRatio maxNumberOfEvents allocationRatioPlanned eventTime totalAccrualTime accrualIntensityRelative kappa followUpTime dropoutRate1 dropoutRate2 dropoutTime eventsFixed nFixed nFixed1 nFixed2 analysisTime studyDuration criticalValuesEffectScale
1 1 Schoenfeld FALSE 0.23 0.3 31.82436 23.3203 0.0217804 0.0297229 0.7327814 324.7912 1 12 30 0.22 1 6 0 0 12 324.7912 834.7082 417.3541 417.3541 36 36 0.8045209
1 1 Schoenfeld FALSE 0.23 0.3 31.82436 23.3203 0.0217804 0.0297229 0.7327814 324.7912 1 12 30 0.33 1 6 0 0 12 324.7912 834.7082 417.3541 417.3541 36 36 0.8045209

Case 5

maxNumberOfSubjects and absolute accrual intensity are given, end of accrual and followUpTime shall be calculated

Example: vector based definition

accrualTime <- getAccrualTime(
    accrualTime = c(0, 6),
    accrualIntensity = c(22, 33), maxNumberOfSubjects = 1000
)
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity maxNumberOfSubjects remainingTime piecewiseAccrualEnabled
FALSE FALSE TRUE TRUE TRUE 0.00000 22 1000 26.30303 TRUE
FALSE FALSE TRUE TRUE TRUE 6.00000 33 1000 26.30303 TRUE
FALSE FALSE TRUE TRUE TRUE 32.30303 NA 1000 26.30303 TRUE

Example: list based definition

accrualTime <- getAccrualTime(
    list(
        "0 - <6" = 22,
        "6" = 33
    ),
    maxNumberOfSubjects = 1000
)
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity maxNumberOfSubjects remainingTime piecewiseAccrualEnabled
FALSE FALSE TRUE TRUE TRUE 0.00000 22 1000 26.30303 TRUE
FALSE FALSE TRUE TRUE TRUE 6.00000 33 1000 26.30303 TRUE
FALSE FALSE TRUE TRUE TRUE 32.30303 NA 1000 26.30303 TRUE

Example: how to use accrual time object

kable(getSampleSizeSurvival(accrualTime = accrualTime, pi1 = 0.23, pi2 = 0.3))
stages pi1 thetaH0 typeOfComputation directionUpper pi2 median1 median2 lambda1 lambda2 hazardRatio maxNumberOfSubjects maxNumberOfEvents allocationRatioPlanned eventTime totalAccrualTime kappa followUpTime dropoutRate1 dropoutRate2 dropoutTime eventsFixed nFixed nFixed1 nFixed2 analysisTime studyDuration criticalValuesEffectScale
1 0.23 1 Schoenfeld FALSE 0.3 31.82436 23.3203 0.0217804 0.0297229 0.7327814 1000 324.7912 1 12 32.30303 1 1.077175 0 0 12 324.7912 1000 500 500 33.38021 33.38021 0.8045209

Case 6 (not possible)

maxNumberOfSubjects and relative accrual intensity are given, absolute accrual intensity[x], end of accrual and followUpTime shall be calculated

Example: vector based definition

accrualTime <- getAccrualTime(
    accrualTime = c(0, 6),
    accrualIntensity = c(0.22, 0.33),
    maxNumberOfSubjects = 1000
)
Warning: The specified accrual time and intensity cannot be supplemented
automatically with the missing information; therefore further calculations are
not possible
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity maxNumberOfSubjects piecewiseAccrualEnabled
FALSE FALSE TRUE TRUE FALSE 0 0.22 1000 TRUE
FALSE FALSE TRUE TRUE FALSE 6 0.33 1000 TRUE

Example: list based definition

accrualTime <- getAccrualTime(
    list(
        "0 - <6" = 0.22,
        "6" = 0.33
    ),
    maxNumberOfSubjects = 1000
)
Warning: The specified accrual time and intensity cannot be supplemented
automatically with the missing information; therefore further calculations are
not possible
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity maxNumberOfSubjects piecewiseAccrualEnabled
FALSE FALSE TRUE TRUE FALSE 0 0.22 1000 TRUE
FALSE FALSE TRUE TRUE FALSE 6 0.33 1000 TRUE

Example: how to use accrual time object

Case 6 is not allowed and therefore an error will be shown:

tryCatch(
    {
        getSampleSizeSurvival(accrualTime = accrualTime, pi1 = 0.23, pi2 = 0.3)
    },
    error = function(e) {
        print(e$message)
    }
)
[1] "Illegal argument: the calculation of 'followUpTime' for given 'maxNumberOfSubjects' and relative accrual intensities (< 1) can only be done if end of accrual is defined"

Case 7

followUpTime and absolute accrual intensity are given,
end of accrual and maxNumberOfSubjects shall be calculated

Example: vector based definition

accrualTime <- getAccrualTime(accrualTime = c(0, 6), accrualIntensity = c(22, 33))
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity piecewiseAccrualEnabled
FALSE TRUE FALSE FALSE TRUE 0 22 FALSE
FALSE TRUE FALSE FALSE TRUE 6 33 FALSE

Example: list based definition

accrualTime <- getAccrualTime(list(
    "0 - <6" = 22,
    "6" = 33
))
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity piecewiseAccrualEnabled
FALSE TRUE FALSE FALSE TRUE 0 22 FALSE
FALSE TRUE FALSE FALSE TRUE 6 33 FALSE

Example: how to use accrual time object

kable(getSampleSizeSurvival(
    accrualTime = accrualTime,
    pi1 = 0.4, pi2 = 0.2, followUpTime = 6
))
stages pi1 thetaH0 typeOfComputation directionUpper pi2 median1 median2 lambda1 lambda2 hazardRatio maxNumberOfSubjects maxNumberOfEvents allocationRatioPlanned eventTime totalAccrualTime kappa followUpTime dropoutRate1 dropoutRate2 dropoutTime eventsFixed nFixed nFixed1 nFixed2 analysisTime studyDuration criticalValuesEffectScale
1 0.4 1 Schoenfeld TRUE 0.2 16.28299 37.2754 0.0425688 0.0185953 2.289224 186.0807 45.77028 1 12 7.63881 1 6.000001 0 0 12 45.77028 186.0807 93.04036 93.04036 13.63881 13.63881 1.784986

Case 8 (not possible)

followUpTime and relative accrual intensity are given,
absolute accrual intensity[x], end of accrual and maxNumberOfSubjects shall be calculated

Example: vector based definition

accrualTime <- getAccrualTime(accrualTime = c(0, 6), accrualIntensity = c(0.22, 0.33))
Warning: The specified accrual time and intensity cannot be supplemented
automatically with the missing information; therefore further calculations are
not possible
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity piecewiseAccrualEnabled
FALSE TRUE FALSE FALSE FALSE 0 0.22 FALSE
FALSE TRUE FALSE FALSE FALSE 6 0.33 FALSE

Example: list based definition

accrualTime <- getAccrualTime(list(
    "0 - <6" = 0.22,
    "6" = 0.33
))
Warning: The specified accrual time and intensity cannot be supplemented
automatically with the missing information; therefore further calculations are
not possible
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity piecewiseAccrualEnabled
FALSE TRUE FALSE FALSE FALSE 0 0.22 FALSE
FALSE TRUE FALSE FALSE FALSE 6 0.33 FALSE

Example: how to use accrual time object

Case 8 is not allowed and therefore an error will be shown:

tryCatch(
    {
        getSampleSizeSurvival(accrualTime = accrualTime, pi1 = 0.23, pi2 = 0.3, followUpTime = 6)
    },
    error = function(e) {
        print(e$message)
    }
)
[1] "Illegal argument: the calculation of 'maxNumberOfSubjects' for given 'followUpTime' and relative accrual intensities (< 1) can only be done if end of accrual is defined"

How to show accrual time details

You can use a sample size or power object as argument for function getAccrualTime:

sampleSize <- getSampleSizeSurvival(
    accrualTime = c(0, 6), accrualIntensity = c(22, 53),
    lambda2 = 0.05, hazardRatio = 0.8, followUpTime = 6
)
kable(sampleSize)
stages hazardRatio thetaH0 typeOfComputation directionUpper median1 median2 lambda1 lambda2 maxNumberOfSubjects maxNumberOfEvents allocationRatioPlanned totalAccrualTime kappa piecewiseSurvivalTime followUpTime dropoutRate1 dropoutRate2 dropoutTime eventsFixed nFixed nFixed1 nFixed2 analysisTime studyDuration criticalValuesEffectScale
1 0.8 1 Schoenfeld FALSE 17.32868 13.86294 0.04 0.05 1205.866 630.5202 1 26.26162 1 0 5.999998 0 0 12 630.5202 1205.866 602.9329 602.9329 32.26162 32.26162 0.8554657
accrualTime <- getAccrualTime(sampleSize)
kable(accrualTime)
endOfAccrualIsUserDefined followUpTimeMustBeUserDefined maxNumberOfSubjectsIsUserDefined maxNumberOfSubjectsCanBeCalculatedDirectly absoluteAccrualIntensityEnabled accrualTime accrualIntensity piecewiseAccrualEnabled
FALSE TRUE FALSE FALSE TRUE 0 22 FALSE
FALSE TRUE FALSE FALSE TRUE 6 53 FALSE

System: rpact 4.0.0, R version 4.3.3 (2024-02-29 ucrt), platform: x86_64-w64-mingw32

To cite R in publications use:

R Core Team (2024). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/. To cite package ‘rpact’ in publications use:

Wassmer G, Pahlke F (2024). rpact: Confirmatory Adaptive Clinical Trial Design and Analysis. R package version 4.0.0, https://www.rpact.com, https://github.com/rpact-com/rpact, https://rpact-com.github.io/rpact/, https://www.rpact.org.