SAM_weight {SAMprior}R Documentation

Calculating Mixture Weight of SAM Priors

Description

The SAM_weight function is designed to calculate the mixture weight of the SAM priors according to the degree of prior-data conflicts (Yang, et al., 2023).

Usage

SAM_weight(if.prior, theta.h, method.w, prior.odds, data, delta, ...)

## S3 method for class 'betaMix'
SAM_weight(if.prior, theta.h, method.w, prior.odds, data, delta, n, r, ...)

## S3 method for class 'normMix'
SAM_weight(
  if.prior,
  theta.h,
  method.w,
  prior.odds,
  data,
  delta,
  m,
  n,
  sigma,
  ...
)

## S3 method for class 'gammaMix'
SAM_weight(if.prior, theta.h, method.w, prior.odds, data, delta, u, w, ...)

Arguments

if.prior

Informative prior constructed based on historical data, represented (approximately) as a mixture of conjugate distributions.

theta.h

Estimate of the treatment effect based on historical data. If missing, the default value is set to be the posterior mean estimate from if.prior.

method.w

Methods used to determine the mixture weight for SAM priors. The default method is "LRT" (Likelihood Ratio Test), the alternative option is "PPR" (Posterior Probability Ratio). See Details section for more information.

prior.odds

The prior probability of H0H_0 being true compared to the prior probability of H1H_1 being true using PPR method. The default value is 1. See Details section for more information.

data

Data of the control arm from the current trial, see Methods section for more details.

delta

Clinically significant difference used for the SAM prior.

...

Additional parameters required for different endpoints.

n

Number of subjects in the control arm for continuous endpoint.

r

Number of responses in the control arm for binary endpoint.

m

Mean estimate in the control arm for continuous endpoint.

sigma

Standard deviation in the control arm for continuous endpoint.

u

Number of events in the control arm for time-to-event endpoint.

w

Total observed time in the control arm for time-to-event endpoint.

Details

SAM prior is constructed by mixing an informative prior π1(θ)\pi_1(\theta), constructed based on historical data, with a non-informative prior π0(θ)\pi_0(\theta) using the mixture weight ww determined by SAM_weight function to achieve the degree of prior-data conflict (Schmidli et al., 2015, Yang et al., 2023).

Let θ\theta and θh\theta_h denote the treatment effects associated with the current arm data DD and historical data DhD_h, respectively. Let δ\delta denote the clinically significant difference such that if θhθδ|\theta_h - \theta| \ge \delta, then θh\theta_h is regarded as clinically distinct from θ\theta, and it is therefore inappropriate to borrow any information from DhD_h. Consider two hypotheses:

H0:θ=θh, H1:θ=θh+δ or θ=θhδ.H_0: \theta = \theta_h, ~ H_1: \theta = \theta_h + \delta ~ or ~ \theta = \theta_h - \delta.

H0H_0 represents that DhD_h and DD are consistent (i.e., no prior-data conflict) and thus information borrowing is desirable, whereas H1H_1 represents that the treatment effect of DD differs from DhD_h to such a degree that no information should be borrowed.

The SAM prior uses the likelihood ratio test (LRT) statistics RR to quantify the degree of prior-data conflict and determine the extent of information borrowing.

R=P(DH0,θh)/P(DH1,θh)=P(Dθ=θh)/max(P(Dθ=θh+δ),P(Dθ=θhδ)),R = P(D | H_0, \theta_h) / P(D | H_1, \theta_h) = P(D | \theta = \theta_h) / \max(P(D | \theta = \theta_h + \delta), P(D | \theta = \theta_h - \delta)) ,

where P(D)P(D | \cdot) denotes the likelihood function. An alternative Bayesian choice is the posterior probability ratio (PPR):

R=P(DH0,θh)/P(DH1,θh)=P(H0)/P(H1)×BF,R = P(D | H_0, \theta_h) / P(D | H_1, \theta_h) = P(H_0) / P( H_1) \times BF,

where P(H0)P(H_0) and P(H1)P(H_1) is the prior probabilities of H0H_0 and H1H_1 being true. BFBF is the Bayes Factor that in this case is the same as the LRT.

The SAM prior, denoted as πsam(θ)\pi_{sam}(\theta), is then defined as a mixture of an informative prior π1(θ)\pi_1(\theta), constructed based on DhD_h and a non-informative prior π0(θ)\pi_0(\theta):

πsam(θ)=wπ1(θ)+(1w)π0(θ),\pi_{sam}(\theta) = w\pi_1(\theta) + (1-w)\pi_0(\theta),

where the mixture weight ww is calculated as:

w=R/(1+R).w = R / (1 + R).

As the level of prior-data conflict increases, the likelihood ratio RR decreases, resulting in a decrease in the weight ww assigned to the informative prior and thus a decrease in information borrowing. As a result, πsam(θ)\pi_{sam}(\theta) is data-driven and has the ability to self-adapt the information borrowing based on the degree of prior-data conflict.

Value

The mixture weight of the SAM priors.

Methods (by class)

References

Yang P, Zhao Y, Nie L, Vallejo J, Yuan Y. SAM: Self-adapting mixture prior to dynamically borrow information from historical data in clinical trials. Biometrics 2023; 00, 1–12. https://doi.org/10.1111/biom.13927

Examples

set.seed(123)
## Examples for binary endpoints
## Example 1: no prior-data conflict
## Suppose that the informative prior constructed based on historical data is
## beta(40, 60)
prior.historical <- mixbeta(c(1, 40, 60))
## Data of control arm
data.control     <- rbinom(60, size = 1, prob = 0.42)
## Calculate the mixture weight of the SAM prior
wSAM <- SAM_weight(if.prior = prior.historical,
                   delta = 0.15,        ## Clinically significant difference
                   data = data.control  ## Control arm data
                   )
print(wSAM)

## Example 2: in the presence of prior-data conflict, where the current data
## has 12 responses in 60 patients
wSAM <- SAM_weight(if.prior = prior.historical,
                   delta = 0.15,    ## Clinically significant difference
                   ## Methods to determine mixture weight for the SAM priors
                   ## by Posterior Probability Ratio
                   method.w = 'PPR',
                   ## Prior odds of favoring no prior-data conflicts to
                   ## the presence of prior-data conflict
                   prior.odd = 1/9,
                   n = 60,          ## Number of patients in the control arm
                   r = 12           ## Number of responses in the control arm
                   )
print(wSAM)

## Example 3: in the presence of prior-data conflict, where the current data
## has 12 responses in 60 patients
wSAM <- SAM_weight(if.prior = prior.historical,
                   delta = 0.15, ## Clinically significant difference
                   n = 60,       ## Number of patients in the control arm
                   r = 12        ## Number of responses in the control arm
                   )
print(wSAM)

## Examples for continuous endpoints
## Example 1: no prior-data conflict
## Suppose that the informative prior constructed from historical data is
## N(0, 3)
sigma      <- 3
prior.mean <- 0
prior.se   <- sigma/sqrt(100)
prior.historical <- mixnorm(c(1, prior.mean, prior.se), sigma = sigma)
## Data of the control arm
data.control     <- rnorm(80, mean = 0, sd = sigma)
wSAM <- SAM_weight(if.prior = prior.historical,
                   delta = 0.3 * sigma,    ## Clinically significant difference
                   data = data.control     ## Control arm data
                   )
print(wSAM)

## Example 2: in the presence of prior-data conflict, where the current data
## has mean of 0.5
data.control     <- rnorm(80, mean = 1, sd = sigma)
wSAM  <- SAM_weight(if.prior = prior.historical,
                    delta = 0.3 * sigma,    ## Clinically significant difference
                    data = data.control     ## Control arm data
                    )
print(wSAM)

## Examples for survival endpoints
## Example 1: no prior-data conflict
## Suppose the survival times from historical data follows exp(1) distribution
## with random censoring time follows U(0.5, 5) distribution
T_hi <- rexp(100, rate = 1)
C_hi <- runif(100, min = 0.5, max = 5)
## Indicators of the uncensored events
delta_hi <- as.numeric(T_hi < C_hi)
## Observed survival times from historical data
U_hi     <- T_hi
U_hi[delta_hi == 0] <- C_hi[delta_hi == 0]
## Construct the informative prior based on simulated historical data
prior.historical <- mixgamma(c(1, sum(delta_hi), sum(U_hi)),
                             param = 'ab', likelihood = 'exp')
## Suppose the survival times from control data follows exp(0.95) distribution
## with random censoring time follows U(0.5, 5) distribution
T_ci <- rexp(100, rate = 0.95)
C_ci <- runif(100, min = 0.5, max = 5)
## Indicators of the uncensored events
delta_ci <- as.numeric(T_ci < C_ci)
## Observed survival times from control data
U_ci     <- T_ci
U_ci[delta_ci == 0] <- C_ci[delta_ci == 0]
## Data of the control arm
data.control     <- rbind(sum(delta_ci), sum(U_ci))
wSAM <- SAM_weight(if.prior = prior.historical,
                   delta = 0.2,            ## Clinically significant difference
                   data = data.control     ## Control arm data
                   )
print(wSAM)

## Example 2: in the presence of prior-data conflict, where the current survival
## times follows exp(2) distribution with random censoring time follows U(0.5, 5)
## distribution
T_ci <- rexp(100, rate = 2)
C_ci <- runif(100, min = 0.5, max = 5)
## Indicators of the uncensored events
delta_ci <- as.numeric(T_ci < C_ci)
## Observed survival times from control data
U_ci     <- T_ci
U_ci[delta_ci == 0] <- C_ci[delta_ci == 0]
## Data of the control arm
data.control     <- rbind(sum(delta_ci), sum(U_ci))
wSAM  <- SAM_weight(if.prior = prior.historical,
                    delta = 0.2,            ## Clinically significant difference
                    data = data.control     ## Control arm data
                    )
print(wSAM)


[Package SAMprior version 1.1.1 Index]