predictive {bayesSurv} | R Documentation |
Compute predictive quantities based on a Bayesian survival regression model fitted using bayessurvreg1 function.
Description
This function runs additional McMC to compute predictive survivor and hazard curves and predictive event times for specified values of covariates.
Firstly, the function bayessurvreg1
has to be used to
obtain a sample from the posterior distribution of unknown quantities.
Directly, posterior predictive quantiles and means of asked quantities are computed and stored in files.
Function predictive.control
serves only to perform some input
checks inside the main function predictive
.
Usage
predictive(formula, random, time0 = 0, data = parent.frame(),
grid, type = "mixture", subset, na.action = na.fail,
quantile = c(0, 0.025, 0.5, 0.975, 1),
skip = 0, by = 1, last.iter, nwrite, only.aver = FALSE,
predict = list(Et=TRUE, t=FALSE, Surv=TRUE, hazard=FALSE, cum.hazard=FALSE),
store = list(Et=TRUE, t = FALSE, Surv = FALSE, hazard = FALSE, cum.hazard=FALSE),
Eb0.depend.mix = FALSE,
dir, toler.chol = 1e-10, toler.qr = 1e-10)
predictive.control(predict, store, only.aver, quantile)
Arguments
formula |
the same formula as that one used to sample from the
posterior distribution of unknown quantities by the function
|
random |
the same |
time0 |
starting time for the survival model. This option is used
to get correct hazard function in the case that the original model was
|
data |
optional data frame in which to interpret the variables
occuring in the formulas. Usually, you create a new
|
grid |
a list of length as number of observations in |
type |
a character string giving the type of assumed error distribution. Currently, valid are substrings of "mixture". In the future, "spline", "polya.tree" might be also implemented. |
subset |
subset of the observations from the |
na.action |
function to be used to handle any |
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 |
predict |
a list of logical values indicating which predictive quantities are to be sampled. Components of the list:
|
store |
a list of logical values indicating which predictive quantities are to be stored in files as ‘predET*.sim’, ‘predT*.sim’, ‘predS*.sim’, ‘predhazard*.sim’, ‘predcumhazard*.sim’. If you are interested only in posterior means or quantiles of the predictive quantities you do not have to store sampled values. Posterior means and quantiles are stored in files ‘quantET*.sim’, ‘quantT*.sim’, ‘quantS*.sim’, ‘quanthazard*.sim’, ‘quantpredhazard*.sim’. |
Eb0.depend.mix |
a logical value indicating whether the mean of
the random intercept (if included in the model) was given in a
hierarchical model as an overall mean of the mixture in the error
term. With |
dir |
a string giving a directory where previously simulated values were stored and where newly obtained quantities will be stored. On Unix, do not use ‘~/’ to specify your home directory. A full path must be given, e.g. ‘/home/arnost/’. |
toler.chol |
tolerance for the Cholesky decomposition. |
toler.qr |
tolerance for the QR decomposition. |
Value
An integer which should be equal to zero if everything ran fine.
Author(s)
Arnošt Komárek arnost.komarek@mff.cuni.cz
References
Komárek, A. (2006). Accelerated Failure Time Models for Multivariate Interval-Censored Data with Flexible Distributional Assumptions. PhD. Thesis, Katholieke Universiteit Leuven, Faculteit Wetenschappen.
Komárek, A. and Lesaffre, E. (2007). Bayesian accelerated failure time model for correlated interval-censored data with a normal mixture as an error distribution. Statistica Sinica, 17, 549 - 569.
Examples
## See the description of R commands for
## the models described in
## Komarek (2006),
## Komarek and Lesaffre (2007).
##
## R commands available
## in the documentation
## directory of this package as
## - ex-cgd.R and
## https://www2.karlin.mff.cuni.cz/~komarek/software/bayesSurv/ex-cgd.pdf
##
## - ex-tandmobMixture.R and
## https://www2.karlin.mff.cuni.cz/~komarek/software/bayesSurv/ex-tandmobMixture.pdf
##