Skip to contents

The function sets up a 2 sample one-sided decision function with an arbitrary number of conditions on the difference distribution.

Usage

decision2S(
  pc = 0.975,
  qc = 0,
  lower.tail = TRUE,
  link = c("identity", "logit", "log")
)

oc2Sdecision(
  pc = 0.975,
  qc = 0,
  lower.tail = TRUE,
  link = c("identity", "logit", "log")
)

Arguments

pc

Vector of critical cumulative probabilities of the difference distribution.

qc

Vector of respective critical values of the difference distribution. Must match the length of pc.

lower.tail

Logical; if TRUE (default), probabilities are \(P(X \leq x)\), otherwise, \(P(X > x)\).

Enables application of a link function prior to evaluating the difference distribution. Can take one of the values identity (default), logit or log.

Value

The function returns a decision function which takes three arguments. The first and second argument are expected to be mixture (posterior) distributions from which the difference distribution is formed and all conditions are tested. The third argument determines if the function acts as an indicator function or if the function returns the distance from the decision boundary for each condition in log-space. That is, the distance is 0 at the decision boundary, negative for a 0 decision and positive for a 1 decision.

Details

This function creates a one-sided decision function on the basis of the difference distribution in a 2 sample situation. To support double criterion designs, see Neuenschwander et al., 2010, an arbitrary number of criterions can be given. The decision function demands that the probability mass below the critical value qc of the difference \(\theta_1 - \theta_2\) is at least pc. Hence, for lower.tail=TRUE condition \(i\) is equivalent to

$$P(\theta_1 - \theta_2 \leq q_{c,i}) > p_{c,i}$$

and the decision function is implemented as indicator function using the heavy-side step function \(H(x)\) which is \(0\) for \(x \leq 0\) and \(1\) for \(x > 0\). As all conditions must be met, the final indicator function returns

$$\Pi_i H_i(P(\theta_1 - \theta_2 \leq q_{c,i}) - p_{c,i} ),$$

which is \(1\) if all conditions are met and \(0\) otherwise. For lower.tail=FALSE differences must be greater than the given quantiles qc.

Note that whenever a link other than identity is requested, then the underlying densities are first transformed using the link function and then the probabilties for the differences are calculated in the transformed space. Hence, for a binary endpoint the default identity link will calculate risk differences, the logit link will lead to decisions based on the differences in logits corresponding to a criterion based on the log-odds. The log link will evaluate ratios instead of absolute differences which could be useful for a binary endpoint or counting rates. The respective critical quantiles qc must be given on the transformed scale.

Functions

  • oc2Sdecision(): Deprecated old function name. Please use decision2S instead.

References

Gsponer T, Gerber F, Bornkamp B, Ohlssen D, Vandemeulebroecke M, Schmidli H.A practical guide to Bayesian group sequential designs. Pharm. Stat.. 2014; 13: 71-80

See also

Other design2S: decision2S_boundary(), oc2S(), pos2S()

Examples


# see Gsponer et al., 2010
priorT <- mixnorm(c(1,   0, 0.001), sigma=88, param="mn")
priorP <- mixnorm(c(1, -49, 20   ), sigma=88, param="mn")
# the success criteria is for delta which are larger than some
# threshold value which is why we set lower.tail=FALSE
successCrit  <- decision2S(c(0.95, 0.5), c(0, 50), FALSE)
# the futility criterion acts in the opposite direction
futilityCrit <- decision2S(c(0.90)     , c(40),    TRUE)

print(successCrit)
#> 2 sample decision function
#> Conditions for acceptance:
#> P(theta1 - theta2 > 0) > 0.95
#> P(theta1 - theta2 > 50) > 0.5
#> Link: identity 
print(futilityCrit)
#> 2 sample decision function
#> Conditions for acceptance:
#> P(theta1 - theta2 <= 40) > 0.9
#> Link: identity 

# consider decision for specific outcomes
postP_interim <- postmix(priorP, n=10, m=-50)
#> Using default prior reference scale 88
postT_interim <- postmix(priorT, n=20, m=-80)
#> Using default prior reference scale 88
futilityCrit( postP_interim, postT_interim )
#> [1] 0
successCrit(  postP_interim, postT_interim )
#> [1] 0

# Binary endpoint with double criterion decision on log-odds scale
# 95% certain positive difference and an odds ratio of 2 at least
decL2 <- decision2S(c(0.95, 0.5), c(0, log(2)), lower.tail=FALSE, link="logit")
# 95% certain positive difference and an odds ratio of 3 at least
decL3 <- decision2S(c(0.95, 0.5), c(0, log(3)), lower.tail=FALSE, link="logit")

# data scenario
post1 <- postmix(mixbeta(c(1, 1, 1)), n=40, r=10)
post2 <- postmix(mixbeta(c(1, 1, 1)), n=40, r=18)

# positive outcome and a median odds ratio of at least 2 ...
decL2(post2, post1)
#> [1] 1
# ... but not more than 3
decL3(post2, post1)
#> [1] 0