# BayesSurv_AFT: The function to implement Bayesian parametric and... In SemiCompRisks: Hierarchical Models for Parametric and Semi-Parametric Analyses of Semi-Competing Risks Data

## Description

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.

## Usage

 ```1 2``` ```BayesSurv_AFT(Formula, data, model = "LN", hyperParams, startValues, mcmcParams, na.action = "na.fail", subset=NULL, path=NULL) ```

## Arguments

 `Formula` a `Formula` object of the form L | y_{L}+y_{U} ~ x. See Details and Examples below. `data` a data.frame in which to interpret the variables named in `Formula`. `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, `LN` (a list containing numeric vectors for log-Normal hyperparameters: `LN.ab`), `DPM` (a list containing numeric vectors for DPM hyperparameters: `DPM.mu`, `DPM.sigSq`, `DPM.ab`, `Tau.ab`). See Details and Examples below. `startValues` a list containing vectors of starting values for model parameters. It can be specified as the object returned by the function `initiate.startValues_AFT`. `mcmcParams` a list containing variables required for MCMC sampling. Components include, `run` (a list containing numeric values for setting for the overall run: `numReps`, total number of scans; `thin`, extent of thinning; `burninPerc`, the proportion of burn-in). `tuning` (a list containing numeric values relevant to tuning parameters for specific updates in Metropolis-Hastings (MH) algorithm: `beta.prop.var`, the variance of proposal density for β; `mu.prop.var`, the variance of proposal density for μ; `zeta.prop.var`, the variance of proposal density for 1/σ^2). `na.action` how NAs are treated. See `model.frame`. `subset` a specification of the rows to be used: defaults to all rows. See `model.frame`. `path` the name of directory where the results are saved.

## Details

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 x_i to survival time T_i for the i^{\textrm{th}} subject:

\log(T_i) = x_i^{\top}β + ε_i,

where ε_i is a random variable whose distribution determines that of T_i and β is a vector of regression parameters. Considering the interval censoring, the time to the event for the i^{\textrm{th}} subject satisfies c_{ij}≤q T_i <c_{ij+1}. Let L_i denote the left-truncation time. For the Bayesian parametric analysis, we take ε_i to follow the Normal(μ, σ^2) distribution for ε_i. The following prior distributions are adopted for the model parameters:

π(β, μ) \propto 1,

σ^2 \sim \textrm{Inverse-Gamma}(a_{σ}, b_{σ}).

For the Bayesian semi-parametric analysis, we assume that ε_i is taken as draws from the DPM of normal distributions:

ε\sim DPM(G_0, τ).

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(a_{τ}, b_{τ}) hyperprior for the precision parameter τ.

## Value

`BayesSurv_AFT` returns an object of class `Bayes_AFT`.

## Author(s)

Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <[email protected]>

## References

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. (2018+), SemiCompRisks: an R package for independent and cluster-correlated analyses of semi-competing risks data, submitted, arXiv:1801.03567.

`initiate.startValues_AFT`, `print.Bayes_AFT`, `summary.Bayes_AFT`, `predict.Bayes_AFT`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97``` ```## 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) ```