# Package `bayesSurv`

This package implements several random effects accelerated failure time models (AFT) for right-, left-, interval-, and doubly-interval censored data fitted using Markov chain Monte Carlo (MCMC) methodology. Models can be divided into four methodological groups which are described below. Additional information can also be found at personal webpage of Arnošt Komárek.

The following models are used to model the distributional parts in the AFT model

- Normal distribution
- Classical normal mixture which is a normal mixture with estimated number of components, estimated means and variances of these components and estimated weights of these components
- Penalized Gaussian mixture (PGM) also called as G-spline. This is a normal mixture with a higher number of homoscedastic components, specified over a fixed grid of equidistant knots - means. Only the weight of the mixture are estimated and roughness penalty is imposed on weights in the estimation procedure.

# 1. AFT with a classical normal mixture as an error distribution and normal random effects

Methodology has been published in

- KOMÁREK, A. and LESAFFRE, E. (2007). Bayesian accelerated failure time model for correlated censored data with a normal mixture as an error distribution. Statistica Sinica, 17 (2), 549–569.

### Main functions from the package related to this methodology

- bayessurvreg1
- predictive
- bayesDensity

### Secondary functions from the package related to this methodology

- bayessurvreg1.files2init
- files2coda

### Examples

- `ex-tandmobMixture.pdf` - example 1 using the data set tandmob2
- `ex-tandmobMixture.R` - code for the example 1
- `ex-cgd.pdf` - example 2 using the data set cgd
- `ex-cgd.R` - code for the example 2

# 2. AFT with a penalized Gaussian mixture as an error distribution and normal random effects

Methodology has been published in

- KOMÁREK, A., LESAFFRE, E. and LEGRAND, C. (2007). Baseline and treatment effect heterogeneity in disease free survival between centers using a random effects accelerated failure time model with flexible error distribution. Statistics in Medicine, 26 (30), 5457–5472.

### Main functions from the package related to this methodology

- bayessurvreg2
- predictive2
- bayesGspline

### Secondary functions from the package related to this methodology

- bayesHistogram
- vecr2matr

### Examples

- `ex-eortc.pdf` - example 3 using the data set from EORTC trial 10854 (unpublic)

# 3. AFT with a penalized Gaussian mixture as an error distribution and random effects whose distribution is a penalized Gaussian mixture

Methodology has been published in

- KOMÁREK, A. and LESAFFRE, E. (2008). Bayesian accelerated failure time model with multivariate doubly-interval-censored data and flexible distributional assumptions. Journal of the American Statistical Association, 103 (482), 523–533.

### Main functions from the package related to this methodology

- bayessurvreg3
- predictive2
- bayesGspline

### Secondary functions from the package related to this methodology

- bayesHistogram
- vecr2matr

### Examples

- `ex-tandmobCS.pdf` - example 4 using the data set tandmobRoos
- `ex-tandmobCS.R` - code for the example 4

# 4. AFT model for paired data with a bivariate penalized Gaussian mixture as an error distribution

Methodology has been published in

- KOMÁREK, A. and LESAFFRE, E. (2006). Bayesian semiparametric accelerated failure time model for paired doubly-interval-censored data. Statistical Modelling. 6 (1), 3–22.

### Main functions from the package related to this methodology

- bayessurvreg3
- predictive2
- bayesGspline

### Secondary functions from the package related to this methodology

- bayesHistogram
- vecr2matr

### Examples

- `ex-tandmobPA.pdf` - example 5 using the data set tandmobRoos
- `ex-tandmobPA.R` - code for the example 5