predict.rocTree {rocTree} | R Documentation |
Predicting based on a rocTree
model.
Description
The function gives predicted values with a rocTree
fit.
Usage
## S3 method for class 'rocTree'
predict(object, newdata, type = c("survival", "hazard"), control = list(), ...)
Arguments
object |
is an |
newdata |
is an optional data frame in which to look for variables with which to predict. If omitted, the fitted predictors are used. If the covariate observation time is not supplied, covariates will be treated as at baseline. |
type |
is an optional character string specifying whether to predict the survival probability or the cumulative hazard rate. |
control |
a list of control parameters. See 'details' for important special
features of control parameters. See |
... |
for future developments. |
Value
Returns a data.frame
of the predicted survival probabilities or cumulative hazard.
Examples
data(simDat)
fit <- rocTree(Surv(Time, death) ~ z1 + z2, id = id, data = simDat, ensemble = FALSE)
## testing data
newdat <- data.frame(Time = sort(unique(simDat$Time)),
z2 = runif(1))
newdat$z1 <- 1 * (newdat$Time < median(newdat$Time))
head(newdat)
## Predict survival
pred <- predict(fit, newdat)
plot(pred)
## Predict hazard
pred <- predict(fit, newdat, type = "hazard")
plot(pred)
[Package rocTree version 1.1.1 Index]