Title: | Hierarchical Models for Parametric and Semi-Parametric Analyses of Semi-Competing Risks Data |
---|---|
Description: | Hierarchical multistate models are considered to perform the analysis of independent/clustered semi-competing risks data. The package allows to choose the specification for model components from a range of options giving users substantial flexibility, including: accelerated failure time or proportional hazards regression models; parametric or non-parametric specifications for baseline survival functions and cluster-specific random effects distribution; a Markov or semi-Markov specification for terminal event following non-terminal event. While estimation is mainly performed within the Bayesian paradigm, the package also provides the maximum likelihood estimation approach for several parametric models. The package also includes functions for univariate survival analysis as complementary analysis tools. |
Authors: | Kyu Ha Lee, Catherine Lee, Danilo Alvares, and Sebastien Haneuse |
Maintainer: | Kyu Ha Lee <[email protected]> |
License: | GPL (>= 2) |
Version: | 3.4 |
Built: | 2024-11-20 06:51:27 UTC |
Source: | CRAN |
The package provides functions to perform the analysis of semi-competing risks or univariate survival data with either hazard regression (HReg) models or accelerated failure time (AFT) models. The framework is flexible in the sense that:
1) it can handle cluster-correlated or independent data;
2) the option to choose between parametric (Weibull) and semi-parametric (mixture of piecewise exponential) specification for baseline hazard function(s) is available;
3) for clustered data, the option to choose between parametric (multivariate Normal for semicompeting risks data, Normal for univariate survival data) and semi-parametric (Dirichlet process mixture) specification for random effects distribution is available;
4) for semi-competing risks data, the option to choose between Makov and semi-Makov model is available.
The package includes following functions:
BayesID_HReg |
Bayesian analysis of semi-competing risks data using HReg models |
BayesID_AFT |
Bayesian analysis of semi-competing risks data using AFT models |
BayesSurv_HReg |
Bayesian analysis of univariate survival data using HReg models |
BayesSurv_AFT |
Bayesian analysis of univariate survival data using AFT models |
FreqID_HReg |
Frequentist analysis of semi-competing risks data using HReg models |
FreqSurv_HReg |
Frequentist analysis of univariate survival data using HReg models |
initiate.startValues_HReg |
Initiating starting values for Bayesian estimations with HReg models |
initiate.startValues_AFT |
Initiating starting values for Bayesian estimations with AFT models |
simID |
Simulating semi-competing risks data under Weibull/Weibull-MVN model |
simSurv |
Simulating survival data under Weibull/Weibull-Normal model |
Package: | SemiCompRisks |
Type: | Package |
Version: | 3.4 |
Date: | 2021-2-2 |
License: | GPL (>= 2) |
LazyLoad: | yes |
Kyu Ha Lee, Catherine Lee, Danilo Alvares, and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2015),
Bayesian semiparametric analysis of semicompeting risks data:
investigating hospital readmission after a pancreatic cancer diagnosis, Journal of the Royal Statistical Society: Series C, 64, 2, 253-273.
Lee, K. H., Dominici, F., Schrag, D., and Haneuse, S. (2016),
Hierarchical models for semicompeting risks data with application to quality of end-of-life care for pancreatic cancer, Journal of the American Statistical Association, 111, 515, 1075-1095.
Lee, K. H., Rondeau, V., and Haneuse, S. (2017),
Accelerated failure time models for semicompeting risks data in the presence of complex censoring, Biometrics, 73, 4, 1401-1412.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
Independent semi-competing risks data can be analyzed using AFT models that have a hierarchical structure. The proposed models can accomodate left-truncated and/or interval-censored data. An efficient computational algorithm that gives users the flexibility to adopt either a fully parametric (log-Normal) or a semi-parametric (Dirichlet process mixture) model specification is developed.
BayesID_AFT(Formula, data, model = "LN", hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
BayesID_AFT(Formula, data, model = "LN", hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
Formula |
a |
data |
a data.frame in which to interpret the variables named in |
model |
The specification of baseline survival distribution: "LN" or "DPM". |
hyperParams |
a list containing lists or vectors for hyperparameter values in hierarchical models. Components include,
|
startValues |
a list containing vectors of starting values for model parameters. It can be specified as the object returned by the function |
mcmcParams |
a list containing variables required for MCMC sampling. Components include,
|
na.action |
how NAs are treated. See |
subset |
a specification of the rows to be used: defaults to all rows. See |
path |
the name of directory where the results are saved. |
We view the semi-competing risks data as arising from an underlying illness-death model system in which individuals may undergo one or more of three transitions: 1) from some initial condition to non-terminal event, 2) from some initial condition to terminal event, 3) from non-terminal event to terminal event. Let ,
denote time to non-terminal and terminal event from subject
. We propose to directly model the times of the events via the following AFT model specification:
where is a vector of transition-specific covariates,
is a corresponding vector of transition-specific regression parameters and
is a transition-specific random variable whose distribution determines that of the corresponding transition time,
.
is a study participant-specific random effect that induces positive dependence between the two event times, thereby performing a role analogous to that performed by frailties in models for the hazard function.
Let
denote the time at study entry (i.e. the left-truncation time). Furthermore, suppose that study participant
was observed at follow-up times
and let
denote the time to the end of study or to administrative right-censoring. Considering interval-censoring for both events, the times to non-terminal and terminal event for the
study participant satisfy
for some
and
for some
, respectively. Then the observed outcomes for the
study participant can be succinctly denoted by
.
For the Bayesian semi-parametric analysis, we proceed by adopting independent DPM of normal distributions for each . More precisely,
is taken to be an independent draw from a mixture of
normal distributions with means and variances (
,
), for
. Since the class-specific
are not known, they are taken to be draws from some common distribution,
, often referred to as the centering distribution. Furthermore, since the ‘true’ class membership for any given study participant is not known, we let
denote the probability of belonging to the
class for transition
and
=
the collection of such probabilities. Note,
is defined at the level of the population (i.e. is not study participant-specific) and its components add up to 1.0. In the absence of prior knowledge regarding the distribution of class memberships for the
individuals across the
classes,
is assumed to follow a conjugate symmetric Dirichlet
distribution, where
is referred to as the precision parameter. The finite mixture distribution can then be succinctly represented as:
Letting approach infinity, this specification is referred to as a DPM of normal distributions. In our proposed framework, we specify a Gamma(
,
) hyperprior for
. For regression parameters, we adopt non-informative flat priors on the real line. For
=
, we assume that each
is an independent random draw from a Normal(0,
) distribution. In the absence of prior knowledge on the variance component
, we adopt a conjugate inverse-Gamma hyperprior, IG(
,
). Finally, We take the
as a normal distribution centered at
with a variance
for
and an IG(
,
) for
.
For the Bayesian parametric analysis, we build on the log-Normal formulation and take the to follow independent Normal(
,
) distributions,
=1,2,3. For location parameters
, we adopt non-informative flat priors on the real line. For
, we adopt independent inverse Gamma distributions, denoted IG(
,
). For
,
, and
, we adopt the same priors as those adopted for the DPM model.
BayesID_AFT
returns an object of class Bayes_AFT
.
The posterior samples of are saved separately in
working directory/path
.
For a dataset with large ,
nGam_save
should be carefully specified considering the system memory and the storage capacity.
Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Rondeau, V., and Haneuse, S. (2017),
Accelerated failure time models for semicompeting risks data in the presence of complex censoring, Biometrics, 73, 4, 1401-1412.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
initiate.startValues_AFT
, print.Bayes_AFT
, summary.Bayes_AFT
, predict.Bayes_AFT
## Not run: # loading a data set data(scrData) scrData$y1L <- scrData$y1U <- scrData[,1] scrData$y1U[which(scrData[,2] == 0)] <- Inf scrData$y2L <- scrData$y2U <- scrData[,3] scrData$y2U[which(scrData[,4] == 0)] <- Inf scrData$LT <- rep(0, dim(scrData)[1]) form <- Formula(LT | y1L + y1U | y2L + y2U ~ x1 + x2 + x3 | x1 + x2 | x1 + x2) ##################### ## Hyperparameters ## ##################### ## Subject-specific random effects variance component ## theta.ab <- c(0.5, 0.05) ## log-Normal model ## LN.ab1 <- c(0.3, 0.3) LN.ab2 <- c(0.3, 0.3) LN.ab3 <- c(0.3, 0.3) ## DPM model ## DPM.mu1 <- log(12) DPM.mu2 <- log(12) DPM.mu3 <- log(12) DPM.sigSq1 <- 100 DPM.sigSq2 <- 100 DPM.sigSq3 <- 100 DPM.ab1 <- c(2, 1) DPM.ab2 <- c(2, 1) DPM.ab3 <- c(2, 1) Tau.ab1 <- c(1.5, 0.0125) Tau.ab2 <- c(1.5, 0.0125) Tau.ab3 <- c(1.5, 0.0125) ## hyperParams <- list(theta=theta.ab, LN=list(LN.ab1=LN.ab1, LN.ab2=LN.ab2, LN.ab3=LN.ab3), DPM=list(DPM.mu1=DPM.mu1, DPM.mu2=DPM.mu2, DPM.mu3=DPM.mu3, DPM.sigSq1=DPM.sigSq1, DPM.sigSq2=DPM.sigSq2, DPM.sigSq3=DPM.sigSq3, DPM.ab1=DPM.ab1, DPM.ab2=DPM.ab2, DPM.ab3=DPM.ab3, Tau.ab1=Tau.ab1, Tau.ab2=Tau.ab2, Tau.ab3=Tau.ab3)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 300 thin <- 3 burninPerc <- 0.5 ## Setting for storage ## nGam_save <- 10 nY1_save <- 10 nY2_save <- 10 nY1.NA_save <- 10 ## Tuning parameters for specific updates ## ## - those common to all models betag.prop.var <- c(0.01,0.01,0.01) mug.prop.var <- c(0.1,0.1,0.1) zetag.prop.var <- c(0.1,0.1,0.1) gamma.prop.var <- 0.01 ## mcmcParams <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save, nY1_save=nY1_save, nY2_save=nY2_save, nY1.NA_save=nY1.NA_save), tuning=list(betag.prop.var=betag.prop.var, mug.prop.var=mug.prop.var, zetag.prop.var=zetag.prop.var, gamma.prop.var=gamma.prop.var)) ################################################################# ## Analysis of Independent Semi-competing risks data ############ ################################################################# ############### ## logNormal ## ############### ## myModel <- "LN" myPath <- "Output/01-Results-LN/" startValues <- initiate.startValues_AFT(form, scrData, model=myModel, nChain=2) ## fit_LN <- BayesID_AFT(form, scrData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_LN summ.fit_LN <- summary(fit_LN); names(summ.fit_LN) summ.fit_LN pred_LN <- predict(fit_LN, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_LN, plot.est="Haz") plot(pred_LN, plot.est="Surv") ######### ## DPM ## ######### ## myModel <- "DPM" myPath <- "Output/02-Results-DPM/" startValues <- initiate.startValues_AFT(form, scrData, model=myModel, nChain=2) ## fit_DPM <- BayesID_AFT(form, scrData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_DPM summ.fit_DPM <- summary(fit_DPM); names(summ.fit_DPM) summ.fit_DPM pred_DPM <- predict(fit_DPM, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_DPM, plot.est="Haz") plot(pred_DPM, plot.est="Surv") ## End(Not run)
## Not run: # loading a data set data(scrData) scrData$y1L <- scrData$y1U <- scrData[,1] scrData$y1U[which(scrData[,2] == 0)] <- Inf scrData$y2L <- scrData$y2U <- scrData[,3] scrData$y2U[which(scrData[,4] == 0)] <- Inf scrData$LT <- rep(0, dim(scrData)[1]) form <- Formula(LT | y1L + y1U | y2L + y2U ~ x1 + x2 + x3 | x1 + x2 | x1 + x2) ##################### ## Hyperparameters ## ##################### ## Subject-specific random effects variance component ## theta.ab <- c(0.5, 0.05) ## log-Normal model ## LN.ab1 <- c(0.3, 0.3) LN.ab2 <- c(0.3, 0.3) LN.ab3 <- c(0.3, 0.3) ## DPM model ## DPM.mu1 <- log(12) DPM.mu2 <- log(12) DPM.mu3 <- log(12) DPM.sigSq1 <- 100 DPM.sigSq2 <- 100 DPM.sigSq3 <- 100 DPM.ab1 <- c(2, 1) DPM.ab2 <- c(2, 1) DPM.ab3 <- c(2, 1) Tau.ab1 <- c(1.5, 0.0125) Tau.ab2 <- c(1.5, 0.0125) Tau.ab3 <- c(1.5, 0.0125) ## hyperParams <- list(theta=theta.ab, LN=list(LN.ab1=LN.ab1, LN.ab2=LN.ab2, LN.ab3=LN.ab3), DPM=list(DPM.mu1=DPM.mu1, DPM.mu2=DPM.mu2, DPM.mu3=DPM.mu3, DPM.sigSq1=DPM.sigSq1, DPM.sigSq2=DPM.sigSq2, DPM.sigSq3=DPM.sigSq3, DPM.ab1=DPM.ab1, DPM.ab2=DPM.ab2, DPM.ab3=DPM.ab3, Tau.ab1=Tau.ab1, Tau.ab2=Tau.ab2, Tau.ab3=Tau.ab3)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 300 thin <- 3 burninPerc <- 0.5 ## Setting for storage ## nGam_save <- 10 nY1_save <- 10 nY2_save <- 10 nY1.NA_save <- 10 ## Tuning parameters for specific updates ## ## - those common to all models betag.prop.var <- c(0.01,0.01,0.01) mug.prop.var <- c(0.1,0.1,0.1) zetag.prop.var <- c(0.1,0.1,0.1) gamma.prop.var <- 0.01 ## mcmcParams <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save, nY1_save=nY1_save, nY2_save=nY2_save, nY1.NA_save=nY1.NA_save), tuning=list(betag.prop.var=betag.prop.var, mug.prop.var=mug.prop.var, zetag.prop.var=zetag.prop.var, gamma.prop.var=gamma.prop.var)) ################################################################# ## Analysis of Independent Semi-competing risks data ############ ################################################################# ############### ## logNormal ## ############### ## myModel <- "LN" myPath <- "Output/01-Results-LN/" startValues <- initiate.startValues_AFT(form, scrData, model=myModel, nChain=2) ## fit_LN <- BayesID_AFT(form, scrData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_LN summ.fit_LN <- summary(fit_LN); names(summ.fit_LN) summ.fit_LN pred_LN <- predict(fit_LN, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_LN, plot.est="Haz") plot(pred_LN, plot.est="Surv") ######### ## DPM ## ######### ## myModel <- "DPM" myPath <- "Output/02-Results-DPM/" startValues <- initiate.startValues_AFT(form, scrData, model=myModel, nChain=2) ## fit_DPM <- BayesID_AFT(form, scrData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_DPM summ.fit_DPM <- summary(fit_DPM); names(summ.fit_DPM) summ.fit_DPM pred_DPM <- predict(fit_DPM, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_DPM, plot.est="Haz") plot(pred_DPM, plot.est="Surv") ## End(Not run)
Independent/cluster-correlated semi-competing risks data can be analyzed using HReg models that have a hierarchical structure. The priors for baseline hazard functions can be specified by either parametric (Weibull) model or non-parametric mixture of piecewise exponential models (PEM). The option to choose between parametric multivariate normal (MVN) and non-parametric Dirichlet process mixture of multivariate normals (DPM) is available for the prior of cluster-specific random effects distribution. The conditional hazard function for time to the terminal event given time to non-terminal event can be modeled based on either Markov (it does not depend on the timing of the non-terminal event) or semi-Markov assumption (it does depend on the timing).
BayesID_HReg(Formula, data, id=NULL, model=c("semi-Markov", "Weibull"), hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
BayesID_HReg(Formula, data, id=NULL, model=c("semi-Markov", "Weibull"), hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
Formula |
a |
data |
a data.frame in which to interpret the variables named in |
id |
a vector of cluster information for |
model |
a character vector that specifies the type of components in a model.
The first element is for the assumption on |
hyperParams |
a list containing lists or vectors for hyperparameter values in hierarchical models. Components include,
|
startValues |
a list containing vectors of starting values for model parameters. It can be specified as the object returned by the function |
mcmcParams |
a list containing variables required for MCMC sampling. Components include,
|
na.action |
how NAs are treated. See |
subset |
a specification of the rows to be used: defaults to all rows. See |
path |
the name of directory where the results are saved. |
We view the semi-competing risks data as arising from an underlying illness-death model system in which individuals may undergo one or more of three transitions: 1) from some initial condition to non-terminal event, 2) from some initial condition to terminal event, 3) from non-terminal event to terminal event. Let ,
denote time to non-terminal and terminal event from subject
in cluster
. The system of transitions is modeled via the specification of three hazard functions:
where is a subject-specific frailty and
=(
,
,
) is a vector of cluster-specific random effects (each specific to one of the three possible transitions), taken to be independent of
,
, and
.
For
,
is an unspecified baseline hazard function and
is a vector of
log-hazard ratio regression parameters.
The
is assumed to be Markov with respect to
. We refer to the model specified by three conditional hazard functions as the Markov model.
An alternative specification is to model the risk of terminal event following non-terminal event as a function of the sojourn time. Specifically, retaining
and
as above,
we consider modeling
as follows:
We refer to this alternative model as the semi-Markov model.
For parametric MVN prior specification for a vector of cluster-specific random effects, we assume arise as i.i.d. draws from a mean 0 MVN distribution with variance-covariance matrix
. The diagonal elements of the
matrix
characterize variation across clusters in risk for non-terminal, terminal and terminal following non-terminal event, respectively, which is not explained by covariates included in the linear predictors. Specifically, the priors can be written as follows:
For DPM prior specification for , we consider non-parametric Dirichlet process mixture of MVN distributions: the
's are draws from a finite mixture of M multivariate Normal distributions, each with their own mean vector and variance-covariance matrix, (
,
) for
. Let
denote the specific component to which the
th cluster belongs. Since the class-specific (
,
) are unknown they are taken to be draws from some distribution,
, often referred to as the centering distribution. Furthermore, since the true class memberships are not known, we denote the probability that the
th cluster belongs to any given class by the vector
whose components add up to 1.0. In the absence of prior knowledge regarding the distribution of class memberships for the
clusters across the
classes, a natural prior for
is the conjugate symmetric
distribution; the hyperparameter,
, is often referred to as a the precision parameter. The prior can be represented as follows (
goes to infinity):
where is taken to be a multivariate Normal/inverse-Wishart (NIW) distribution for which the probability density function is the following product:
We consider as the prior for concentration parameter
.
For non-parametric PEM prior specification for baseline hazard functions, let denote the largest observed event time for each transition
.
Then, consider the finite partition of the relevant time axis into
disjoint intervals:
. For notational convenience, let
denote the
partition. For given a partition,
, we assume the log-baseline hazard functions is piecewise constant:
where is the indicator function and
. Note, this specification is general in that the partitions of the time axes differ across the three hazard functions. our prior choices are, for
:
Note that and
are treated as random and the priors for
and
jointly form a time-homogeneous Poisson process prior for the partition. The number of time splits and their positions are therefore updated within our computational scheme using reversible jump MCMC.
For parametric Weibull prior specification for baseline hazard functions, . In our Bayesian framework, our prior choices are, for
:
Our prior choice for remaining model parameters in all of four models (Weibull-MVN, Weibull-DPM, PEM-MVN, PEM-DPM) is given as follows:
We provide a detailed description of the hierarchical models for cluster-correlated semi-competing risks data. The models for independent semi-competing risks data can be obtained by removing cluster-specific random effects, , and its corresponding prior specification from the description given above.
BayesID_HReg
returns an object of class Bayes_HReg
.
The posterior samples of and
are saved separately in
working directory/path
.
For a dataset with large ,
nGam_save
should be carefully specified considering the system memory and the storage capacity.
Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2015),
Bayesian semiparametric analysis of semicompeting risks data:
investigating hospital readmission after a pancreatic cancer diagnosis, Journal of the Royal Statistical Society: Series C, 64, 2, 253-273.
Lee, K. H., Dominici, F., Schrag, D., and Haneuse, S. (2016),
Hierarchical models for semicompeting risks data with application to quality of end-of-life care for pancreatic cancer, Journal of the American Statistical Association, 111, 515, 1075-1095.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
initiate.startValues_HReg
, print.Bayes_HReg
, summary.Bayes_HReg
, predict.Bayes_HReg
## Not run: # loading a data set data(scrData) id=scrData$cluster form <- Formula(time1 + event1 | time2 + event2 ~ x1 + x2 + x3 | x1 + x2 | x1 + x2) ##################### ## Hyperparameters ## ##################### ## Subject-specific frailty variance component ## - prior parameters for 1/theta ## theta.ab <- c(0.7, 0.7) ## Weibull baseline hazard function: alphas, kappas ## WB.ab1 <- c(0.5, 0.01) # prior parameters for alpha1 WB.ab2 <- c(0.5, 0.01) # prior parameters for alpha2 WB.ab3 <- c(0.5, 0.01) # prior parameters for alpha3 ## WB.cd1 <- c(0.5, 0.05) # prior parameters for kappa1 WB.cd2 <- c(0.5, 0.05) # prior parameters for kappa2 WB.cd3 <- c(0.5, 0.05) # prior parameters for kappa3 ## PEM baseline hazard function ## PEM.ab1 <- c(0.7, 0.7) # prior parameters for 1/sigma_1^2 PEM.ab2 <- c(0.7, 0.7) # prior parameters for 1/sigma_2^2 PEM.ab3 <- c(0.7, 0.7) # prior parameters for 1/sigma_3^2 ## PEM.alpha1 <- 10 # prior parameters for K1 PEM.alpha2 <- 10 # prior parameters for K2 PEM.alpha3 <- 10 # prior parameters for K3 ## MVN cluster-specific random effects ## Psi_v <- diag(1, 3) rho_v <- 100 ## DPM cluster-specific random effects ## Psi0 <- diag(1, 3) rho0 <- 10 aTau <- 1.5 bTau <- 0.0125 ## hyperParams <- list(theta=theta.ab, WB=list(WB.ab1=WB.ab1, WB.ab2=WB.ab2, WB.ab3=WB.ab3, WB.cd1=WB.cd1, WB.cd2=WB.cd2, WB.cd3=WB.cd3), PEM=list(PEM.ab1=PEM.ab1, PEM.ab2=PEM.ab2, PEM.ab3=PEM.ab3, PEM.alpha1=PEM.alpha1, PEM.alpha2=PEM.alpha2, PEM.alpha3=PEM.alpha3), MVN=list(Psi_v=Psi_v, rho_v=rho_v), DPM=list(Psi0=Psi0, rho0=rho0, aTau=aTau, bTau=bTau)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 2000 thin <- 10 burninPerc <- 0.5 ## Settings for storage ## nGam_save <- 0 storeV <- rep(TRUE, 3) ## Tuning parameters for specific updates ## ## - those common to all models mhProp_theta_var <- 0.05 mhProp_Vg_var <- c(0.05, 0.05, 0.05) ## ## - those specific to the Weibull specification of the baseline hazard functions mhProp_alphag_var <- c(0.01, 0.01, 0.01) ## ## - those specific to the PEM specification of the baseline hazard functions Cg <- c(0.2, 0.2, 0.2) delPertg <- c(0.5, 0.5, 0.5) rj.scheme <- 1 Kg_max <- c(50, 50, 50) sg_max <- c(max(scrData$time1[scrData$event1 == 1]), max(scrData$time2[scrData$event1 == 0 & scrData$event2 == 1]), max(scrData$time2[scrData$event1 == 1 & scrData$event2 == 1])) time_lambda1 <- seq(1, sg_max[1], 1) time_lambda2 <- seq(1, sg_max[2], 1) time_lambda3 <- seq(1, sg_max[3], 1) ## mcmc.WB <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save, storeV=storeV), tuning=list(mhProp_theta_var=mhProp_theta_var, mhProp_Vg_var=mhProp_Vg_var, mhProp_alphag_var=mhProp_alphag_var)) ## mcmc.PEM <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save, storeV=storeV), tuning=list(mhProp_theta_var=mhProp_theta_var, mhProp_Vg_var=mhProp_Vg_var, Cg=Cg, delPertg=delPertg, rj.scheme=rj.scheme, Kg_max=Kg_max, time_lambda1=time_lambda1, time_lambda2=time_lambda2, time_lambda3=time_lambda3)) ##################### ## Starting Values ## ##################### ## Sigma_V <- diag(0.1, 3) Sigma_V[1,2] <- Sigma_V[2,1] <- -0.05 Sigma_V[1,3] <- Sigma_V[3,1] <- -0.06 Sigma_V[2,3] <- Sigma_V[3,2] <- 0.07 ################################################################# ## Analysis of Independent Semi-Competing Risks Data ############ ################################################################# ############# ## WEIBULL ## ############# ## myModel <- c("semi-Markov", "Weibull") myPath <- "Output/01-Results-WB/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, nChain=2) ## fit_WB <- BayesID_HReg(form, scrData, id=NULL, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ######### ## PEM ## ######### ## myModel <- c("semi-Markov", "PEM") myPath <- "Output/02-Results-PEM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, nChain=2) ## fit_PEM <- BayesID_HReg(form, scrData, id=NULL, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM summ.fit_PEM <- summary(fit_PEM); names(summ.fit_PEM) summ.fit_PEM pred_PEM <- predict(fit_PEM) plot(pred_PEM, plot.est="Haz") plot(pred_PEM, plot.est="Surv") ################################################################# ## Analysis of Correlated Semi-Competing Risks Data ############# ################################################################# ################# ## WEIBULL-MVN ## ################# ## myModel <- c("semi-Markov", "Weibull", "MVN") myPath <- "Output/03-Results-WB_MVN/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_WB_MVN <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_MVN summ.fit_WB_MVN <- summary(fit_WB_MVN); names(summ.fit_WB_MVN) summ.fit_WB_MVN pred_WB_MVN <- predict(fit_WB_MVN, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_MVN, plot.est="Haz") plot(pred_WB_MVN, plot.est="Surv") ################# ## WEIBULL-DPM ## ################# ## myModel <- c("semi-Markov", "Weibull", "DPM") myPath <- "Output/04-Results-WB_DPM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_WB_DPM <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_DPM summ.fit_WB_DPM <- summary(fit_WB_DPM); names(summ.fit_WB_DPM) summ.fit_WB_DPM pred_WB_DPM <- predict(fit_WB_MVN, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_DPM, plot.est="Haz") plot(pred_WB_DPM, plot.est="Surv") ############# ## PEM-MVN ## ############# ## myModel <- c("semi-Markov", "PEM", "MVN") myPath <- "Output/05-Results-PEM_MVN/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_PEM_MVN <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_MVN summ.fit_PEM_MVN <- summary(fit_PEM_MVN); names(summ.fit_PEM_MVN) summ.fit_PEM_MVN pred_PEM_MVN <- predict(fit_PEM_MVN) plot(pred_PEM_MVN, plot.est="Haz") plot(pred_PEM_MVN, plot.est="Surv") ############# ## PEM-DPM ## ############# ## myModel <- c("semi-Markov", "PEM", "DPM") myPath <- "Output/06-Results-PEM_DPM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_PEM_DPM <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_DPM summ.fit_PEM_DPM <- summary(fit_PEM_DPM); names(summ.fit_PEM_DPM) summ.fit_PEM_DPM pred_PEM_DPM <- predict(fit_PEM_DPM) plot(pred_PEM_DPM, plot.est="Haz") plot(pred_PEM_DPM, plot.est="Surv") ## End(Not run)
## Not run: # loading a data set data(scrData) id=scrData$cluster form <- Formula(time1 + event1 | time2 + event2 ~ x1 + x2 + x3 | x1 + x2 | x1 + x2) ##################### ## Hyperparameters ## ##################### ## Subject-specific frailty variance component ## - prior parameters for 1/theta ## theta.ab <- c(0.7, 0.7) ## Weibull baseline hazard function: alphas, kappas ## WB.ab1 <- c(0.5, 0.01) # prior parameters for alpha1 WB.ab2 <- c(0.5, 0.01) # prior parameters for alpha2 WB.ab3 <- c(0.5, 0.01) # prior parameters for alpha3 ## WB.cd1 <- c(0.5, 0.05) # prior parameters for kappa1 WB.cd2 <- c(0.5, 0.05) # prior parameters for kappa2 WB.cd3 <- c(0.5, 0.05) # prior parameters for kappa3 ## PEM baseline hazard function ## PEM.ab1 <- c(0.7, 0.7) # prior parameters for 1/sigma_1^2 PEM.ab2 <- c(0.7, 0.7) # prior parameters for 1/sigma_2^2 PEM.ab3 <- c(0.7, 0.7) # prior parameters for 1/sigma_3^2 ## PEM.alpha1 <- 10 # prior parameters for K1 PEM.alpha2 <- 10 # prior parameters for K2 PEM.alpha3 <- 10 # prior parameters for K3 ## MVN cluster-specific random effects ## Psi_v <- diag(1, 3) rho_v <- 100 ## DPM cluster-specific random effects ## Psi0 <- diag(1, 3) rho0 <- 10 aTau <- 1.5 bTau <- 0.0125 ## hyperParams <- list(theta=theta.ab, WB=list(WB.ab1=WB.ab1, WB.ab2=WB.ab2, WB.ab3=WB.ab3, WB.cd1=WB.cd1, WB.cd2=WB.cd2, WB.cd3=WB.cd3), PEM=list(PEM.ab1=PEM.ab1, PEM.ab2=PEM.ab2, PEM.ab3=PEM.ab3, PEM.alpha1=PEM.alpha1, PEM.alpha2=PEM.alpha2, PEM.alpha3=PEM.alpha3), MVN=list(Psi_v=Psi_v, rho_v=rho_v), DPM=list(Psi0=Psi0, rho0=rho0, aTau=aTau, bTau=bTau)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 2000 thin <- 10 burninPerc <- 0.5 ## Settings for storage ## nGam_save <- 0 storeV <- rep(TRUE, 3) ## Tuning parameters for specific updates ## ## - those common to all models mhProp_theta_var <- 0.05 mhProp_Vg_var <- c(0.05, 0.05, 0.05) ## ## - those specific to the Weibull specification of the baseline hazard functions mhProp_alphag_var <- c(0.01, 0.01, 0.01) ## ## - those specific to the PEM specification of the baseline hazard functions Cg <- c(0.2, 0.2, 0.2) delPertg <- c(0.5, 0.5, 0.5) rj.scheme <- 1 Kg_max <- c(50, 50, 50) sg_max <- c(max(scrData$time1[scrData$event1 == 1]), max(scrData$time2[scrData$event1 == 0 & scrData$event2 == 1]), max(scrData$time2[scrData$event1 == 1 & scrData$event2 == 1])) time_lambda1 <- seq(1, sg_max[1], 1) time_lambda2 <- seq(1, sg_max[2], 1) time_lambda3 <- seq(1, sg_max[3], 1) ## mcmc.WB <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save, storeV=storeV), tuning=list(mhProp_theta_var=mhProp_theta_var, mhProp_Vg_var=mhProp_Vg_var, mhProp_alphag_var=mhProp_alphag_var)) ## mcmc.PEM <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save, storeV=storeV), tuning=list(mhProp_theta_var=mhProp_theta_var, mhProp_Vg_var=mhProp_Vg_var, Cg=Cg, delPertg=delPertg, rj.scheme=rj.scheme, Kg_max=Kg_max, time_lambda1=time_lambda1, time_lambda2=time_lambda2, time_lambda3=time_lambda3)) ##################### ## Starting Values ## ##################### ## Sigma_V <- diag(0.1, 3) Sigma_V[1,2] <- Sigma_V[2,1] <- -0.05 Sigma_V[1,3] <- Sigma_V[3,1] <- -0.06 Sigma_V[2,3] <- Sigma_V[3,2] <- 0.07 ################################################################# ## Analysis of Independent Semi-Competing Risks Data ############ ################################################################# ############# ## WEIBULL ## ############# ## myModel <- c("semi-Markov", "Weibull") myPath <- "Output/01-Results-WB/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, nChain=2) ## fit_WB <- BayesID_HReg(form, scrData, id=NULL, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ######### ## PEM ## ######### ## myModel <- c("semi-Markov", "PEM") myPath <- "Output/02-Results-PEM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, nChain=2) ## fit_PEM <- BayesID_HReg(form, scrData, id=NULL, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM summ.fit_PEM <- summary(fit_PEM); names(summ.fit_PEM) summ.fit_PEM pred_PEM <- predict(fit_PEM) plot(pred_PEM, plot.est="Haz") plot(pred_PEM, plot.est="Surv") ################################################################# ## Analysis of Correlated Semi-Competing Risks Data ############# ################################################################# ################# ## WEIBULL-MVN ## ################# ## myModel <- c("semi-Markov", "Weibull", "MVN") myPath <- "Output/03-Results-WB_MVN/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_WB_MVN <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_MVN summ.fit_WB_MVN <- summary(fit_WB_MVN); names(summ.fit_WB_MVN) summ.fit_WB_MVN pred_WB_MVN <- predict(fit_WB_MVN, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_MVN, plot.est="Haz") plot(pred_WB_MVN, plot.est="Surv") ################# ## WEIBULL-DPM ## ################# ## myModel <- c("semi-Markov", "Weibull", "DPM") myPath <- "Output/04-Results-WB_DPM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_WB_DPM <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_DPM summ.fit_WB_DPM <- summary(fit_WB_DPM); names(summ.fit_WB_DPM) summ.fit_WB_DPM pred_WB_DPM <- predict(fit_WB_MVN, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_DPM, plot.est="Haz") plot(pred_WB_DPM, plot.est="Surv") ############# ## PEM-MVN ## ############# ## myModel <- c("semi-Markov", "PEM", "MVN") myPath <- "Output/05-Results-PEM_MVN/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_PEM_MVN <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_MVN summ.fit_PEM_MVN <- summary(fit_PEM_MVN); names(summ.fit_PEM_MVN) summ.fit_PEM_MVN pred_PEM_MVN <- predict(fit_PEM_MVN) plot(pred_PEM_MVN, plot.est="Haz") plot(pred_PEM_MVN, plot.est="Surv") ############# ## PEM-DPM ## ############# ## myModel <- c("semi-Markov", "PEM", "DPM") myPath <- "Output/06-Results-PEM_DPM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, id, nChain=2) ## fit_PEM_DPM <- BayesID_HReg(form, scrData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_DPM summ.fit_PEM_DPM <- summary(fit_PEM_DPM); names(summ.fit_PEM_DPM) summ.fit_PEM_DPM pred_PEM_DPM <- predict(fit_PEM_DPM) plot(pred_PEM_DPM, plot.est="Haz") plot(pred_PEM_DPM, plot.est="Surv") ## End(Not run)
Independent univariate survival data can be analyzed using AFT models that have a hierarchical structure. The proposed models can accomodate left-truncated and/or interval-censored data. An efficient computational algorithm that gives users the flexibility to adopt either a fully parametric (log-Normal) or a semi-parametric (Dirichlet process mixture) model specification is developed.
BayesSurv_AFT(Formula, data, model = "LN", hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
BayesSurv_AFT(Formula, data, model = "LN", hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
Formula |
a |
data |
a data.frame in which to interpret the variables named in |
model |
The specification of baseline survival distribution: "LN" or "DPM". |
hyperParams |
a list containing lists or vectors for hyperparameter values in hierarchical models. Components include,
|
startValues |
a list containing vectors of starting values for model parameters. It can be specified as the object returned by the function |
mcmcParams |
a list containing variables required for MCMC sampling. Components include,
|
na.action |
how NAs are treated. See |
subset |
a specification of the rows to be used: defaults to all rows. See |
path |
the name of directory where the results are saved. |
The function BayesSurv_AFT
implements Bayesian semi-parametric (DPM) and parametric (log-Normal) models to univariate time-to-event data in the presence of left-truncation and/or interval-censoring. Consider a univariate AFT model that relates the covariate to survival time
for the
subject:
where is a random variable whose distribution determines that of
and
is a vector of regression parameters. Considering the interval censoring, the time to the event for the
subject satisfies
. Let
denote the left-truncation time.
For the Bayesian parametric analysis, we take
to follow the Normal(
,
) distribution for
. The following prior distributions are adopted for the model parameters:
For the Bayesian semi-parametric analysis, we assume that is taken as draws from the DPM of normal distributions:
We refer readers to print.Bayes_AFT
for a detailed illustration of DPM specification. We adopt a non-informative flat prior on the real line for the regression parameters and a Gamma(
,
) hyperprior for the precision parameter
.
BayesSurv_AFT
returns an object of class Bayes_AFT
.
Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Rondeau, V., and Haneuse, S. (2017),
Accelerated failure time models for semicompeting risks data in the presence of complex censoring, Biometrics, 73, 4, 1401-1412.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
initiate.startValues_AFT
, print.Bayes_AFT
, summary.Bayes_AFT
, predict.Bayes_AFT
## Not run: # loading a data set data(survData) survData$yL <- survData$yU <- survData[,1] survData$yU[which(survData[,2] == 0)] <- Inf survData$LT <- rep(0, dim(survData)[1]) form <- Formula(LT | yL + yU ~ cov1 + cov2) ##################### ## Hyperparameters ## ##################### ## log-Normal model ## LN.ab <- c(0.3, 0.3) ## DPM model ## DPM.mu <- log(12) DPM.sigSq <- 100 DPM.ab <- c(2, 1) Tau.ab <- c(1.5, 0.0125) ## hyperParams <- list(LN=list(LN.ab=LN.ab), DPM=list(DPM.mu=DPM.mu, DPM.sigSq=DPM.sigSq, DPM.ab=DPM.ab, Tau.ab=Tau.ab)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 100 thin <- 1 burninPerc <- 0.5 ## Tuning parameters for specific updates ## ## - those common to all models beta.prop.var <- 0.01 mu.prop.var <- 0.1 zeta.prop.var <- 0.1 ## mcmcParams <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), tuning=list(beta.prop.var=beta.prop.var, mu.prop.var=mu.prop.var, zeta.prop.var=zeta.prop.var)) ################################################################ ## Analysis of Independent univariate survival data ############ ################################################################ ############### ## logNormal ## ############### ## myModel <- "LN" myPath <- "Output/01-Results-LN/" startValues <- initiate.startValues_AFT(form, survData, model=myModel, nChain=2) ## fit_LN <- BayesSurv_AFT(form, survData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_LN summ.fit_LN <- summary(fit_LN); names(summ.fit_LN) summ.fit_LN pred_LN <- predict(fit_LN, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_LN, plot.est="Haz") plot(pred_LN, plot.est="Surv") ######### ## DPM ## ######### ## myModel <- "DPM" myPath <- "Output/02-Results-DPM/" startValues <- initiate.startValues_AFT(form, survData, model=myModel, nChain=2) ## fit_DPM <- BayesSurv_AFT(form, survData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_DPM summ.fit_DPM <- summary(fit_DPM); names(summ.fit_DPM) summ.fit_DPM pred_DPM <- predict(fit_DPM, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_DPM, plot.est="Haz") plot(pred_DPM, plot.est="Surv") ## End(Not run)
## Not run: # loading a data set data(survData) survData$yL <- survData$yU <- survData[,1] survData$yU[which(survData[,2] == 0)] <- Inf survData$LT <- rep(0, dim(survData)[1]) form <- Formula(LT | yL + yU ~ cov1 + cov2) ##################### ## Hyperparameters ## ##################### ## log-Normal model ## LN.ab <- c(0.3, 0.3) ## DPM model ## DPM.mu <- log(12) DPM.sigSq <- 100 DPM.ab <- c(2, 1) Tau.ab <- c(1.5, 0.0125) ## hyperParams <- list(LN=list(LN.ab=LN.ab), DPM=list(DPM.mu=DPM.mu, DPM.sigSq=DPM.sigSq, DPM.ab=DPM.ab, Tau.ab=Tau.ab)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 100 thin <- 1 burninPerc <- 0.5 ## Tuning parameters for specific updates ## ## - those common to all models beta.prop.var <- 0.01 mu.prop.var <- 0.1 zeta.prop.var <- 0.1 ## mcmcParams <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), tuning=list(beta.prop.var=beta.prop.var, mu.prop.var=mu.prop.var, zeta.prop.var=zeta.prop.var)) ################################################################ ## Analysis of Independent univariate survival data ############ ################################################################ ############### ## logNormal ## ############### ## myModel <- "LN" myPath <- "Output/01-Results-LN/" startValues <- initiate.startValues_AFT(form, survData, model=myModel, nChain=2) ## fit_LN <- BayesSurv_AFT(form, survData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_LN summ.fit_LN <- summary(fit_LN); names(summ.fit_LN) summ.fit_LN pred_LN <- predict(fit_LN, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_LN, plot.est="Haz") plot(pred_LN, plot.est="Surv") ######### ## DPM ## ######### ## myModel <- "DPM" myPath <- "Output/02-Results-DPM/" startValues <- initiate.startValues_AFT(form, survData, model=myModel, nChain=2) ## fit_DPM <- BayesSurv_AFT(form, survData, model=myModel, hyperParams, startValues, mcmcParams, path=myPath) fit_DPM summ.fit_DPM <- summary(fit_DPM); names(summ.fit_DPM) summ.fit_DPM pred_DPM <- predict(fit_DPM, time = seq(0, 35, 1), tseq=seq(from=0, to=30, by=5)) plot(pred_DPM, plot.est="Haz") plot(pred_DPM, plot.est="Surv") ## End(Not run)
Independent/cluster-correlated univariate right-censored survival data can be analyzed using hierarchical models. The prior for the baseline hazard function can be specified by either parametric (Weibull) model or non-parametric mixture of piecewise exponential models (PEM).
BayesSurv_HReg(Formula, data, id=NULL, model="Weibull", hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
BayesSurv_HReg(Formula, data, id=NULL, model="Weibull", hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL)
Formula |
a |
data |
a data.frame in which to interpret the variables named in |
id |
a vector of cluster information for |
model |
a character vector that specifies the type of components in a model. The first element is for the specification of baseline hazard functions: "Weibull" or "PEM". The second element needs to be set only for clustered data and is for the specification of cluster-specific random effects distribution: "Normal" or "DPM". |
hyperParams |
a list containing lists or vectors for hyperparameter values in hierarchical models. Components include,
|
startValues |
a list containing vectors of starting values for model parameters. It can be specified as the object returned by the function |
mcmcParams |
a list containing variables required for MCMC sampling. Components include,
|
na.action |
how NAs are treated. See |
subset |
a specification of the rows to be used: defaults to all rows. See |
path |
the name of directory where the results are saved. |
The function BayesSurv_HReg
implements Bayesian semi-parametric (piecewise exponential mixture) and parametric (Weibull) models to univariate time-to-event data. Let denote time to event of interest from subject
in cluster
. The covariates
are incorporated via Cox proportional hazards model:
where is an unspecified baseline hazard function and
is a vector of
log-hazard ratio regression parameters.
's are cluster-specific random effects.
For parametric Normal prior specification for a vector of cluster-specific random effects, we assume
arise as i.i.d. draws from a mean 0 Normal distribution with variance
. Specifically, the priors can be written as follows:
For DPM prior specification for , we consider non-parametric Dirichlet process mixture of Normal distributions: the
's' are draws from a finite mixture of M Normal distributions, each with their own mean and variance, (
,
) for
. Let
denote the specific component to which the
th cluster belongs. Since the class-specific (
,
) are not known they are taken to be draws from some distribution,
, often referred to as the centering distribution. Furthermore, since the true class memberships are unknown, we denote the probability that the
th cluster belongs to any given class by the vector
whose components add up to 1.0. In the absence of prior knowledge regarding the distribution of class memberships for the
clusters across the
classes, a natural prior for
is the conjugate symmetric
distribution; the hyperparameter,
, is often referred to as a the precision parameter. The prior can be represented as follows (
goes to infinity):
where is taken to be a multivariate Normal/inverse-Gamma (NIG) distribution for which the probability density function is the following product:
In addition, we use as the hyperprior for
.
For non-parametric prior specification (PEM) for baseline hazard function, let denote the largest observed event time. Then, consider the finite partition of the relevant time axis into
disjoint intervals:
. For notational convenience, let
denote the
partition. For given a partition,
, we assume the log-baseline hazard functions is piecewise constant:
where is the indicator function and
. In our proposed Bayesian framework, our prior choices are:
Note that and
are treated as random and the priors for
and
jointly form a time-homogeneous Poisson process prior for the partition. The number of time splits and their positions are therefore updated within our computational scheme using reversible jump MCMC.
For parametric Weibull prior specification for baseline hazard function, .
In our Bayesian framework, our prior choices are:
We provide a detailed description of the hierarchical models for cluster-correlated univariate survival data. The models for independent data can be obtained by removing cluster-specific random effects, , and its corresponding prior specification from the description given above.
BayesSurv_HReg
returns an object of class Bayes_HReg
.
The posterior samples of are saved separately in
working directory/path
.
Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2015),
Bayesian semiparametric analysis of semicompeting risks data:
investigating hospital readmission after a pancreatic cancer diagnosis, Journal of the Royal Statistical Society: Series C, 64, 2, 253-273.
Lee, K. H., Dominici, F., Schrag, D., and Haneuse, S. (2016),
Hierarchical models for semicompeting risks data with application to quality of end-of-life care for pancreatic cancer, Journal of the American Statistical Association, 111, 515, 1075-1095.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
initiate.startValues_HReg
, print.Bayes_HReg
, summary.Bayes_HReg
, predict.Bayes_HReg
## Not run: # loading a data set data(survData) id=survData$cluster form <- Formula(time + event ~ cov1 + cov2) ##################### ## Hyperparameters ## ##################### ## Weibull baseline hazard function: alpha1, kappa1 ## WB.ab <- c(0.5, 0.01) # prior parameters for alpha ## WB.cd <- c(0.5, 0.05) # prior parameters for kappa ## PEM baseline hazard function: ## PEM.ab <- c(0.7, 0.7) # prior parameters for 1/sigma^2 ## PEM.alpha <- 10 # prior parameters for K ## Normal cluster-specific random effects ## Normal.ab <- c(0.5, 0.01) # prior for zeta ## DPM cluster-specific random effects ## DPM.ab <- c(0.5, 0.01) aTau <- 1.5 bTau <- 0.0125 ## hyperParams <- list(WB=list(WB.ab=WB.ab, WB.cd=WB.cd), PEM=list(PEM.ab=PEM.ab, PEM.alpha=PEM.alpha), Normal=list(Normal.ab=Normal.ab), DPM=list(DPM.ab=DPM.ab, aTau=aTau, bTau=bTau)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 2000 thin <- 10 burninPerc <- 0.5 ## Settings for storage ## storeV <- TRUE ## Tuning parameters for specific updates ## ## - those common to all models mhProp_V_var <- 0.05 ## ## - those specific to the Weibull specification of the baseline hazard functions mhProp_alpha_var <- 0.01 ## ## - those specific to the PEM specification of the baseline hazard functions C <- 0.2 delPert <- 0.5 rj.scheme <- 1 K_max <- 50 s_max <- max(survData$time[survData$event == 1]) time_lambda <- seq(1, s_max, 1) ## mcmc.WB <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(storeV=storeV), tuning=list(mhProp_alpha_var=mhProp_alpha_var, mhProp_V_var=mhProp_V_var)) ## mcmc.PEM <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(storeV=storeV), tuning=list(mhProp_V_var=mhProp_V_var, C=C, delPert=delPert, rj.scheme=rj.scheme, K_max=K_max, time_lambda=time_lambda)) ################################################################ ## Analysis of Independent Univariate Survival Data ############ ################################################################ ############# ## WEIBULL ## ############# ## myModel <- "Weibull" myPath <- "Output/01-Results-WB/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, nChain=2) ## fit_WB <- BayesSurv_HReg(form, survData, id=NULL, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ######### ## PEM ## ######### ## myModel <- "PEM" myPath <- "Output/02-Results-PEM/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, nChain=2) ## fit_PEM <- BayesSurv_HReg(form, survData, id=NULL, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM summ.fit_PEM <- summary(fit_PEM); names(summ.fit_PEM) summ.fit_PEM pred_PEM <- predict(fit_PEM) plot(pred_PEM, plot.est="Haz") plot(pred_PEM, plot.est="Surv") ############################################################### ## Analysis of Correlated Univariate Survival Data ############ ############################################################### #################### ## WEIBULL-NORMAL ## #################### ## myModel <- c("Weibull", "Normal") myPath <- "Output/03-Results-WB_Normal/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_WB_N <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_N summ.fit_WB_N <- summary(fit_WB_N); names(summ.fit_WB_N) summ.fit_WB_N pred_WB_N <- predict(fit_WB_N, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_N, plot.est="Haz") plot(pred_WB_N, plot.est="Surv") ################# ## WEIBULL-DPM ## ################# ## myModel <- c("Weibull", "DPM") myPath <- "Output/04-Results-WB_DPM/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_WB_DPM <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_DPM summ.fit_WB_DPM <- summary(fit_WB_DPM); names(summ.fit_WB_DPM) summ.fit_WB_DPM pred_WB_DPM <- predict(fit_WB_DPM, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_DPM, plot.est="Haz") plot(pred_WB_DPM, plot.est="Surv") ################ ## PEM-NORMAL ## ################ ## myModel <- c("PEM", "Normal") myPath <- "Output/05-Results-PEM_Normal/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_PEM_N <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_N summ.fit_PEM_N <- summary(fit_PEM_N); names(summ.fit_PEM_N) summ.fit_PEM_N pred_PEM_N <- predict(fit_PEM_N) plot(pred_PEM_N, plot.est="Haz") plot(pred_PEM_N, plot.est="Surv") ############# ## PEM-DPM ## ############# ## myModel <- c("PEM", "DPM") myPath <- "Output/06-Results-PEM_DPM/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_PEM_DPM <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_DPM summ.fit_PEM_DPM <- summary(fit_PEM_DPM); names(summ.fit_PEM_DPM) summ.fit_PEM_DPM pred_PEM_DPM <- predict(fit_PEM_DPM) plot(pred_PEM_DPM, plot.est="Haz") plot(pred_PEM_DPM, plot.est="Surv") ## End(Not run)
## Not run: # loading a data set data(survData) id=survData$cluster form <- Formula(time + event ~ cov1 + cov2) ##################### ## Hyperparameters ## ##################### ## Weibull baseline hazard function: alpha1, kappa1 ## WB.ab <- c(0.5, 0.01) # prior parameters for alpha ## WB.cd <- c(0.5, 0.05) # prior parameters for kappa ## PEM baseline hazard function: ## PEM.ab <- c(0.7, 0.7) # prior parameters for 1/sigma^2 ## PEM.alpha <- 10 # prior parameters for K ## Normal cluster-specific random effects ## Normal.ab <- c(0.5, 0.01) # prior for zeta ## DPM cluster-specific random effects ## DPM.ab <- c(0.5, 0.01) aTau <- 1.5 bTau <- 0.0125 ## hyperParams <- list(WB=list(WB.ab=WB.ab, WB.cd=WB.cd), PEM=list(PEM.ab=PEM.ab, PEM.alpha=PEM.alpha), Normal=list(Normal.ab=Normal.ab), DPM=list(DPM.ab=DPM.ab, aTau=aTau, bTau=bTau)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 2000 thin <- 10 burninPerc <- 0.5 ## Settings for storage ## storeV <- TRUE ## Tuning parameters for specific updates ## ## - those common to all models mhProp_V_var <- 0.05 ## ## - those specific to the Weibull specification of the baseline hazard functions mhProp_alpha_var <- 0.01 ## ## - those specific to the PEM specification of the baseline hazard functions C <- 0.2 delPert <- 0.5 rj.scheme <- 1 K_max <- 50 s_max <- max(survData$time[survData$event == 1]) time_lambda <- seq(1, s_max, 1) ## mcmc.WB <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(storeV=storeV), tuning=list(mhProp_alpha_var=mhProp_alpha_var, mhProp_V_var=mhProp_V_var)) ## mcmc.PEM <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(storeV=storeV), tuning=list(mhProp_V_var=mhProp_V_var, C=C, delPert=delPert, rj.scheme=rj.scheme, K_max=K_max, time_lambda=time_lambda)) ################################################################ ## Analysis of Independent Univariate Survival Data ############ ################################################################ ############# ## WEIBULL ## ############# ## myModel <- "Weibull" myPath <- "Output/01-Results-WB/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, nChain=2) ## fit_WB <- BayesSurv_HReg(form, survData, id=NULL, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ######### ## PEM ## ######### ## myModel <- "PEM" myPath <- "Output/02-Results-PEM/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, nChain=2) ## fit_PEM <- BayesSurv_HReg(form, survData, id=NULL, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM summ.fit_PEM <- summary(fit_PEM); names(summ.fit_PEM) summ.fit_PEM pred_PEM <- predict(fit_PEM) plot(pred_PEM, plot.est="Haz") plot(pred_PEM, plot.est="Surv") ############################################################### ## Analysis of Correlated Univariate Survival Data ############ ############################################################### #################### ## WEIBULL-NORMAL ## #################### ## myModel <- c("Weibull", "Normal") myPath <- "Output/03-Results-WB_Normal/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_WB_N <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_N summ.fit_WB_N <- summary(fit_WB_N); names(summ.fit_WB_N) summ.fit_WB_N pred_WB_N <- predict(fit_WB_N, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_N, plot.est="Haz") plot(pred_WB_N, plot.est="Surv") ################# ## WEIBULL-DPM ## ################# ## myModel <- c("Weibull", "DPM") myPath <- "Output/04-Results-WB_DPM/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_WB_DPM <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.WB, path=myPath) fit_WB_DPM summ.fit_WB_DPM <- summary(fit_WB_DPM); names(summ.fit_WB_DPM) summ.fit_WB_DPM pred_WB_DPM <- predict(fit_WB_DPM, tseq=seq(from=0, to=30, by=5)) plot(pred_WB_DPM, plot.est="Haz") plot(pred_WB_DPM, plot.est="Surv") ################ ## PEM-NORMAL ## ################ ## myModel <- c("PEM", "Normal") myPath <- "Output/05-Results-PEM_Normal/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_PEM_N <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_N summ.fit_PEM_N <- summary(fit_PEM_N); names(summ.fit_PEM_N) summ.fit_PEM_N pred_PEM_N <- predict(fit_PEM_N) plot(pred_PEM_N, plot.est="Haz") plot(pred_PEM_N, plot.est="Surv") ############# ## PEM-DPM ## ############# ## myModel <- c("PEM", "DPM") myPath <- "Output/06-Results-PEM_DPM/" startValues <- initiate.startValues_HReg(form, survData, model=myModel, id, nChain=2) ## fit_PEM_DPM <- BayesSurv_HReg(form, survData, id, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) fit_PEM_DPM summ.fit_PEM_DPM <- summary(fit_PEM_DPM); names(summ.fit_PEM_DPM) summ.fit_PEM_DPM pred_PEM_DPM <- predict(fit_PEM_DPM) plot(pred_PEM_DPM, plot.est="Haz") plot(pred_PEM_DPM, plot.est="Surv") ## End(Not run)
Data on 137 Bone Marrow Transplant Patients
data(BMT)
data(BMT)
a data frame with 137 observations on the following 22 variables.
g
disease group; 1-ALL, 2-AML low-risk, 3-high-risk
T1
time (in days) to death or on study time
T2
disease-Free survival time (time to relapse, death or end of study)
delta1
death indicator; 1-Dead, 0-Alive
delta2
relapse indicator; 1-Relapsed, 0-Disease-Free
delta3
disease-Free survival indicator; 1-Dead or relapsed, 0-Alive disease-free
TA
time (in days) to acute graft-versus-host disease
deltaA
acute graft-versus-host disease indicator; 1-Developed acute graft-versus-host disease, 0-Never developed acute graft-versus-host disease
TC
time (in days) to chronic graft-versus-host disease
deltaC
chronic graft-versus-host disease indicator; 1-Developed chronic graft-versus-host disease, 0-Never developed chronic graft-versus-host disease
TP
time (in days) to return of platelets to normal levels
deltaP
platelet recovery indicator; 1-Platelets returned to normal levels, 0-Platelets never returned to normal levels
Z1
patient age in years
Z2
donor age in years
Z3
patient sex: 1-Male, 2-Female
Z4
donor sex: 1-Male, 2-Female
Z5
patient CMV status: 1-CMV positive, 0-CMV negative
Z6
donor CMV status: 1-CMV positive, 0-CMV negative
Z7
waiting time to transplant in days
Z8
FAB: 1-FAB Grade 4 or 5 and AML, 0-Otherwise
Z9
hospital: 1-The Ohio State University, 2-Alfred, 3-St. Vincent, 4-Hahnemann
Z10
MTX used as a graft-versus-host-prophylactic; 1-Yes, 0-No
1. R package "KMsurv
".
2. Klein, J. P. and Moeschberger M. L. (2005).
Survival Analysis: Techniques for Censored and Truncated Data.
Klein, J. P. and Moeschberger M. L. (2005). Survival Analysis: Techniques for Censored and Truncated Data.
data(BMT)
data(BMT)
We provide a dataset with five covariates from a study of acute graft-versus-host (GVHD) disease with 9651 patients who underwent first allogeneic hematopoietic cell transplant. We also provide an algorithm to simulate semi-competing risks outcome data.
data("CIBMTR")
data("CIBMTR")
A data frame with 9651 observations on the following 5 variables.
sexP
patient sex: M
-Male, F
-Female
ageP
patient age: LessThan10
, 10to19
, 20to29
, 30to39
, 40to49
, 50to59
, 60plus
dType
disease type: AML
-Acute Myeloid Leukemia, ALL
-Acute Lymphoblastic Leukemia, CML
-Chronic Myeloid Leukemia, MDS
-Myelodysplastic Syndrome
dStatus
disease stage: Early
-early, Int
-intermediate, Adv
-advanced
donorGrp
human leukocyte antigen compatibility: HLA_Id_Sib
-identical sibling, 8_8
-8/8, 7_8
-7/8
See Examples below for an algorithm to simulate semi-competing risks outcome data.
Center for International Blood and Bone Marrow Transplant Research
Lee, C., Lee, S.J., Haneuse, S. (2017+). Time-to-event analysis when the event is defined on a finite time interval. under review.
data(CIBMTR_Params) data(CIBMTR) ## CREATING DUMMY VARIABLES ## # Sex (M: reference) CIBMTR$sexP <- as.numeric(CIBMTR$sexP)-1 # Age (LessThan10: reference) CIBMTR$ageP20to29 <- as.numeric(CIBMTR$ageP=="20to29") CIBMTR$ageP30to39 <- as.numeric(CIBMTR$ageP=="30to39") CIBMTR$ageP40to49 <- as.numeric(CIBMTR$ageP=="40to49") CIBMTR$ageP50to59 <- as.numeric(CIBMTR$ageP=="50to59") CIBMTR$ageP60plus <- as.numeric(CIBMTR$ageP=="60plus") # Disease type (AML: reference) CIBMTR$dTypeALL <- as.numeric(CIBMTR$dType=="ALL") CIBMTR$dTypeCML <- as.numeric(CIBMTR$dType=="CML") CIBMTR$dTypeMDS <- as.numeric(CIBMTR$dType=="MDS") # Disease status (Early: reference) CIBMTR$dStatusInt <- as.numeric(CIBMTR$dStatus=="Int") CIBMTR$dStatusAdv <- as.numeric(CIBMTR$dStatus=="Adv") # HLA compatibility (HLA_Id_Sib: reference) CIBMTR$donorGrp8_8 <- as.numeric(CIBMTR$donorGrp=="8_8") CIBMTR$donorGrp7_8 <- as.numeric(CIBMTR$donorGrp=="7_8") # Covariate matrix x <- CIBMTR[,c("sexP","ageP20to29","ageP30to39","ageP40to49","ageP50to59","ageP60plus", "dTypeALL","dTypeCML","dTypeMDS","dStatusInt","dStatusAdv","donorGrp8_8","donorGrp7_8")] # Set the parameter values beta1 <- CIBMTR_Params$beta1.true beta2 <- CIBMTR_Params$beta2.true beta3 <- CIBMTR_Params$beta3.true alpha1 <- CIBMTR_Params$alpha1.true alpha2 <- CIBMTR_Params$alpha2.true alpha3 <- CIBMTR_Params$alpha3.true kappa1 <- CIBMTR_Params$kappa1.true kappa2 <- CIBMTR_Params$kappa2.true kappa3 <- CIBMTR_Params$kappa3.true theta <- CIBMTR_Params$theta.true set.seed(1405) simCIBMTR <- simID(id=NULL, x, x, x, beta1, beta2, beta3, alpha1, alpha2, alpha3, kappa1, kappa2, kappa3, theta, SigmaV.true=NULL, cens=c(365,365)) names(simCIBMTR) <- c("time1", "event1", "time2", "event2") CIBMTR <- cbind(simCIBMTR, CIBMTR) head(CIBMTR)
data(CIBMTR_Params) data(CIBMTR) ## CREATING DUMMY VARIABLES ## # Sex (M: reference) CIBMTR$sexP <- as.numeric(CIBMTR$sexP)-1 # Age (LessThan10: reference) CIBMTR$ageP20to29 <- as.numeric(CIBMTR$ageP=="20to29") CIBMTR$ageP30to39 <- as.numeric(CIBMTR$ageP=="30to39") CIBMTR$ageP40to49 <- as.numeric(CIBMTR$ageP=="40to49") CIBMTR$ageP50to59 <- as.numeric(CIBMTR$ageP=="50to59") CIBMTR$ageP60plus <- as.numeric(CIBMTR$ageP=="60plus") # Disease type (AML: reference) CIBMTR$dTypeALL <- as.numeric(CIBMTR$dType=="ALL") CIBMTR$dTypeCML <- as.numeric(CIBMTR$dType=="CML") CIBMTR$dTypeMDS <- as.numeric(CIBMTR$dType=="MDS") # Disease status (Early: reference) CIBMTR$dStatusInt <- as.numeric(CIBMTR$dStatus=="Int") CIBMTR$dStatusAdv <- as.numeric(CIBMTR$dStatus=="Adv") # HLA compatibility (HLA_Id_Sib: reference) CIBMTR$donorGrp8_8 <- as.numeric(CIBMTR$donorGrp=="8_8") CIBMTR$donorGrp7_8 <- as.numeric(CIBMTR$donorGrp=="7_8") # Covariate matrix x <- CIBMTR[,c("sexP","ageP20to29","ageP30to39","ageP40to49","ageP50to59","ageP60plus", "dTypeALL","dTypeCML","dTypeMDS","dStatusInt","dStatusAdv","donorGrp8_8","donorGrp7_8")] # Set the parameter values beta1 <- CIBMTR_Params$beta1.true beta2 <- CIBMTR_Params$beta2.true beta3 <- CIBMTR_Params$beta3.true alpha1 <- CIBMTR_Params$alpha1.true alpha2 <- CIBMTR_Params$alpha2.true alpha3 <- CIBMTR_Params$alpha3.true kappa1 <- CIBMTR_Params$kappa1.true kappa2 <- CIBMTR_Params$kappa2.true kappa3 <- CIBMTR_Params$kappa3.true theta <- CIBMTR_Params$theta.true set.seed(1405) simCIBMTR <- simID(id=NULL, x, x, x, beta1, beta2, beta3, alpha1, alpha2, alpha3, kappa1, kappa2, kappa3, theta, SigmaV.true=NULL, cens=c(365,365)) names(simCIBMTR) <- c("time1", "event1", "time2", "event2") CIBMTR <- cbind(simCIBMTR, CIBMTR) head(CIBMTR)
Estimates for model parameters from semi-competing risks analysis of the CIBMTR data using Weibull illness-death model.
data("CIBMTR_Params")
data("CIBMTR_Params")
The format is a list of 10 components corresponding to parameters for Weibull illness-death model.
data(CIBMTR_Params)
data(CIBMTR_Params)
Independent semi-competing risks data can be analyzed using hierarchical models. Markov or semi-Markov assumption can be adopted for the conditional hazard function for time to the terminal event given time to non-terminal event.
FreqID_HReg(Formula, data, model="semi-Markov", frailty = TRUE, na.action = "na.fail", subset=NULL)
FreqID_HReg(Formula, data, model="semi-Markov", frailty = TRUE, na.action = "na.fail", subset=NULL)
Formula |
a |
data |
a data.frame in which to interpret the variables named in |
model |
a character value that specifies the type of a model based on the assumption on |
frailty |
a logical value to determine whether to include the subject-specific shared frailty term, |
na.action |
how NAs are treated. See |
subset |
a specification of the rows to be used: defaults to all rows. See |
See BayesID_HReg
for a detailed description of the models.
FreqID_HReg
returns an object of class Freq_HReg
.
Sebastien Haneuse and Kyu Ha Lee
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2015),
Bayesian semiparametric analysis of semicompeting risks data:
investigating hospital readmission after a pancreatic cancer diagnosis, Journal of the Royal Statistical Society: Series C, 64, 2, 253-273.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
print.Freq_HReg
, summary.Freq_HReg
, predict.Freq_HReg
, BayesID_HReg
.
## Not run: # loading a data set data(scrData) form <- Formula(time1 + event1 | time2 + event2 ~ x1 + x2 + x3 | x1 + x2 | x1 + x2) fit_WB <- FreqID_HReg(form, data=scrData, model="semi-Markov") fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ## End(Not run)
## Not run: # loading a data set data(scrData) form <- Formula(time1 + event1 | time2 + event2 ~ x1 + x2 + x3 | x1 + x2 | x1 + x2) fit_WB <- FreqID_HReg(form, data=scrData, model="semi-Markov") fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ## End(Not run)
Independent univariate right-censored survival data can be analyzed using hierarchical models.
FreqSurv_HReg(Formula, data, na.action = "na.fail", subset=NULL)
FreqSurv_HReg(Formula, data, na.action = "na.fail", subset=NULL)
Formula |
a |
data |
a data.frame in which to interpret the variables named in |
na.action |
how NAs are treated. See |
subset |
a specification of the rows to be used: defaults to all rows. See |
See BayesSurv_HReg
for a detailed description of the models.
FreqSurv_HReg
returns an object of class Freq_HReg
.
Sebastien Haneuse and Kyu Ha Lee
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2015),
Bayesian semiparametric analysis of semicompeting risks data:
investigating hospital readmission after a pancreatic cancer diagnosis, Journal of the Royal Statistical Society: Series C, 64, 2, 253-273.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
print.Freq_HReg
, summary.Freq_HReg
, predict.Freq_HReg
, BayesSurv_HReg
.
## Not run: # loading a data set data(survData) form <- Formula(time + event ~ cov1 + cov2) fit_WB <- FreqSurv_HReg(form, data=survData) fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ## End(Not run)
## Not run: # loading a data set data(survData) form <- Formula(time + event ~ cov1 + cov2) fit_WB <- FreqSurv_HReg(form, data=survData) fit_WB summ.fit_WB <- summary(fit_WB); names(summ.fit_WB) summ.fit_WB pred_WB <- predict(fit_WB, tseq=seq(from=0, to=30, by=5)) plot(pred_WB, plot.est="Haz") plot(pred_WB, plot.est="Surv") ## End(Not run)
The function initiates starting values for a single chain for accelrated failture time (AFT) models. Users are allowed to set some non-null values to starting values for a set of parameters. The function will automatically generate starting values for any parameters whose values are not specified.
initiate.startValues_AFT(Formula, data, model, nChain=1, beta1=NULL, beta2=NULL, beta3=NULL, beta=NULL, gamma=NULL, theta=NULL, y1=NULL, y2=NULL, y=NULL, LN.mu=NULL, LN.sigSq=NULL, DPM.class1=NULL, DPM.class2=NULL, DPM.class3=NULL, DPM.class=NULL, DPM.mu1=NULL, DPM.mu2=NULL, DPM.mu3=NULL, DPM.mu=NULL, DPM.zeta1=NULL, DPM.zeta2=NULL, DPM.zeta3=NULL, DPM.zeta=NULL, DPM.tau=NULL)
initiate.startValues_AFT(Formula, data, model, nChain=1, beta1=NULL, beta2=NULL, beta3=NULL, beta=NULL, gamma=NULL, theta=NULL, y1=NULL, y2=NULL, y=NULL, LN.mu=NULL, LN.sigSq=NULL, DPM.class1=NULL, DPM.class2=NULL, DPM.class3=NULL, DPM.class=NULL, DPM.mu1=NULL, DPM.mu2=NULL, DPM.mu3=NULL, DPM.mu=NULL, DPM.zeta1=NULL, DPM.zeta2=NULL, DPM.zeta3=NULL, DPM.zeta=NULL, DPM.tau=NULL)
Formula |
For |
data |
a data.frame in which to interpret the variables named in the formula(s) in |
model |
a character vector that specifies the type of components in a model. Check |
nChain |
The number of chains. |
beta1 |
starting values of |
beta2 |
starting values of |
beta3 |
starting values of |
beta |
starting values of |
gamma |
starting values of |
theta |
starting values of |
y1 |
starting values of |
y2 |
starting values of |
y |
starting values of |
LN.mu |
starting values of |
LN.sigSq |
starting values of |
DPM.class1 |
starting values of the class membership for transition 1 in DPM models for |
DPM.class2 |
starting values of the class membership for transition 2 in DPM models for |
DPM.class3 |
starting values of the class membership for transition 3 in DPM models for |
DPM.class |
starting values of the class membership in DPM models for |
DPM.mu1 |
starting values of |
DPM.mu2 |
starting values of |
DPM.mu3 |
starting values of |
DPM.mu |
starting values of |
DPM.zeta1 |
starting values of |
DPM.zeta2 |
starting values of |
DPM.zeta3 |
starting values of |
DPM.zeta |
starting values of |
DPM.tau |
starting values of |
initiate.startValues_AFT
returns a list containing starting values for a sigle chain that can be used for BayesID_AFT
and BayesSurv_AFT
.
Sebastien Haneuse and Kyu Ha Lee
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Rondeau, V., and Haneuse, S. (2017),
Accelerated failure time models for semicompeting risks data in the presence of complex censoring, Biometrics, 73, 4, 1401-1412.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
## See Examples in \code{\link{BayesID_AFT}} and \code{\link{BayesSurv_AFT}}.
## See Examples in \code{\link{BayesID_AFT}} and \code{\link{BayesSurv_AFT}}.
The function initiates starting values for a single chain for hazard regression (HReg) models. Users are allowed to set some non-null values to starting values for a set of parameters. The function will automatically generate starting values for any parameters whose values are not specified.
initiate.startValues_HReg(Formula, data, model, id = NULL, nChain=1, beta1 = NULL, beta2 = NULL, beta3 = NULL, beta = NULL, gamma.ji = NULL, theta = NULL, V.j1 = NULL, V.j2 = NULL, V.j3 = NULL, V.j = NULL, WB.alpha = NULL, WB.kappa = NULL, PEM.lambda1=NULL, PEM.lambda2=NULL, PEM.lambda3=NULL, PEM.lambda=NULL, PEM.s1=NULL, PEM.s2=NULL, PEM.s3=NULL, PEM.s=NULL, PEM.mu_lam=NULL, PEM.sigSq_lam=NULL, MVN.SigmaV = NULL, Normal.zeta = NULL, DPM.class = NULL, DPM.tau = NULL)
initiate.startValues_HReg(Formula, data, model, id = NULL, nChain=1, beta1 = NULL, beta2 = NULL, beta3 = NULL, beta = NULL, gamma.ji = NULL, theta = NULL, V.j1 = NULL, V.j2 = NULL, V.j3 = NULL, V.j = NULL, WB.alpha = NULL, WB.kappa = NULL, PEM.lambda1=NULL, PEM.lambda2=NULL, PEM.lambda3=NULL, PEM.lambda=NULL, PEM.s1=NULL, PEM.s2=NULL, PEM.s3=NULL, PEM.s=NULL, PEM.mu_lam=NULL, PEM.sigSq_lam=NULL, MVN.SigmaV = NULL, Normal.zeta = NULL, DPM.class = NULL, DPM.tau = NULL)
Formula |
For |
data |
a data.frame in which to interpret the variables named in the formula(s) in |
model |
a character vector that specifies the type of components in a model. Check |
id |
a vector of cluster information for |
nChain |
The number of chains. |
beta1 |
starting values of |
beta2 |
starting values of |
beta3 |
starting values of |
beta |
starting values of |
gamma.ji |
starting values of |
theta |
starting values of |
V.j1 |
starting values of |
V.j2 |
starting values of |
V.j3 |
starting values of |
V.j |
starting values of |
WB.alpha |
starting values of the Weibull parameters, |
WB.kappa |
starting values of the Weibull parameters, |
PEM.lambda1 |
starting values of the PEM parameters, |
PEM.lambda2 |
starting values of the PEM parameters, |
PEM.lambda3 |
starting values of the PEM parameters, |
PEM.lambda |
starting values of |
PEM.s1 |
starting values of the PEM parameters, |
PEM.s2 |
starting values of the PEM parameters, |
PEM.s3 |
starting values of the PEM parameters, |
PEM.s |
starting values of |
PEM.mu_lam |
starting values of the PEM parameters, |
PEM.sigSq_lam |
starting values of the PEM parameters, |
MVN.SigmaV |
starting values of |
Normal.zeta |
starting values of |
DPM.class |
starting values of the class membership in DPM models for |
DPM.tau |
starting values of |
initiate.startValues_HReg
returns a list containing starting values for a sigle chain that can be used for BayesID_HReg
and BayesSurv_HReg
.
Sebastien Haneuse and Kyu Ha Lee
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2015),
Bayesian semiparametric analysis of semicompeting risks data:
investigating hospital readmission after a pancreatic cancer diagnosis, Journal of the Royal Statistical Society: Series C, 64, 2, 253-273.
Lee, K. H., Dominici, F., Schrag, D., and Haneuse, S. (2016),
Hierarchical models for semicompeting risks data with application to quality of end-of-life care for pancreatic cancer, Journal of the American Statistical Association, 111, 515, 1075-1095.
Alvares, D., Haneuse, S., Lee, C., Lee, K. H. (2019),
SemiCompRisks: An R package for the analysis of independent and cluster-correlated semi-competing risks data, The R Journal, 11, 1, 376-400.
## See Examples in \code{\link{BayesID_HReg}} and \code{\link{BayesSurv_HReg}}.
## See Examples in \code{\link{BayesID_HReg}} and \code{\link{BayesSurv_HReg}}.
Bayes_HReg
/Bayes_AFT
/Freq_HReg
.
The Bayes_HReg
class represents results from Bayesian analysis of semi-competing risks or univariate time-to-event data in the context of hazard regression models.
The Bayes_AFT
class represents results from Bayesian analysis of semi-competing risks or univariate time-to-event data in the context of AFT models.
The Freq_HReg
class represents results from Frequentist analysis of semi-competing risks or univariate time-to-event data in the context of hazard regression models.
## S3 method for class 'Bayes_HReg' print(x, digits=3, alpha=0.05, ...) ## S3 method for class 'Bayes_AFT' print(x, digits=3, alpha=0.05, ...) ## S3 method for class 'summ.Bayes_HReg' print(x, digits=3, ...) ## S3 method for class 'summ.Bayes_AFT' print(x, digits=3, ...) ## S3 method for class 'Freq_HReg' print(x, digits=3, alpha=0.05, ...) ## S3 method for class 'summ.Freq_HReg' print(x, digits=3, ...) ## S3 method for class 'Bayes_HReg' summary(object, digits=3, alpha=0.05, ...) ## S3 method for class 'Bayes_AFT' summary(object, digits=3, alpha=0.05, ...) ## S3 method for class 'Freq_HReg' summary(object, digits=3, alpha=0.05, ...) ## S3 method for class 'Bayes_HReg' coef(object, alpha=0.05, ...) ## S3 method for class 'Bayes_AFT' coef(object, alpha=0.05, ...) ## S3 method for class 'Freq_HReg' coef(object, alpha=0.05, ...) ## S3 method for class 'Bayes_HReg' predict(object, xnew=NULL, x1new=NULL, x2new=NULL, x3new=NULL, tseq=c(0, 5, 10), alpha=0.05, ...) ## S3 method for class 'pred.Bayes_HReg' plot(x, plot.est="Haz", xlab=NULL, ylab=NULL, ...) ## S3 method for class 'Bayes_AFT' predict(object, xnew=NULL, x1new=NULL, x2new=NULL, x3new=NULL, time, tseq=c(0, 5, 10), alpha=0.05, ...) ## S3 method for class 'pred.Bayes_AFT' plot(x, plot.est="Haz", xlab=NULL, ylab=NULL, ...) ## S3 method for class 'Freq_HReg' predict(object, xnew=NULL, x1new=NULL, x2new=NULL, x3new=NULL, tseq=c(0, 5, 10), alpha=0.05, ...) ## S3 method for class 'pred.Freq_HReg' plot(x, plot.est="Haz", xlab=NULL, ylab=NULL, ...) ## S3 method for class 'Freq_HReg' vcov(object, ...)
## S3 method for class 'Bayes_HReg' print(x, digits=3, alpha=0.05, ...) ## S3 method for class 'Bayes_AFT' print(x, digits=3, alpha=0.05, ...) ## S3 method for class 'summ.Bayes_HReg' print(x, digits=3, ...) ## S3 method for class 'summ.Bayes_AFT' print(x, digits=3, ...) ## S3 method for class 'Freq_HReg' print(x, digits=3, alpha=0.05, ...) ## S3 method for class 'summ.Freq_HReg' print(x, digits=3, ...) ## S3 method for class 'Bayes_HReg' summary(object, digits=3, alpha=0.05, ...) ## S3 method for class 'Bayes_AFT' summary(object, digits=3, alpha=0.05, ...) ## S3 method for class 'Freq_HReg' summary(object, digits=3, alpha=0.05, ...) ## S3 method for class 'Bayes_HReg' coef(object, alpha=0.05, ...) ## S3 method for class 'Bayes_AFT' coef(object, alpha=0.05, ...) ## S3 method for class 'Freq_HReg' coef(object, alpha=0.05, ...) ## S3 method for class 'Bayes_HReg' predict(object, xnew=NULL, x1new=NULL, x2new=NULL, x3new=NULL, tseq=c(0, 5, 10), alpha=0.05, ...) ## S3 method for class 'pred.Bayes_HReg' plot(x, plot.est="Haz", xlab=NULL, ylab=NULL, ...) ## S3 method for class 'Bayes_AFT' predict(object, xnew=NULL, x1new=NULL, x2new=NULL, x3new=NULL, time, tseq=c(0, 5, 10), alpha=0.05, ...) ## S3 method for class 'pred.Bayes_AFT' plot(x, plot.est="Haz", xlab=NULL, ylab=NULL, ...) ## S3 method for class 'Freq_HReg' predict(object, xnew=NULL, x1new=NULL, x2new=NULL, x3new=NULL, tseq=c(0, 5, 10), alpha=0.05, ...) ## S3 method for class 'pred.Freq_HReg' plot(x, plot.est="Haz", xlab=NULL, ylab=NULL, ...) ## S3 method for class 'Freq_HReg' vcov(object, ...)
x |
an object of class |
digits |
a numeric value indicating the number of digits to display. |
object |
an object of class |
time |
the points at which the baseline survival/hazard functions are evaluated. |
tseq |
the points at which tick-marks are to be drawn.
Required only if the object |
plot.est |
used only if |
xlab |
a title for the x axis. |
ylab |
a title for the y axis. |
xnew |
a vector of covariate values with which to predict for which to predict for |
x1new |
a vector of covariate values with which to predict for which to predict for |
x2new |
a vector of covariate values with which to predict for which to predict for |
x3new |
a vector of covariate values with which to predict for which to predict for |
alpha |
confidence/credibility level of the interval. |
... |
additional arguments. |
BayesID_HReg
, BayesID_AFT
, BayesSurv_HReg
, BayesSurv_AFT
, FreqID_HReg
, FreqSurv_HReg
.
Since version 2.5, the functions BayesID(), BayesSurv(), FreqID(), FreqSurv(), initiate.startValues() have been renamed as BayesID_HReg(), BayesSurv_HReg(), FreqID_HReg(), FreqSurv_HReg(), initiate.startValues_HReg(), respectively. If one of the old functions is called, a warning message will be displayed with the corresponding new function name.
BayesID(...) BayesSurv(...) FreqID(...) FreqSurv(...) initiate.startValues(...)
BayesID(...) BayesSurv(...) FreqID(...) FreqSurv(...) initiate.startValues(...)
... |
arguments used for the old functions. |
PPD
is a function to predict the joint probability involving two event times in Bayesian illness-death models.
PPD(fit, x1, x2, x3, t1, t2)
PPD(fit, x1, x2, x3, t1, t2)
fit |
an object of class |
x1 |
a vector of covariates for |
x2 |
a vector of covariates for |
x3 |
a vector of covariates for |
t1 |
time to non-terminal event for which the joint probability is calculated. |
t2 |
time to terminal event for which the joint probability is calculated. |
Using the posterior predictive density, given (,
,
), one can predict any joint probability involving the two event times such as
for
and
for
.
F_u |
Predicted |
F_l |
Predicted |
Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2015),
Bayesian semiparametric analysis of semicompeting risks data:
investigating hospital readmission after a pancreatic cancer diagnosis, Journal of the Royal Statistical Society: Series C, 64, 2, 253-273.
## Not run: # loading a data set data(scrData) id=scrData$cluster form <- Formula(time1 + event1 | time2 + event2 ~ x1 + x2 | x1 + x2 | x1 + x2) ##################### ## Hyperparameters ## ##################### ## Subject-specific frailty variance component ## - prior parameters for 1/theta ## theta.ab <- c(0.7, 0.7) ## PEM baseline hazard function ## PEM.ab1 <- c(0.7, 0.7) # prior parameters for 1/sigma_1^2 PEM.ab2 <- c(0.7, 0.7) # prior parameters for 1/sigma_2^2 PEM.ab3 <- c(0.7, 0.7) # prior parameters for 1/sigma_3^2 ## PEM.alpha1 <- 10 # prior parameters for K1 PEM.alpha2 <- 10 # prior parameters for K2 PEM.alpha3 <- 10 # prior parameters for K3 ## hyperParams <- list(theta=theta.ab, PEM=list(PEM.ab1=PEM.ab1, PEM.ab2=PEM.ab2, PEM.ab3=PEM.ab3, PEM.alpha1=PEM.alpha1, PEM.alpha2=PEM.alpha2, PEM.alpha3=PEM.alpha3)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 2000 thin <- 10 burninPerc <- 0.5 ## Settings for storage ## nGam_save <- 0 ## Tuning parameters for specific updates ## ## - those common to all models mhProp_theta_var <- 0.05 ## ## - those specific to the Weibull specification of the baseline hazard functions mhProp_alphag_var <- c(0.01, 0.01, 0.01) ## ## - those specific to the PEM specification of the baseline hazard functions Cg <- c(0.2, 0.2, 0.2) delPertg <- c(0.5, 0.5, 0.5) rj.scheme <- 1 Kg_max <- c(50, 50, 50) sg_max <- c(max(scrData$time1[scrData$event1 == 1]), max(scrData$time2[scrData$event1 == 0 & scrData$event2 == 1]), max(scrData$time2[scrData$event1 == 1 & scrData$event2 == 1])) time_lambda1 <- seq(1, sg_max[1], 1) time_lambda2 <- seq(1, sg_max[2], 1) time_lambda3 <- seq(1, sg_max[3], 1) ## mcmc.PEM <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save), tuning=list(mhProp_theta_var=mhProp_theta_var, Cg=Cg, delPertg=delPertg, rj.scheme=rj.scheme, Kg_max=Kg_max, time_lambda1=time_lambda1, time_lambda2=time_lambda2, time_lambda3=time_lambda3)) ## myModel <- c("semi-Markov", "PEM") myPath <- "Output/02-Results-PEM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, nChain=2) ## fit_PEM <- BayesID_HReg(form, scrData, id=NULL, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) PPD(fit_PEM, x1=c(1,1), x2=c(1,1), x3=c(1,1), t1=3, t2=6) ## End(Not run)
## Not run: # loading a data set data(scrData) id=scrData$cluster form <- Formula(time1 + event1 | time2 + event2 ~ x1 + x2 | x1 + x2 | x1 + x2) ##################### ## Hyperparameters ## ##################### ## Subject-specific frailty variance component ## - prior parameters for 1/theta ## theta.ab <- c(0.7, 0.7) ## PEM baseline hazard function ## PEM.ab1 <- c(0.7, 0.7) # prior parameters for 1/sigma_1^2 PEM.ab2 <- c(0.7, 0.7) # prior parameters for 1/sigma_2^2 PEM.ab3 <- c(0.7, 0.7) # prior parameters for 1/sigma_3^2 ## PEM.alpha1 <- 10 # prior parameters for K1 PEM.alpha2 <- 10 # prior parameters for K2 PEM.alpha3 <- 10 # prior parameters for K3 ## hyperParams <- list(theta=theta.ab, PEM=list(PEM.ab1=PEM.ab1, PEM.ab2=PEM.ab2, PEM.ab3=PEM.ab3, PEM.alpha1=PEM.alpha1, PEM.alpha2=PEM.alpha2, PEM.alpha3=PEM.alpha3)) ################### ## MCMC SETTINGS ## ################### ## Setting for the overall run ## numReps <- 2000 thin <- 10 burninPerc <- 0.5 ## Settings for storage ## nGam_save <- 0 ## Tuning parameters for specific updates ## ## - those common to all models mhProp_theta_var <- 0.05 ## ## - those specific to the Weibull specification of the baseline hazard functions mhProp_alphag_var <- c(0.01, 0.01, 0.01) ## ## - those specific to the PEM specification of the baseline hazard functions Cg <- c(0.2, 0.2, 0.2) delPertg <- c(0.5, 0.5, 0.5) rj.scheme <- 1 Kg_max <- c(50, 50, 50) sg_max <- c(max(scrData$time1[scrData$event1 == 1]), max(scrData$time2[scrData$event1 == 0 & scrData$event2 == 1]), max(scrData$time2[scrData$event1 == 1 & scrData$event2 == 1])) time_lambda1 <- seq(1, sg_max[1], 1) time_lambda2 <- seq(1, sg_max[2], 1) time_lambda3 <- seq(1, sg_max[3], 1) ## mcmc.PEM <- list(run=list(numReps=numReps, thin=thin, burninPerc=burninPerc), storage=list(nGam_save=nGam_save), tuning=list(mhProp_theta_var=mhProp_theta_var, Cg=Cg, delPertg=delPertg, rj.scheme=rj.scheme, Kg_max=Kg_max, time_lambda1=time_lambda1, time_lambda2=time_lambda2, time_lambda3=time_lambda3)) ## myModel <- c("semi-Markov", "PEM") myPath <- "Output/02-Results-PEM/" startValues <- initiate.startValues_HReg(form, scrData, model=myModel, nChain=2) ## fit_PEM <- BayesID_HReg(form, scrData, id=NULL, model=myModel, hyperParams, startValues, mcmc.PEM, path=myPath) PPD(fit_PEM, x1=c(1,1), x2=c(1,1), x3=c(1,1), t1=3, t2=6) ## End(Not run)
Simulated semi-competing risks data
data(scrData)
data(scrData)
a data frame with 2000 observations on the following 14 variables.
time1
the time to non-terminal event
event1
the censoring indicators for the non-terminal event time; 1=event observed, 0=censored/truncated
time2
the time to terminal event
event2
the censoring indicators for the terminal event time; 1=event observed, 0=censored
cluster
cluster numbers
x1
a vector of continuous covarate
x2
a vector of continuous covarate
x3
a vector of continuous covarate
data(scrData)
data(scrData)
The function to simulate independent/cluster-correlated semi-competing risks data under semi-Markov Weibull/Weibull-MVN models.
simID(id=NULL, x1, x2, x3, beta1.true, beta2.true, beta3.true, alpha1.true, alpha2.true, alpha3.true, kappa1.true, kappa2.true, kappa3.true, theta.true, SigmaV.true=NULL, cens)
simID(id=NULL, x1, x2, x3, beta1.true, beta2.true, beta3.true, alpha1.true, alpha2.true, alpha3.true, kappa1.true, kappa2.true, kappa3.true, theta.true, SigmaV.true=NULL, cens)
id |
a vector of cluster information for |
x1 |
covariate matrix, |
x2 |
covariate matrix, |
x3 |
covariate matrix, |
beta1.true |
true value for |
beta2.true |
true value for |
beta3.true |
true value for |
alpha1.true |
true value for |
alpha2.true |
true value for |
alpha3.true |
true value for |
kappa1.true |
true value for |
kappa2.true |
true value for |
kappa3.true |
true value for |
theta.true |
true value for |
SigmaV.true |
true value for |
cens |
a vector with two numeric elements. The right censoring times are generated from Uniform( |
simIDcor
returns a data.frame containing semi-competing risks outcomes from n
subjects.
It is of dimension : the columns correspond to
,
,
,
.
y1 |
a vector of |
y2 |
a vector of |
delta1 |
a vector of |
delta2 |
a vector of |
Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
library(MASS) set.seed(123456) J = 110 nj = 50 n = J * nj id <- rep(1:J, each = nj) kappa1.true <- 0.05 kappa2.true <- 0.01 kappa3.true <- 0.01 alpha1.true <- 0.8 alpha2.true <- 1.1 alpha3.true <- 0.9 beta1.true <- c(0.5, 0.8, -0.5) beta2.true <- c(0.5, 0.8, -0.5) beta3.true <- c(1, 1, -1) SigmaV.true <- matrix(0.25,3,3) theta.true <- 0.5 cens <- c(90, 90) cov1 <- matrix(rnorm((length(beta1.true)-1)*n, 0, 1), n, length(beta1.true)-1) cov2 <- sample(c(0, 1), n, replace = TRUE) x1 <- as.data.frame(cbind(cov1, cov2)) x2 <- as.data.frame(cbind(cov1, cov2)) x3 <- as.data.frame(cbind(cov1, cov2)) simData <- simID(id, x1, x2, x3, beta1.true, beta2.true, beta3.true, alpha1.true, alpha2.true, alpha3.true, kappa1.true, kappa2.true, kappa3.true, theta.true, SigmaV.true, cens)
library(MASS) set.seed(123456) J = 110 nj = 50 n = J * nj id <- rep(1:J, each = nj) kappa1.true <- 0.05 kappa2.true <- 0.01 kappa3.true <- 0.01 alpha1.true <- 0.8 alpha2.true <- 1.1 alpha3.true <- 0.9 beta1.true <- c(0.5, 0.8, -0.5) beta2.true <- c(0.5, 0.8, -0.5) beta3.true <- c(1, 1, -1) SigmaV.true <- matrix(0.25,3,3) theta.true <- 0.5 cens <- c(90, 90) cov1 <- matrix(rnorm((length(beta1.true)-1)*n, 0, 1), n, length(beta1.true)-1) cov2 <- sample(c(0, 1), n, replace = TRUE) x1 <- as.data.frame(cbind(cov1, cov2)) x2 <- as.data.frame(cbind(cov1, cov2)) x3 <- as.data.frame(cbind(cov1, cov2)) simData <- simID(id, x1, x2, x3, beta1.true, beta2.true, beta3.true, alpha1.true, alpha2.true, alpha3.true, kappa1.true, kappa2.true, kappa3.true, theta.true, SigmaV.true, cens)
The function to simulate independent/cluster-correlated right-censored survival data under Weibull/Weibull-Normal model.
simSurv(id=NULL, x, beta.true, alpha.true, kappa.true, sigmaV.true=NULL, cens)
simSurv(id=NULL, x, beta.true, alpha.true, kappa.true, sigmaV.true=NULL, cens)
id |
a vector of cluster information for |
x |
covariate matrix, |
beta.true |
true value for |
alpha.true |
true value for |
kappa.true |
true value for |
sigmaV.true |
true value for |
cens |
a vector with two numeric elements. The right censoring times are generated from Uniform( |
simSurv
returns a data.frame containing univariate time-to-event outcomes from n
subjects.
It is of dimension : the columns correspond to
,
.
y |
a vector of |
delta |
a vector of |
Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>
set.seed(123456) J = 110 nj = 50 n = J * nj id <- rep(1:J, each = nj) x = matrix(0, n, 2) x[,1] = rnorm(n, 0, 2) x[,2] = sample(c(0, 1), n, replace = TRUE) beta.true = c(0.5, 0.5) alpha.true = 1.5 kappa.true = 0.02 sigmaV.true = 0.1 cens <- c(30, 40) simData <- simSurv(id, x, beta.true, alpha.true, kappa.true, sigmaV.true, cens)
set.seed(123456) J = 110 nj = 50 n = J * nj id <- rep(1:J, each = nj) x = matrix(0, n, 2) x[,1] = rnorm(n, 0, 2) x[,2] = sample(c(0, 1), n, replace = TRUE) beta.true = c(0.5, 0.5) alpha.true = 1.5 kappa.true = 0.02 sigmaV.true = 0.1 cens <- c(30, 40) simData <- simSurv(id, x, beta.true, alpha.true, kappa.true, sigmaV.true, cens)
Simulated univariate survival data.
data(survData)
data(survData)
a data frame with 2000 observations on the following 4 variables.
time
the time to event
event
the censoring indicators for the event time; 1=event observed, 0=censored
cluster
cluster numbers
cov1
the first column of covariate matrix x
cov2
the second column of covariate matrix x
data(scrData)
data(scrData)