View source: R/predict_shrinkDSM.R
| predict.shrinkDSM | R Documentation |
Draws from the posterior predictive distribution of survival times based on a fitted
time-varying parameter survival model resulting from a call to
shrinkDSM.
## S3 method for class 'shrinkDSM' predict(object, newdata, cens = TRUE, ...)
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. |
The value returned is a list object of class shrinkTVP_pred containing the
samples from the
posterior predictive density.
Peter Knaus peter.knaus@wu.ac.at
Daniel Winkler dwinkler@wu.ac.at
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.