approximate.prior.beta {BayesPPDSurv}R Documentation

Approximating the normalized power prior for \beta for the proportional hazards model with piecewise constant hazard and random a0

Description

Approximation of the normalized power prior for \beta for the proportional hazards model with piecewise constant hazard and random a_0. The function returns discrete samples of \beta from the normalized power prior, and the user can use any mixture of multivariate normal distributions as an approximation for the normalized power prior for \beta. This function is used to produce prior.beta.mvn in the function power.phm.random.a0.

Usage

approximate.prior.beta(
  historical,
  n.intervals,
  change.points = NULL,
  prior.a0.shape1 = rep(1, 10),
  prior.a0.shape2 = rep(1, 10),
  prior.beta.mean = rep(0, 50),
  prior.beta.sd = rep(1000, 50),
  prior.lambda0.hp1 = rep(10^(-5), 50),
  prior.lambda0.hp2 = rep(10^(-5), 50),
  lower.limits = rep(-100, 50),
  upper.limits = rep(100, 50),
  slice.widths = rep(0.1, 50),
  nMC = 10000,
  nBI = 250
)

Arguments

historical

List of historical dataset(s). East historical dataset is stored in a list which contains four named elements: time, event, X and S.

  • time is a vector of follow up times.

  • event is a vector of status indicators. Normally 0=alive and 1=dead.

  • X is a matrix of covariates. The first column must be the treatment indicator.

  • S is a vector of integers, where each integer represents the stratum that the subject belongs to. For example, if there are three strata, S can take values 1, 2 or 3.

n.intervals

Vector of integers, indicating the number of intervals for the baseline hazards for each stratum. The length of the vector should be equal to the total number of strata.

change.points

List of vectors. Each vector in the list contains the change points for the baseline hazards for each stratum. The length of the list should be equal to the total number of strata. For a given stratum, if there is only one interval, then change.points should be NULL for that stratum. By default, we assign the change points so that the same number of events are observed in all the intervals in the historical data.

prior.a0.shape1

Vector of the first shape parameters of the independent beta priors for a_0. The length of the vector should be equal to the number of historical datasets. The default is a vector of one's.

prior.a0.shape2

Vector of the second shape parameters of the independent beta priors for a_0. The length of the vector should be equal to the number of historical datasets. The default is a vector of one's.

prior.beta.mean

Vector of means of the normal initial prior on \beta. The default value is zero for all the elements of \beta.

prior.beta.sd

Vector of standard deviations of the normal initial prior on \beta. The default value is 10^3 for all the elements of \beta.

prior.lambda0.hp1

Vector of first hyperparameters of the Gamma prior on \lambda_0. The length of the vector should be equal to the dimension of \lambda_0, i.e., the total number of intervals for all strata. The default value is 10^(-5) for all the elements of \lambda_0.

prior.lambda0.hp2

Vector of second hyperparameters of the Gamma prior on \lambda_0. The length of the vector should be equal to the dimension of \lambda_0, i.e., the total number of intervals for all strata. The default value is 10^(-5) for all the elements of \lambda_0.

lower.limits

Vector of lower limits for \beta to be used by the slice sampler. The length of the vector should be equal to the length of \beta. The default is -100 for all the elements of \beta (may not be appropriate for all situations).

upper.limits

Vector of upper limits for \beta to be used by the slice sampler. The length of the vector should be equal to the length of \beta. The default is 100 for all the elements of \beta (may not be appropriate for all situations).

slice.widths

Vector of initial slice widths for \beta to be used by the slice sampler. The length of the vector should be equal to the total number of parameters. The default is 0.1 for all the elements of \beta (may not be appropriate for all situations).

nMC

Number of iterations (excluding burn-in samples) for the slice sampler. The default is 10,000.

nBI

Number of burn-in samples for the slice sampler. The default is 250.

Details

This function is used to produce prior.beta.mvn in the function power.phm.random.a0. It approximates the normalized power prior for \beta when a_0 is modeled as random. The function returns discrete samples of \beta from the normalized power prior, and the user can use any mixture of multivariate normal distributions as an approximation for the normalized power prior for \beta.

Baseline hazard parameters for the current and historical data are NOT shared. The baseline hazards of the historical data are denoted by \lambda_0. We assume Gamma priors for \lambda_0 and independent normal initial priors for \beta.

Posterior samples are obtained through slice sampling. The default lower limits are -100 for \beta. The default upper limits for the parameters are 100. The default slice widths for the parameters are 0.1. The defaults may not be appropriate for all situations, and the user can specify the appropriate limits and slice width for each parameter.

Value

Samples of \beta (approximating the normalized power prior) are returned.

References

Ibrahim, J. G., Chen, M.-H. and Sinha, D. (2001). Bayesian Survival Analysis. New York: Springer Science & Business Media.

Psioda, M. A. and Ibrahim, J. G. (2019). Bayesian clinical trial design using historical data that inform the treatment effect. Biostatistics 20, 400–415.

Shen, Y., Psioda, M. A., and Joseph, J. G. (2023). BayesPPD: an R package for Bayesian sample size determination using the power and normalized power prior for generalized linear models. The R Journal, 14(4).

See Also

phm.random.a0 and power.phm.random.a0

Examples


# Simulate two historical datasets
n <- 100
P <- 4
time1 <- round(rexp(n, rate=0.5),1)
event1 <- rep(1,n)
X1 <- matrix(rbinom(n*P,prob=0.5,size=1), ncol=P)
S1 <- c(rep(1,n/2),rep(2,n/2))
time2 <- round(rexp(n, rate=0.7),1)
event2 <- rep(1,n)
X2 <- matrix(rbinom(n*P,prob=0.5,size=1), ncol=P)
S2 <- c(rep(1,n/2),rep(2,n/2))
historical <- list(list(time=time1, event=event1, X=X1, S=S1),
                   list(time=time2, event=event2, X=X2, S=S2))

# We choose three intervals for the first stratum and two intervals for the second stratum
n.intervals <- c(3,2) 
change.points <- list(c(1,2), 2)

# Get samples from the approximate normalized power prior for beta
nMC <- 100 # nMC should be larger in practice
nBI <- 50
prior.beta <- approximate.prior.beta(historical, n.intervals, change.points=change.points,
                                     prior.a0.shape1=c(1,1), prior.a0.shape2=c(1,1), 
                                     nMC=nMC, nBI=nBI)
prior_beta_mu=colMeans(prior.beta)
prior_beta_sigma=cov(prior.beta) 

# Aprroximate the discrete sames with a single multivariate normal with weight one.
# The user can use any mixture of multivariate normal distributions as an 
# approximation for the normalized power prior for beta.
prior.beta.mvn <- list(list(prior_beta_mu, prior_beta_sigma, 1))
# prior.beta.mvn is a parameter for phm.random.a0() and power.phm.random.a0()




[Package BayesPPDSurv version 1.0.3 Index]