Compute the Posterior Probability with Beta Prior on standard of care S
Source: R/postprobDist.R
postprobDist.Rd
Using the approach by Thall and Simon (Biometrics, 1994), this evaluates the
posterior probability of achieving superior response rate in the treatment group E
compared to standard of care S
. See note below for two formulations of the difference in response rates.
Arguments
- x
(
numeric
):
number of success counts in theE
group.- n
(
number
):
number of patients in theE
group.- xS
(
number
):
number of success counts in theS
group.- nS
(
number
):
number of patients in theS
group.- delta
(
number
):
margin by which the response rate in the treatment group should be better than in the standard of care or control orS
group. Note that this can also be negative, e.g. when non-inferiority is being assessed.- relativeDelta
(
flag
):
IfTRUE
, then arelativeDelta
is used. Represents that a minimum response rate in magnitude ofdelta
of theS
non-responding patients is included as the margin between treatment and control group. See note.- parE
(
numeric
ormatrix
):
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 theE
group. See details.- weights
(
numeric
):
the non-negative mixture weights of the beta mixture prior for groupE
. See details.- parS
(
numeric
ormatrix
):
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. See details.- weightsS
(
numeric
):
the non-negative mixture weights of the beta mixture prior for groupS
. See details.
Details
The beta mixture prior for the E
arm requires argument parE
and weights
.
The beta mixture prior for the S
arm requires argument parS
and weightsS
.
See postprob()
for details.
If a beta-mixture is used, by default, the weights are uniform across the components. Weights can exceed 1, to which the algorithm will normalize the weights such that all weights sum to 1.
Note
Delta :
The desired improvement is denoted as delta
. There are two options in using delta
.
The absolute case when relativeDelta = FALSE
and relative as when relativeDelta = TRUE
.
The absolute case is when we define an absolute delta, greater than
P_S
, the response rate of the standard of care or control orS
group such that the posterior isPr(P_E > P_S + delta | data)
.In the relative case, we suppose that the treatment group's response rate is assumed to be greater than
P_S + (1-P_S) * delta
such that the posterior isPr(P_E > P_S + (1 - P_S) * delta | data)
.
Examples
# An example similar to Lee and Liu (2008).
postprobDist(
x = 16,
n = 23,
parE = c(0.6, 0.4),
parS = c(0.6, 0.4),
delta = 0.1,
relativeDelta = FALSE
)
#> [1] 0.4431067
# For a sequence of success outcomes for Experimental arm.
postprobDist(
x = c(16, 17),
n = 23,
parE = c(0.6, 0.4),
parS = c(0.6, 0.4),
delta = 0.1,
relativeDelta = FALSE
)
#> [1] 0.4431067 0.4706541
# When we use a relative difference and look at several possible number of responses.
postprobDist(
x = 1:23,
n = 23,
parE = c(0.2, 0.8),
parS = c(0.6, 0.4),
delta = 0.1,
relativeDelta = TRUE
)
#> [1] 0.008765651 0.031367331 0.066103157 0.105615555 0.144114579 0.179531092
#> [7] 0.212086794 0.242636671 0.271938471 0.300533490 0.328811161 0.357080040
#> [13] 0.385614492 0.414685509 0.444586146 0.475659417 0.508336740 0.543200029
#> [19] 0.581095188 0.623367348 0.672432629 0.733545997 0.823358859
# When we use beta mixtures for both the Experimental and SOC arms.
postprobDist(
x = 16,
n = 23,
parE =
rbind(
c(0.6, 0.4),
c(10, 20)
),
parS =
rbind(
c(0.6, 0.4),
c(10, 10)
),
weightsS = c(1, 3),
delta = 0.1
)
#> [1] 0.6168586
# Experimental arm only (strictly single arm trial), uniform prior in Experimental arm.
# Non-uniform Prior used for SOC arm as no precedent data.
postprobDist(
x = 16,
n = 23,
xS = 0,
nS = 0,
delta = 0,
relativeDelta = FALSE,
parS = c(2, 3),
weightsS = 1
)
#> [1] 0.8842491
# Experimental arm and SOC, uniform prior in both E and S arms, default setting used.
postprobDist(
x = 16,
n = 20,
xS = 10,
nS = 20,
delta = 0,
relativeDelta = FALSE,
weightsS = 1
)
#> [1] 0.9741857
# Experimental and SOC arm, with beta mix prior for both arms.
# For each of the SOC arm is of 3 priors, therefore 3 sets of beta parameters, and 3 weights.
postprobDist(
x = 16,
n = 20,
xS = 10,
nS = 20,
delta = 0.1,
relativeDelta = TRUE,
parE = rbind(c(1, 1), c(3, 4), c(8, 9)),
weights = c(5, 3, 2),
parS = rbind(c(4, 5), c(2, 3), c(4, 4)),
weightsS = c(2, 5, 3)
)
#> [1] 0.9415121