Calculate operating characteristics for RCT against SOC, using the predictive probability method with beta priors
Source:R/ocRctPredprobDist.R
ocRctPredprobDist.Rd
We emulate a randomized-controlled trial setting where at any given sample size, there exists the number of patients enrolled in either standard of care (SOC) or control arm, and a treatment or experimental arm. The allocation of patients will depend on the randomization ratio set by the user and is rounded to the next higher integer. Therefore the sequence of patients is determined from the start, such that the number of patients in both arms is constant across trial simulations, however the number of patients within the control and treatment arm is determined by the randomisation ratio. Interim looks are for sample sizes below that of the final sample size.
Arguments
- nnE
(
numeric
):
sample size or sizes where study can be stopped for Efficacy decision. If0
orNULL
andlength(nnE) = 1
then no Efficacy looks are performed.- pE
(
number
):
Response rate in Treatment group.- pS
(
number
):
Response rate in Control group.- deltaE
(
number
):
margin by which the response rate in the treatment group should be better than in the standard of care or control orS
group in Efficacy looks only. Note that this can also be negative as well.- deltaF
(
number
):
margin by which the response rate in the treatment group should be better than in the standard of care or control orS
group in Futility looks only. Note that this can also be negative as well.- phiL
(
number
):
lower threshold on the predictive probability.- phiFu
(
number
):
upper threshold on the predictive probability.- phiU
(
number
):
upper threshold on the predictive probability.- relativeDelta
(
flag
):
IfTRUE
, then arelativeDelta
is used. Represents that a minimum response rate in magnitude ofdelta
of theS
non-responding patients. SeepostprobDist()
.- tT
(
number
):
threshold of which assumedtruep
exceeds acceptable threshold ofp0
.- tF
(
number
):
threshold of which assumedtruep
does not exceed threshold ofp1
.- parE
(
numeric
):
alpha and beta parameters for the prior on the treatment population. Default set at alpha = 1, beta = 1, or uniform prior.- parS
(
numeric
):
parameters for beta distribution. If it is a matrix, it needs to have 2 columns, and each row corresponds to each component of a beta-mixture distribution for theS
group.- weights
(
numeric
):
the mixture weights of the beta mixture prior.- weightsS
(
numeric
):
weights for theS
group.- randRatio
(
numeric
):
The randomisation ratio between treatment and control. Must be greater than 0 and maximum of 1.- sim
(
number
):
number of simulations.- wiggle
(
flag
):
generate random look locations (not default). Ifwiggle = TRUE
andnnE = nnF
, then all wiggled looks are the same betweennnE
andnnF
.- nnF
(
numeric
):
sample size or sizes where study can be stopped for Efficacy decision. If0
orNULL
andlength(nnF) = 1
then no Futility looks are performed.- decision1
(
flag
):
Flag ifdecision1 = TRUE
then Decision 1 rules will be used, otherwise Decision 2 rules will be used.
Details
Final looks are only performed at the maximum sample size.
At each interim or final look, a futility or efficacy or both can be performed.
The rules for Stop, Go and Gray Zone (where applicable), and use of beta priors are the same
as in ocPredprobDist()
where the only difference here is to emulate a
randomized-controlled trial setting.
The returned value is a list with the following elements:
oc
: matrix with operating characteristics with the following details:ExpectedN
: expected number of patients in the trials in both treatment and SOC groupExpectedNactive
: the mean of the number of patients in treatment armExpectedNcontrol
: the mean of the number of patients in control armPrStopEarly
: probability to stop the trial early (before reaching the maximum sample size)PrEarlyEff
: probability of Early Go decisionPrEarlyFut
: probability of Early Stop decisionPrEfficacy
: probability of Go decisionPrFutility
: probability of Stop decisionPrGrayZone
: probability of Evaluate or "Gray Zone" decision (between Go and Stop)Decision
: results inlogical
withTRUE
as Go,FALSE
as Stop andNA
as Evaluate decision.SampleSize
: numeric of sample sizes fromnnE
ornnF
or both.SampleSizeActive
: numeric of sample sizes in the treatment or experimental arm.SampleSizeControl
: numeric of sample sizes in either standard of care (SOC) or control arm.union_nn
: uniquennE
andnnF
looks.wiggled_nnE
: user input fornnE
with random distance applied.wiggled_nnF
: user input fornnF
with random distance applied.wiggled_dist
: magnitude of random distance applied in order of input looks.params
: all user input arguments.
Examples
# When `relativeDelta = TRUE`:
set.seed(2000)
ocRctPredprobDist(
nnE = c(10, 20, 30),
pE = 0.3,
pS = 0.3,
deltaE = 0.2,
deltaF = 0.1,
phiU = 0.8,
phiFu = 0.2,
relativeDelta = TRUE,
tT = 0.6,
tF = 0.4,
parE = c(a = 1, b = 1),
parS = c(a = 1, b = 1),
weights = 1,
weightsS = 1,
randRatio = 1,
sim = 50,
wiggle = FALSE,
nnF = c(10, 20, 30),
decision1 = TRUE
)
#> Warning: Advise to use sim >= 50000 to achieve convergence
#> $oc
#> ExpectedN PrStopEarly PrEarlyEff PrEarlyFut PrEfficacy PrFutility PrGrayZone
#> 1 11.2 0.96 0.12 0.84 0.14 0.84 0.02
#> ExpectedNactive ExpectedNcontrol
#> 1 5.62 5.58
#>
#> $Decision
#> [1] NA FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [13] FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> [25] FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
#> [37] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE TRUE
#> [49] FALSE FALSE
#>
#> $SampleSize
#> [1] 30 10 10 10 10 10 10 10 10 10 10 10 10 30 10 10 10 10 20 10 10 10 10 10 10
#> [26] 10 10 10 10 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
#>
#> $SampleSizeActive
#> [1] 15 5 5 5 5 6 5 5 4 3 3 5 4 15 6 7 6 6 9 4 3 5 7 5 4
#> [26] 7 6 4 4 11 7 4 8 5 6 6 4 4 4 6 6 7 3 3 3 5 7 3 5 6
#>
#> $SampleSizeControl
#> [1] 15 5 5 5 5 4 5 5 6 7 7 5 6 15 4 3 4 4 11 6 7 5 3 5 6
#> [26] 3 4 6 6 9 3 6 2 5 4 4 6 6 6 4 4 3 7 7 7 5 3 7 5 4
#>
#> $union_nn
#> [1] 10 20 30
#>
#> $wiggled_nnE
#> [1] 10 20 30
#>
#> $wiggled_nnF
#> [1] 10 20 30
#>
#> $wiggle_dist
#> [1] NA
#>
#> $params
#> $params[[1]]
#> ocRctPredprobDist
#>
#> $params$nnE
#> c(10, 20, 30)
#>
#> $params$pE
#> [1] 0.3
#>
#> $params$pS
#> [1] 0.3
#>
#> $params$deltaE
#> [1] 0.2
#>
#> $params$deltaF
#> [1] 0.1
#>
#> $params$phiFu
#> [1] 0.2
#>
#> $params$phiU
#> [1] 0.8
#>
#> $params$relativeDelta
#> [1] TRUE
#>
#> $params$tT
#> [1] 0.6
#>
#> $params$tF
#> [1] 0.4
#>
#> $params$parE
#> c(a = 1, b = 1)
#>
#> $params$parS
#> c(a = 1, b = 1)
#>
#> $params$weights
#> [1] 1
#>
#> $params$weightsS
#> [1] 1
#>
#> $params$randRatio
#> [1] 1
#>
#> $params$sim
#> [1] 50
#>
#> $params$wiggle
#> [1] FALSE
#>
#> $params$nnF
#> c(10, 20, 30)
#>
#> $params$decision1
#> [1] TRUE
#>
#>
# When `relativeDelta = FALSE`:
set.seed(2000)
ocRctPredprobDist(
nnE = c(10, 20, 30),
pE = 0.3,
pS = 0.3,
deltaE = 0.2,
deltaF = 0.1,
phiU = 0.8,
phiFu = 0.2,
relativeDelta = FALSE,
tT = 0.6,
tF = 0.4,
parE = c(a = 1, b = 1),
parS = c(a = 1, b = 1),
weights = 1,
weightsS = 1,
randRatio = 1,
sim = 50,
wiggle = FALSE,
nnF = c(10, 20, 30),
decision1 = TRUE
)
#> Warning: Advise to use sim >= 50000 to achieve convergence
#> $oc
#> ExpectedN PrStopEarly PrEarlyEff PrEarlyFut PrEfficacy PrFutility PrGrayZone
#> 1 11 0.98 0.04 0.94 0.04 0.94 0.02
#> ExpectedNactive ExpectedNcontrol
#> 1 5.5 5.5
#>
#> $Decision
#> [1] NA FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [25] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [37] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> [49] FALSE FALSE
#>
#> $SampleSize
#> [1] 30 10 10 10 10 10 10 10 10 10 10 10 10 20 10 10 10 10 10 10 10 10 10 10 10
#> [26] 10 10 10 10 10 10 10 10 10 10 20 10 10 10 10 10 10 10 10 10 10 10 20 10 10
#>
#> $SampleSizeActive
#> [1] 15 5 5 5 5 6 5 5 4 3 3 5 4 9 6 7 6 6 5 4 3 5 7 5 4
#> [26] 7 6 4 4 5 7 4 8 5 6 11 4 4 4 6 6 7 3 3 3 5 7 8 5 6
#>
#> $SampleSizeControl
#> [1] 15 5 5 5 5 4 5 5 6 7 7 5 6 11 4 3 4 4 5 6 7 5 3 5 6
#> [26] 3 4 6 6 5 3 6 2 5 4 9 6 6 6 4 4 3 7 7 7 5 3 12 5 4
#>
#> $union_nn
#> [1] 10 20 30
#>
#> $wiggled_nnE
#> [1] 10 20 30
#>
#> $wiggled_nnF
#> [1] 10 20 30
#>
#> $wiggle_dist
#> [1] NA
#>
#> $params
#> $params[[1]]
#> ocRctPredprobDist
#>
#> $params$nnE
#> c(10, 20, 30)
#>
#> $params$pE
#> [1] 0.3
#>
#> $params$pS
#> [1] 0.3
#>
#> $params$deltaE
#> [1] 0.2
#>
#> $params$deltaF
#> [1] 0.1
#>
#> $params$phiFu
#> [1] 0.2
#>
#> $params$phiU
#> [1] 0.8
#>
#> $params$relativeDelta
#> [1] FALSE
#>
#> $params$tT
#> [1] 0.6
#>
#> $params$tF
#> [1] 0.4
#>
#> $params$parE
#> c(a = 1, b = 1)
#>
#> $params$parS
#> c(a = 1, b = 1)
#>
#> $params$weights
#> [1] 1
#>
#> $params$weightsS
#> [1] 1
#>
#> $params$randRatio
#> [1] 1
#>
#> $params$sim
#> [1] 50
#>
#> $params$wiggle
#> [1] FALSE
#>
#> $params$nnF
#> c(10, 20, 30)
#>
#> $params$decision1
#> [1] TRUE
#>
#>
# Only one Futility look:
set.seed(2000)
ocRctPredprobDist(
nnE = c(10, 20, 30),
pE = 0.3,
pS = 0.3,
deltaE = 0.2,
deltaF = 0.1,
phiU = 0.8,
phiFu = 0.2,
relativeDelta = FALSE,
tT = 0.6,
tF = 0.4,
parE = c(a = 1, b = 1),
parS = c(a = 1, b = 1),
weights = 1,
weightsS = 1,
randRatio = 1,
sim = 50,
wiggle = FALSE,
nnF = 20,
decision1 = TRUE
)
#> Warning: Advise to use sim >= 50000 to achieve convergence
#> $oc
#> ExpectedN PrStopEarly PrEarlyEff PrEarlyFut PrEfficacy PrFutility PrGrayZone
#> 1 20.4 0.92 0.06 0.86 0.1 0.86 0.04
#> ExpectedNactive ExpectedNcontrol
#> 1 10.1 10.3
#>
#> $Decision
#> [1] NA FALSE FALSE FALSE FALSE FALSE FALSE NA FALSE FALSE FALSE FALSE
#> [13] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE
#> [25] FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#> [37] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> [49] FALSE FALSE
#>
#> $SampleSize
#> [1] 30 20 20 20 20 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20
#> [26] 20 20 10 20 30 20 20 20 20 20 20 20 20 20 20 20 20 10 20 20 20 20 20 20 20
#>
#> $SampleSizeActive
#> [1] 15 12 11 9 10 11 10 15 10 7 8 12 8 9 11 9 10 9 9 10 15 9 13 11 8
#> [26] 13 11 4 11 15 10 11 12 10 10 11 9 9 10 8 12 10 3 10 8 10 11 8 9 9
#>
#> $SampleSizeControl
#> [1] 15 8 9 11 10 9 10 15 10 13 12 8 12 11 9 11 10 11 11 10 15 11 7 9 12
#> [26] 7 9 6 9 15 10 9 8 10 10 9 11 11 10 12 8 10 7 10 12 10 9 12 11 11
#>
#> $union_nn
#> [1] 10 20 30
#>
#> $wiggled_nnE
#> [1] 10 20 30
#>
#> $wiggled_nnF
#> [1] 20
#>
#> $wiggle_dist
#> [1] NA
#>
#> $params
#> $params[[1]]
#> ocRctPredprobDist
#>
#> $params$nnE
#> c(10, 20, 30)
#>
#> $params$pE
#> [1] 0.3
#>
#> $params$pS
#> [1] 0.3
#>
#> $params$deltaE
#> [1] 0.2
#>
#> $params$deltaF
#> [1] 0.1
#>
#> $params$phiFu
#> [1] 0.2
#>
#> $params$phiU
#> [1] 0.8
#>
#> $params$relativeDelta
#> [1] FALSE
#>
#> $params$tT
#> [1] 0.6
#>
#> $params$tF
#> [1] 0.4
#>
#> $params$parE
#> c(a = 1, b = 1)
#>
#> $params$parS
#> c(a = 1, b = 1)
#>
#> $params$weights
#> [1] 1
#>
#> $params$weightsS
#> [1] 1
#>
#> $params$randRatio
#> [1] 1
#>
#> $params$sim
#> [1] 50
#>
#> $params$wiggle
#> [1] FALSE
#>
#> $params$nnF
#> [1] 20
#>
#> $params$decision1
#> [1] TRUE
#>
#>
# When `deltaF = 0`:
set.seed(2000)
ocRctPredprobDist(
nnE = c(10, 20, 30),
pE = 0.3,
pS = 0.3,
deltaE = 0.2,
deltaF = 0,
phiU = 0.8,
phiFu = 0.2,
relativeDelta = FALSE,
tT = 0.6,
tF = 0.4,
parE = c(a = 1, b = 1),
parS = c(a = 1, b = 1),
weights = 1,
weightsS = 1,
randRatio = 1,
sim = 50,
wiggle = FALSE,
nnF = c(10, 20, 30),
decision1 = TRUE
)
#> Warning: Advise to use sim >= 50000 to achieve convergence
#> $oc
#> ExpectedN PrStopEarly PrEarlyEff PrEarlyFut PrEfficacy PrFutility PrGrayZone
#> 1 12.4 0.92 0.06 0.86 0.08 0.88 0.04
#> ExpectedNactive ExpectedNcontrol
#> 1 6.18 6.22
#>
#> $Decision
#> [1] NA FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [13] FALSE NA FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> [25] FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#> [37] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> [49] FALSE FALSE
#>
#> $SampleSize
#> [1] 30 10 10 10 10 20 10 10 10 10 20 10 10 30 10 10 10 10 20 10 10 10 10 10 10
#> [26] 10 10 10 10 30 10 10 10 10 10 30 10 10 10 10 10 10 10 10 10 10 10 20 10 10
#>
#> $SampleSizeActive
#> [1] 15 5 5 5 5 11 5 5 4 3 8 5 4 15 6 7 6 6 9 4 3 5 7 5 4
#> [26] 7 6 4 4 15 7 4 8 5 6 15 4 4 4 6 6 7 3 3 3 5 7 8 5 6
#>
#> $SampleSizeControl
#> [1] 15 5 5 5 5 9 5 5 6 7 12 5 6 15 4 3 4 4 11 6 7 5 3 5 6
#> [26] 3 4 6 6 15 3 6 2 5 4 15 6 6 6 4 4 3 7 7 7 5 3 12 5 4
#>
#> $union_nn
#> [1] 10 20 30
#>
#> $wiggled_nnE
#> [1] 10 20 30
#>
#> $wiggled_nnF
#> [1] 10 20 30
#>
#> $wiggle_dist
#> [1] NA
#>
#> $params
#> $params[[1]]
#> ocRctPredprobDist
#>
#> $params$nnE
#> c(10, 20, 30)
#>
#> $params$pE
#> [1] 0.3
#>
#> $params$pS
#> [1] 0.3
#>
#> $params$deltaE
#> [1] 0.2
#>
#> $params$deltaF
#> [1] 0
#>
#> $params$phiFu
#> [1] 0.2
#>
#> $params$phiU
#> [1] 0.8
#>
#> $params$relativeDelta
#> [1] FALSE
#>
#> $params$tT
#> [1] 0.6
#>
#> $params$tF
#> [1] 0.4
#>
#> $params$parE
#> c(a = 1, b = 1)
#>
#> $params$parS
#> c(a = 1, b = 1)
#>
#> $params$weights
#> [1] 1
#>
#> $params$weightsS
#> [1] 1
#>
#> $params$randRatio
#> [1] 1
#>
#> $params$sim
#> [1] 50
#>
#> $params$wiggle
#> [1] FALSE
#>
#> $params$nnF
#> c(10, 20, 30)
#>
#> $params$decision1
#> [1] TRUE
#>
#>