predict.rocTree: Predicting based on a 'rocTree' model.

Description Usage Arguments Value Examples

View source: R/predict.rocTree.R

Description

The function gives predicted values with a rocTree fit.

Usage

1
2
## S3 method for class 'rocTree'
predict(object, newdata, type = c("survival", "hazard"), control = list(), ...)

Arguments

object

is an rocTree object.

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 rocTree for more details.

...

for future developments.

Value

Returns a data.frame of the predicted survival probabilities or cumulative hazard.

Examples

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

rocTree documentation built on Aug. 1, 2020, 5:06 p.m.