predictive2 {bayesSurv}  R Documentation 
Compute predictive quantities based on a Bayesian survival regression model fitted using bayesBisurvreg or bayessurvreg2 or bayessurvreg3 functions.
Description
This function computes predictive densities, survivor and hazard curves for specified combinations of covariates.
Firstly, either the function bayesBisurvreg
or the
function bayessurvreg2
or the function bayessurvreg3
has to be used to obtain a sample from the posterior distribution of unknown quantities.
Function predictive2.control
serves only to perform some input
checks inside the main function predictive2
.
Usage
predictive2(formula, random, obs.dim, time0, data = parent.frame(),
grid, na.action = na.fail, Gspline,
quantile = c(0, 0.025, 0.5, 0.975, 1),
skip = 0, by = 1, last.iter, nwrite,
only.aver = TRUE,
predict = list(density=FALSE, Surv=TRUE,
hazard=FALSE, cum.hazard=FALSE),
dir, extens = "", extens.random="_b", version=0)
predictive2Para(formula, random, obs.dim, time0, data = parent.frame(),
grid, na.action = na.fail, Gspline,
quantile = c(0, 0.025, 0.5, 0.975, 1),
skip = 0, by = 1, last.iter, nwrite,
only.aver = TRUE,
predict = list(density=FALSE, Surv=TRUE,
hazard=FALSE, cum.hazard=FALSE),
dir, extens = "", extens.random="_b", version=0)
predictive2.control(predict, only.aver, quantile, obs.dim,
time0, Gspline, n)
Arguments
formula 
the same formula as that one used to sample from the
posterior distribution of unknown quantities by the function
REMARK: the prediction must be asked for at least two combinations of covariates. This is the restriction imposed by one of the internal functions I use.  
random 
the same  
obs.dim 
a vector that has to be supplied if bivariate data were
used for estimation (using the function
 
time0 
a~vector of length  
data 
optional data frame in which to interpret the variables
occuring in the formulas. Usually, you create a new
 
grid 
a~vector giving the grid of values where predictive
quantities are to be evaluated. The grid should normally start at some
value slightly higher than  
na.action 
function to be used to handle any  
Gspline 
a~list specifying the Gspline used for the error distribution in the model. It is a~list with the following components:
 
quantile 
a vector of quantiles that are to be computed for each predictive quantity.  
skip 
number of rows that should be skipped at the beginning of each *.sim file with the stored sample.  
by 
additional thinning of the sample.  
last.iter 
index of the last row from *.sim files that should be
used. If not specified than it is set to the maximum available
determined according to the file  
nwrite 
frequency with which is the user informed about the
progress of computation (every  
only.aver 
if The word of warning: with  
predict 
a list of logical values indicating which predictive quantities are to be computed. Components of the list:
 
dir 
directory where to search for files (‘mixmoment.sim’, ‘mweight.sim’, mmean.sim', gspline.sim', 'beta.sim', 'D.sim', ...) with the McMC sample.  
extens 
an extension used to distinguish different sampled Gsplines if more formulas were used in one MCMC simulation (e.g. with doublycensored data).
 
extens.random 
only applicable if the function
This is an extension used to distinguish different sampled Gsplines determining the distribution of the random intercept (under the presence of doublycensored data).
 
version 
this argument indicates by which
 
n 
number of covariate combinations for which the prediction will be performed. 
Value
A list with possibly the following components (what is included depends
on the value of the arguments predict
and only.aver
):
grid 
a~vector with the grid values at which the survivor function, survivor density, hazard and cumulative hazard are computed. 
Surv 
predictive survivor functions. A~matrix with as many columns as length(grid) and as many rows as the number of covariate combinations for which the predictive quantities were asked. One row per covariate combination. 
density 
predictive survivor densities. The same structure as 
hazard 
predictive hazard functions. The same structure as 
cum.hazard 
predictive cumulative hazard functions. The same structure as 
quant.Surv 
pointwise quantiles for the predictive survivor functions. This is a list with as many components as the number of covariate combinations. One component per covariate combination. Each component of this list is a~matrix with as many columns as
length(grid) and as many rows as the length of the argument

quant.density 
pointwise quantiles for the predictive survivor densities. The same structure as 
quant.hazard 
pointwise quantiles for the predictive hazard functions. The same structure as 
quant.cum.hazard 
pointwise quantiles for the predictive cumulative hazard functions. The same structure as 
Author(s)
Arnošt Komárek arnost.komarek@mff.cuni.cz
References
Komárek, A. (2006). Accelerated Failure Time Models for Multivariate IntervalCensored Data with Flexible Distributional Assumptions. PhD. Thesis, Katholieke Universiteit Leuven, Faculteit Wetenschappen.
Komárek, A. and Lesaffre, E. (2008). Bayesian accelerated failure time model with multivariate doublyintervalcensored data and flexible distributional assumptions. Journal of the American Statistical Association, 103, 523  533.
Komárek, A. and Lesaffre, E. (2006). Bayesian semiparametric accelerated failurew time model for paired doubly intervalcensored data. Statistical Modelling, 6, 3  22.
Komárek, A., Lesaffre, E., and Legrand, C. (2007). Baseline and treatment effect heterogeneity for survival times between centers using a random effects accelerated failure time model with flexible error distribution. Statistics in Medicine, 26, 5457  5472.
Examples
## See the description of R commands for
## the models described in
## Komarek (2006),
## Komarek and Lesaffre (2006),
## Komarek and Lesaffre (2008),
## Komarek, Lesaffre, and Legrand (2007).
##
## R commands available in the documentation
## directory of this package
##  extandmobPA.R and
## https://www2.karlin.mff.cuni.cz/~komarek/software/bayesSurv/extandmobPA.pdf
##  extandmobCS.R and
## https://www2.karlin.mff.cuni.cz/~komarek/software/bayesSurv/extandmobCS.pdf
##  exeortc.R and
## https://www2.karlin.mff.cuni.cz/~komarek/software/bayesSurv/exeortc.pdf