| bsgw {BSGW} | R Documentation | 
Bayesian Survival using Generalized Weibull Regression
Description
Bayesian survival model - with stratification and shrinkage - using Weibull regression on both scale and shape parameters, resulting in time-dependent (i.e. dynamic) hazard ratios.
Usage
bsgw(formula, data, formulas=formula, weights, subset, na.action=na.fail, init="survreg"
  , ordweib=FALSE, scale=0, control=bsgw.control(), print.level=2)
bsgw.control(scalex=TRUE, iter=1000, burnin=round(iter/2), sd.thresh=1e-4
  , lambda=0.0, lambdas=lambda, nskip=round(iter/10), alpha.min=0.1, alpha.max=10.0
  , beta.max=log(20), betas.max=5.0, memlim.gb=8)
## S3 method for class 'bsgw'
print(x, ...)
Arguments
| formula | Survival formula expressing the time/status variables as well as covariates used in regression on scale parameter. Currently, only right and left censoring is supported. Must include intercept term. | 
| data | Data frame containing the covariates and response variable. | 
| formulas | Formula expressing the covariates used in regression on shape parameter. No left-hand side is necessary since the response variable information is extracted from  | 
| 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)* | 
| init | Initialization behavior. Currently, three options are supported: 1) If  | 
| ordweib | If  | 
| scale | If  | 
| control | See  | 
| print.level | Controlling verbosity level. | 
| scalex | If  | 
| iter | Number of MCMC samples to draw. | 
| 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. | 
| lambda | Bayesian Lasso shrinkage parameter for scale-parameter coefficients. | 
| lambdas | Bayesian Lasso shrinkage parameter for shape-parameter coefficients. | 
| nskip | Controlling how often to print progress report during MCMC run. For example, if  | 
| alpha.min | Lower bound on the shape parameter. | 
| alpha.max | Upper bound on the shape parameter. | 
| beta.max | Upper bound on absolute value of coefficients of scale parameter (with the exception of the intercept). | 
| betas.max | Upper bound on absolute value of coefficients of shape parameter (with the exception of the intercept). | 
| memlim.gb | User-specified limit on total memory (in GB) available during prediction. Hazard, cumulative hazard, and survival prediction objects are all three-dimensional arrays which can quickly grow very large, depending on data length, number of MCMC samples collected, and number of time points along which prediction is made. | 
| x | Object of class 'bsgw', usually the result of a call to the  | 
| ... | Arguments to be passed to/from other methods. | 
Value
The function bsgw.control returns a list with elements identical to the input parameters. The function bsgw returns an object of class bsgw, with the following components:
| call | The matched call. | 
| formula | Same as input. | 
| formulas | 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  | 
| init | Initial values for scale and shape coefficients used in MCMC sampling, either by performing an ordinary Weibull regression or by extracting estimated coefficients from a previously-performed such regression. | 
| ordweib | Same as input. | 
| survreg.scale.ref | Value of scale parameter, estimated using ordinary Weibull regression by calling the  | 
| ordreg | The  | 
| scale | Same as input. | 
| control | Same as input. | 
| X | Model matrix used for regression on scale parameter, after potential centering and scaling. The corresponding vector of coefficients is called  | 
| Xs | Model matrix used for regression on shape parameter, after potential centering and scaling. The corresponding vector of coefficients is called  | 
| y | Survival response variable (time and status) used in the model. | 
| contrasts | The contrasts used for scale-parameter coefficients. | 
| contrastss | The contrasts used for shape-parameter coefficients. | 
| xlevels | A record of the levels of the factors used in fitting for scale parameter regression. | 
| xlevelss | A record of the levels of the factors used in fitting for shape parameter regression. | 
| terms | The terms object used for scale parameter regression. | 
| termss | The terms object used for shape parameter regression. | 
| colnamesX | Names of columns for  | 
| colnamesXs | Names of columns for  | 
| apply.scale.X | Index of columns of  | 
| apply.scale.Xs | Index of columns of  | 
| centerVec.X | Vector of centering parameters for columns of  | 
| scaleVec.X | Vector of scaling parameters for columns of  | 
| centerVec.Xs | Vector of centering parameters for columns of  | 
| scaleVec.Xs | Vector of scaling parameters for columns of  | 
| idx | Vector of indexes into  | 
| idxs | Vector of indexes into  | 
| median | List of median values, with elements including  | 
| smp | List of coefficient samples, with the following elements: 1)  | 
| km.fit | Kaplan-Meyer fit to training data. Used in plot.bsgw method. | 
| tmax | Maximum time value in training set. Used in predict.bsgw for automatic selection of the  | 
Author(s)
Alireza S. Mahani, Mansour T.A. Sharabiani
References
Mazucheli J., Louzada-Neto F. and Achnar J.A. (2002). Lifetime models with nonconstant shape parameters. Confiabilidade. III Jornada Regional de Estatistica e II Semana da Estatistica, Maringa.
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.
See Also
For calculating median and lower/upper bounds on coefficients, use summary.bsgw.
For prediction, use predict.bsgw.
Examples
## model estimation using 800 samples, printing progress every 100 samples
library("survival")
data(ovarian)
est <- bsgw(Surv(futime, fustat) ~ ecog.ps + rx, ovarian
            , control=bsgw.control(iter=400, nskip=100))
## comparing shape of Weibull curves between ordinary Weibull and bsgw
## since in bsgw shape is dependent on covariates, only a population average is meaningful
## Note that survreg-style scale is inverse of bsgw shape parameter, see survreg help page
west <- survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian)
cat("constant survreg-style scale parameter:", west$scale, "\n")
cat("population average of survreg-style scale parameter from bsgw model:"
  , mean(est$median$survreg.scale), "\n")