phm.random.a0 {BayesPPDSurv} | R Documentation |
Model fitting for the proportional hazards model with piecewise constant hazard and random a0
Description
Model fitting using the normalized power prior for the proportional hazards model with piecewise constant hazard and random a_0
Usage
phm.random.a0(
time,
event,
X,
S,
historical,
n.intervals,
change.points = NULL,
prior.beta.mvn = NULL,
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),
prior.a0.shape1 = rep(1, 10),
prior.a0.shape2 = rep(1, 10),
prior.lambda.hp1 = rep(10^(-5), 50),
prior.lambda.hp2 = rep(10^(-5), 50),
lower.limits = NULL,
upper.limits = rep(100, 50),
slice.widths = rep(0.1, 50),
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:
|
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 |
prior.beta.mvn |
List of multivariate normal approximations of the normalized power prior for |
prior.beta.mean |
(Only applies if |
prior.beta.sd |
(Only applies if |
prior.lambda0.hp1 |
(Only applies if |
prior.lambda0.hp2 |
(Only applies if |
prior.a0.shape1 |
(Only applies if |
prior.a0.shape2 |
(Only applies if |
prior.lambda.hp1 |
Vector of first hyperparameters of the Gamma prior on |
prior.lambda.hp2 |
Vector of second hyperparameters of the Gamma prior on |
lower.limits |
Vector of lower limits for parameters ( |
upper.limits |
Vector of upper limits for parameters ( |
slice.widths |
Vector of initial slice widths for parameters ( |
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
. Here a_0
is modeled as random with a normalized power prior.
The normalized power prior for \beta
is approximated by a weighted mixture of multivariate normal distributions provided in prior.beta.mvn
.
The user can use the approximate.prior.beta
function to obtain samples of \beta
from the normalized power prior, and use any mixture of multivariate normals to approximate
the normalized power prior for \beta
. By default, a single multivariate normal distribution is assumed.
Posterior samples are obtained through slice sampling.
The default lower limits are -100 for \beta
and 0 for \lambda
. 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
and \lambda
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.random.a0
and approximate.prior.beta
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))
# 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
prior.beta.mvn <- list(list(prior_beta_mu, prior_beta_sigma, 1))
result <- phm.random.a0(time=time, event=event, X=X, S=S,
historical=historical, n.intervals=n.intervals,
change.points=change.points,
prior.beta.mvn=prior.beta.mvn,
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]])