predict.shrinkDSM {shrinkDSM} | R Documentation |
Draw from posterior predictive density of a fitted time-varying parameter survival model
Description
Draws from the posterior predictive distribution of survival times based on a fitted
time-varying parameter survival model resulting from a call to
shrinkDSM
.
Usage
## S3 method for class 'shrinkDSM'
predict(object, newdata, cens = TRUE, ...)
Arguments
object |
an object of class |
newdata |
a data frame containing the covariates used for the prediction.
The names of the covariates
have to match the names used during model estimation in the call to |
cens |
logical value indicating whether the predictions should be censored at the
largest survival time in the data used for estimation.
The default value is |
... |
included for S3 method consistency and currently ignored. |
Value
The value returned is a list object of class shrinkTVP_pred
containing the
samples from the
posterior predictive density.
Author(s)
Peter Knaus peter.knaus@wu.ac.at
Daniel Winkler dwinkler@wu.ac.at
Examples
set.seed(123)
data("gastric")
# Create intervals for piecewise exponential model
intervals <- divisionpoints(gastric$time, gastric$status, 2)
# Estimate model
mod <- shrinkDSM(time ~ radiation, gastric,
delta = gastric$status, S = intervals)
# Draw from posterior predictive distribution
newdata <- data.frame(radiation = c(0, 1))
pred <- predict(mod, newdata = newdata)