Learn R Programming

bayesSurv (version 0.1)

bayessurvreg1: A Bayesian survival regression with a flexible error distribution.

Description

A function to sample from the posterior distribution for a survival regression model $$\log(T_{i,l}) = \beta^T x_{i,l} + b_i^T z_{i,l} + \varepsilon_{i,l},\quad i=1,\dots,N,\ l=1,\dots,n_i,$$ where distribution of $\varepsilon_{i,l}$ is specified as a normal mixture with unknown number of components and random effect $b_i$ is normally distributed.

See included paper (/inst/doc directory of this library) for more detailed description of prior assumptions. Sampled values are stored on a disk to be further worked out by e.g. coda or boa.

Usage

bayessurvreg1(
     formula,
     random,
     data = parent.frame(),
     subset,
     na.action = na.fail,
     x = FALSE,
     y = FALSE,                          
     onlyX = FALSE,
     nsimul = list(niter = 10, nthin = 1, nburn = 0, nnoadapt = 0, nwrite = 10),
     prior = list(kmax = 5, k.prior = "poisson", poisson.k = 3,
                  dirichlet.w = 1,
                  mean.mu = NULL, var.mu = NULL,
                  shape.invsig2 = 1.5,
                  shape.hyper.invsig2 = 0.8, rate.hyper.invsig2 = NULL,
                  pi.split = NULL, pi.birth = NULL,
                  Eb0.depend.mix = FALSE),
     prior.beta,
     prior.b,
     prop.revjump,
     init = list(iter = 0, mixture = NULL, beta = NULL, b = NULL, D = NULL,
                 y = NULL, r = NULL, otherp = NULL, u = NULL),
     store = list(y = TRUE, r = TRUE, b = TRUE, u = TRUE,
                  MHb = FALSE, regresres = FALSE),
     dir = getwd(),
     toler.chol = 1e-10,
     toler.qr = 1e-10,
     ...)

Arguments

formula
model formula for the `fixed' part of the model, i.e. the part that specifies $\beta^T x_{i,l}$. See survreg for further details. Intercept is implicitely included in the model by estima
random
formula for the `random' part of the model, i.e. the part that specifies $b_i^T z_{i,l}$. If omitted, no random part is included in the model. E.g. to specify the model with a random intercept, say random=~1. All effects mentioned
data
optional data frame in which to interpret the variables occuring in the formulas.
subset
subset of the observations to be used in the fit.
na.action
function to be used to handle any NAs in the data. The user is discouraged to change a default value na.fail.
x
if TRUE then the X matrix is returned. This matrix contain all columns appearing in both formula and random parameters.
y
if TRUE then the y matrix (of log-survival times) is returned.
onlyX
if TRUE, no McMC is performed. The function returns only a design matrix of your model (intercept excluded). It might be useful to set up correctly a parameter for a block update of $\beta$ (regression parameters related to the fixed effec
nsimul
a list giving the number of iterations of the McMC and other parameters of the simulation. [object Object],[object Object],[object Object],[object Object],[object Object]
prior
a list that identifies prior hyperparameters and prior choices. See accompanying paper for more details. Some prior parameters can be guessed by the function itself. If you want to do so, set such parameters to NULL. Set to
prior.beta
a list defining the blocks of $\beta$ parameters (both fixed effects and means of random effects, except the random intercept) that are to be updated together (in a block), a description of how they are updated and a specification of priors.
prior.b
a list defining the way in which the random effects are to be updated and the specification of priors for random effects related parameters. The list is assumed to have following components. [object Object],[object Object],[object Object],[obj
prop.revjump
a list of values defining in which way the reversible jumps will be performed. [object Object],[object Object],[object Object],[object Object],[object Object]
init
a list of the initial values to start the McMC. Set to NULL such parameters that you want the program should itself sample for you or parameters that are not needed in your model. [object Object],[object Object],[object Object],[o
store
a list that defines which sampled values besides regression parameters $\beta$, means of random effects $\gamma$ (both stored in a file called beta.sim), a covariance matrix of random effects $D$ (stored in a file D.sim<
dir
a string that specifies a directory where all sampled values are to be stored.
toler.chol
tolerance for the Cholesky decomposition.
toler.qr
tolerance for the QR decomposition.
...
who knows?

Value

  • A list of class bayessurvreg containing an information concerning the initial values and prior choices.

References

$\mbox{Kom\'arek}$, A., Lesaffre, E. (2004). Bayesian Accelerated Failure Time Model for Correlated Censored Data with a Normal Mixture as an Error Distribution. In preparation, see /doc/KomarekLesaffre2004.pdf in this R package. Brooks, S. P., Giudici, P., and Roberts, G. O. (2003). Efficient construction of reversible jump Markov chain Monte Carlo proposal distribution (with Discussion). Journal of the Royal Statistical Society B, 65, 3 - 55.

Green, P. J. (1995). Reversible jump MCMC computation and Bayesian model determination. Biometrika, 82, 711-732.

Richardson, S., and Green, P. J. (1997). On Bayesian analysis of mixtures with unknown number of components (with Discussion). Journal of the Royal Statistical Society B, 59, 731 - 792.

Examples

Run this code
## There are two vignettes with this package that describe analyses presented
  ## in Komarek and Lesaffre (2004). You should find them in /doc directory
  ## of this library (cgd1.Rnw, tandmob.Rnw are sources to create the vignettes).
  
  ## I hope they give enough material to understand how the package works.

Run the code above in your browser using DataLab