predict.shrinkDSM: Draw from posterior predictive density of a fitted...

Description Usage Arguments Value Author(s) Examples

View source: R/predict_shrinkDSM.R

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

1
2
## S3 method for class 'shrinkDSM'
predict(object, newdata, cens = TRUE, ...)

Arguments

object

an object of class shrinkDSM, containing the fitted model.

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 shrinkDSM.

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 TRUE.

...

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

shrinkDSM documentation built on Sept. 6, 2021, 9:07 a.m.