phm.fixed.a0 {BayesPPDSurv}R Documentation

Model fitting for the proportional hazards model with piecewise constant hazard and fixed a0

Description

Model fitting using power priors for the proportional hazards model with piecewise constant hazard and fixed a_0

Usage

phm.fixed.a0(
  time = NULL,
  event = NULL,
  X = NULL,
  S = NULL,
  historical,
  a0,
  n.intervals,
  change.points = NULL,
  shared.blh = FALSE,
  prior.beta = "Normal",
  prior.beta.mean = rep(0, 50),
  prior.beta.sd = rep(1000, 50),
  prior.lambda = "Gamma",
  prior.lambda.hp1 = rep(10^(-5), 50),
  prior.lambda.hp2 = rep(10^(-5), 50),
  prior.lambda0.hp1 = rep(10^(-5), 50),
  prior.lambda0.hp2 = rep(10^(-5), 50),
  lower.limits = NULL,
  upper.limits = rep(100, 50),
  slice.widths = rep(0.1, 50),
  current.data = TRUE,
  nMC = 10000,
  nBI = 250
)

Arguments

time

Vector of follow up times.

event

Vector of status indicators. Normally 0=alive and 1=dead.

X

Matrix of covariates. The first column must be the treatment indicator.

S

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.

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.

a0

Vector containing numbers between 0 and 1 indicating the discounting parameter value for each historical dataset. The length of the vector should be equal to the length of historical.

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 pooled current and historical data.

shared.blh

Logical value indicating whether baseline hazard parameters are shared between the current and historical data. If TRUE, baseline hazard parameters are shared. The default value is FALSE.

prior.beta

Prior used for \beta. The choices are "Uniform" and "Normal". If prior.beta is "Uniform", the uniform improper prior is used. If prior.beta is "Normal", independent normal priors are used for each element of \beta. The default choice is "Normal".

prior.beta.mean

(Only applies if prior.beta is "Normal") vector of means of the normal prior on \beta. The default value is zero for all the elements of \beta.

prior.beta.sd

(Only applies if prior.beta is "Normal") vector of standard deviations of the normal prior on \beta. The default value is 10^3 for all the elements of \beta.

prior.lambda

Prior used for \lambda. The choices are "Gamma", "Log-normal" and "Improper". The default choice is "Gamma".

If prior.lambda is "Gamma", then the prior on the first element of \lambda is

Gamma(shape=prior.lambda.hp1[1], rate=prior.lambda.hp2[1]).

If prior.lambda is "Log-normal", then the prior on the first element of \lambda is Log-normal(mean=prior.lambda.hp1[1], sd=prior.lambda.hp2[1]).

If prior.lambda is "Improper", then the prior on each element of \lambda is the improper prior \lambda^{-1}.

prior.lambda.hp1

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

prior.lambda.hp2

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

prior.lambda0.hp1

(Only applies if shared.blh is FALSE and if prior.lambda is "Gamma" or "Log-normal") Vector of first hyperparameters of the prior on \lambda_0. We assume the same distribution choice for the prior for \lambda_0 and \lambda. 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

(Only applies if shared.blh is FALSE and if prior.lambda is "Gamma" or "Log-normal") Vector of second hyperparameters of the prior on \lambda_0. We assume the same distribution choice for the prior for \lambda_0 and \lambda. 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 parameters (\beta, \lambda, and \lambda_0, in this order) to be used by the slice sampler. The length of the vector should be equal to the total number of parameters. The default is -100 for \beta and 0 for \lambda and \lambda_0 (may not be appropriate for all situations).

upper.limits

Vector of upper limits for parameters (\beta, \lambda, and \lambda_0, in this order) to be used by the slice sampler. The length of the vector should be equal to the total number of parameters. The default is 100 for all parameters (may not be appropriate for all situations).

slice.widths

Vector of initial slice widths for parameters (\beta, \lambda, and \lambda_0, in this order) 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 parameters (may not be appropriate for all situations).

current.data

Logical value indicating whether current data is included. The default is TRUE. If FALSE, only historical data is included in the analysis, and the posterior samples can be used as a discrete approximation to the sampling prior in power.phm.fixed.a0 and power.phm.random.a0.

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

The proportional hazards model with piecewise constant hazard is implemented. We assume \beta is the regression coefficients. We assume the first column of the covariate matrix is the treatment indicator, and the corresponding parameter is \beta_1. The baseline hazards of the current data are denoted by \lambda. The baseline hazards of the historical data are denoted by \lambda_0. If the baseline hazards are shared between the historical and current data, then \lambda_0=\lambda.

Posterior samples are obtained through slice sampling. The default lower limits are -100 for \beta and 0 for \lambda and \lambda_0. 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

Posterior samples of \beta, \lambda and \lambda_0 (if baseline hazards are not shared between the current and historical data) 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

power.phm.fixed.a0

Examples

set.seed(1)
# Simulate current data
n <- 50
P <- 4
time <- round(rexp(n, rate=0.5),1)
event <- rep(1,n)
X <- matrix(rbinom(n*P,prob=0.5,size=1), ncol=P)
S <- c(rep(1,n/2),rep(2,n/2))

# Simulate two historical datasets
n <- 100
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))

# a0 is 0.3 for the first historical dataset and 0.6 for the second
a0 <- c(0.3, 0.6)


# 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)


nMC <- 1000 # nMC should be larger in practice
nBI <- 50

result <- phm.fixed.a0(time=time, event=event, X=X, S=S,
                       historical=historical, a0=a0, n.intervals=n.intervals, 
                       change.points=change.points, nMC=nMC, nBI=nBI)

# posterior mean of beta
colMeans(result$beta_samples) 
# posterior mean of baseline hazards for stratum 1
colMeans(result$lambda_samples[[1]]) 
# posterior mean of baseline hazards for stratum 2
colMeans(result$lambda_samples[[2]]) 
# posterior mean of historical baseline hazards for stratum 1
colMeans(result$lambda0_samples[[1]]) 
# posterior mean of historical baseline hazards for stratum 2
colMeans(result$lambda0_samples[[2]]) 





[Package BayesPPDSurv version 1.0.3 Index]