bayesmixsurv {BayesMixSurv}R Documentation

Dynamic Bayesian survival model - with stratification and Lasso shrinkage - for right-censored data using two-component additive mixture-of-Weibull hazards.

Description

Bayesian survival model for right-censored data, using a sum of two hazard functions, each having a power dependence on time, corresponding to a Weibull distribution on event density. (Note that event density function for the mixture model does NOT remain a Weibull distribution.) Each component has a different shape and scale parameter, with scale parameters each being the exponential of a linear function of covariates specified in formula1 and formula2. Stratification is implemented using a common set of intercepts between the two components. Lasso shrinkage - using Laplace prior on coefficients (Park and Casella 2008) - allows for variable selection in the presence of low observation-to-variable ratio. The mixture model allows for time-dependent (and context-dependent) hazard ratios. Confidence intervals for coefficient estimation and prediction are generated using full Bayesian paradigm, i.e. by keeping all samples rather than summarizing them into mean and sd. Posterior distribution is estimated via MCMC sampling, using univariate slice sampler with stepout and shrinkage (Neal 2003).

Usage

bayesmixsurv(formula1, data, formula2=formula1, stratCol=NULL, weights, subset
  , na.action=na.fail, control=bayesmixsurv.control(), print.level=2)
bayesmixsurv.control(single=FALSE, alpha2.fixed=NULL, alpha.boundary=1.0, lambda1=1.0
  , lambda2=lambda1, iter=1000, burnin=round(iter/2), sd.thresh=1e-4, scalex=TRUE
  , nskip=round(iter/10))
## S3 method for class 'bayesmixsurv'
print(x, ...)

Arguments

formula1

Survival formula expressing the time/status variables as well as covariates used in the first component.

data

Data frame containing the covariates and response variable, as well as the stratification column.

formula2

Survival formula expressing the covariates used in the second component. No left-hand side is necessary since the response variable information is extracted from formula1. Defaults to formula1.

stratCol

Name of column in data used for stratification. Must be a factor or coerced into one. Default is no stratification (stratCol=NULL).

weights

Optional vector of case weights. *Not supported yet*

subset

Subset of the observations to be used in the fit. *Not supported yet*

na.action

Missing-data filter function. *Not supported yet (only na.fail behavior works)*

control

See bayesmixsurv.control for a description of the parameters inside the control list.

print.level

Controlling verbosity level.

single

If TRUE, a single-component model, equivalent to Bayesian Weibull survival regression, with Lasso shrinkage, is implemented. Default is FALSE, i.e. a two-component mixture-of-Weibull model.

alpha2.fixed

If provided, it specifies the shape parameter of the second component. Default is NULL, which allows the MCMC sampling to estimate both shape parameters.

alpha.boundary

When single=FALSE and alpha2.fixed=NULL, this parameter specifies an upper bound for the shape parameter of the first component, and a lower bound for the shape parameter of the second component. These boundary conditions are enforced in the univariate slice sampler function calls.

lambda1

Lasso Shrinkage parameter used in the Laplace prior on covariates used in the first component.

lambda2

Lasso Shrinkage parameter used in the Laplace prior on covariates used in the second component. Defaults to lambda1.

iter

Number of posterior MCMC samples to generate.

burnin

Number of initial MCMC samples to discard before calculating summary statistics.

sd.thresh

Threshold for standard deviation of a covariate (after possible centering/scaling). If below the threshold, the corresponding coefficient is removed from sampling, i.e. its value is clamped to zero.

scalex

If TRUE, each covariate vector is centered and scaled before model estimation. The scaling parameters are saved in return object, and used in subsequent calls to predict function. Users are strongly advised against turning this feature off, since the quality of Gibbs sampling MCMC is greatly enhanced by covariate centering and scaling.

nskip

Controlling how often to print progress report during MCMC run. For example, if nskip=10, progress will be reported after 10,20,30,... samples.

x

Object of class 'bayesmixsurv', usually the result of a call to bayesmixsurv.

...

Arguments to be passed to/from other methods.

Value

The function bayesmixsurv.control return a list with the same elements as its input parameters. The function bayesmixsurv returns object of class bayesmixsurv, with the following components:

call

The matched call

formula1

Same as input.

formula2

Same as input.

weights

Same as input. *Not supported yet*

subset

Same as input. *Not supported yet*

na.action

Same as input. *Not supported yet* (current behavior is na.fail)

control

Same as input.

X1

Model matrix used for component 1, after potential centering and scaling.

X2

Model matrix used for component 2, after potential centering and scaling.

y

Survival response variable (time and status) used in the model.

contrasts1

The contrasts used for component 1 (where relevant).

contrasts2

The contrasts used for component 2 (where relevant).

xlevels1

A record of the levels of the factors used in fitting for component 1 (where relevant).

xlevels2

A record of the levels of the factors used in fitting for component 2 (where relevant).

terms1

The terms object used for component 1.

terms2

The terms object used for component 2.

colnamesX1

Names of columns for X1, also names of scale coefficients for component 1.

colnamesX2

Names of columns for X1, also names of scale coefficients for component 2.

apply.scale.X1

Index of columns of X1 where scaling has been applied.

apply.scale.X2

Index of columns of X2 where scaling has been applied.

centerVec.X1

Vector of centering parameters for columns of X1 indicated by apply.scale.X1.

centerVec.X2

Vector of centering parameters for columns of X2 indicated by apply.scale.X2.

scaleVec.X1

Vector of scaling parameters for columns of X1 indicated by apply.scale.X1.

scaleVec.X2

Vector of scaling parameters for columns of X2 indicated by apply.scale.X2.

Xg

Model matrix associated with stratification (if any).

stratContrasts

The contrasts used for stratification model matrix, if any.

stratXlevels

A record of the levels of the factors used in stratification (if any)).

stratTerms

The terms object used for stratification.

colnamesXg

Names of columns for Xg.

idx1

Vector of indexes into X1 for which sampling occured. All columns of X1 whose standard deviation falls below sd.thresh are excluded from sampling and their corresponding coefficients are clamped to 0.

idx2

Vector of indexes into X2 for which sampling occured. All columns of X2 whose standard deviation falls below sd.thresh are excluded from sampling and their corresponding coefficients are clamped to 0.

median

List of median values, with elements including alpha1,alpha2 (shape parameter of components 1 and 2), beta1,beta2 (coefficients of scale parameter for components 1 and 2), gamma (stratification intercept adjustments, shared by 2 comoponents), and sigma.gamma (standard deviation of zero-mean Gaussian distribution that is the prior for gamma's).

max

Currently, a list with one element, loglike, containing the maximum sampled log-likelihood of the model.

smp

List of coefficient samples, with elements alpha1,alpha2 (shape parameters for components 1 and 2), beta1,beta2 (scale parameter coefficients for components 1 and 2), loglike (model log-likelihood), gamma (stratification intercept adjustments, shared by 2 comoponents), and sigma.gamma (standard deviation of zero-mean Gaussian distribution that is the prior for gamma's). Each parameter has iter samples. For vector parameters, first dimension is the number of samples (iter), while the second dimension is the length of the vector.

Author(s)

Alireza S. Mahani, Mansour T.A. Sharabiani

References

Neal R.M. (2003). Slice Sampling. Annals of Statistics, 31, 705-767.

Park T. and Casella G. (2008) The Bayesian Lasso. Journal of the American Statistical Association, 103, 681-686.

Examples

# NOTE: to ensure convergence, typically more than 100 samples are needed
# fit the most general model, with two Weibull components and unspecified shape parameters
ret <- bayesmixsurv(Surv(time, status)~as.factor(trt)+age+as.factor(celltype)+prior, veteran
  , control=bayesmixsurv.control(iter=100))
# fix one of the two shape parameters
ret2 <- bayesmixsurv(Surv(time, status)~as.factor(trt)+age+as.factor(celltype)+prior, veteran
    , control=bayesmixsurv.control(iter=100, alpha2.fixed=1.0))

[Package BayesMixSurv version 0.9.1 Index]