Learn R Programming

DStree (version 1.0)

predict.DStree: Predictions from a fitted DStree Object

Description

Returns the predicted median survival time, hazard and survival probabilities from a fitted DStree object.

Usage

"predict"(object, data, ...)

Arguments

object
a fitted object of class "DStree"
data
data frame containing the values at which predictions are required. The predictors referred to in the right side of formula(object) as well as the 'status' variable must be present by name in data. If missing, the fitted values are returned.
...
further arguments passed to or from other methods.

Value

A named list with the following elements: The vector MedSurv contains the predicted median survival times of the observations in data. The matrices Surv and Haz contain the predicted probabilities and hazard rates, respectively, where each row refers to an individual and each column refers to an observed time point (1,2,...).

References

Bou-Hamad I., Larocque D.,Ben-Ameur H., Masse L. C., Vitaro F. and Tremblay R. E. (2009), Discrete-Time Survival Trees. Canadian Journal of Statistics 37 (1), 17-32.

Examples

Run this code
data(cost)
# Convert observed days to years
d.cost<-dis.cost(cost)

# Train Data
Train<-d.cost[1:300,]
# Test Data
Test<-d.cost[301:518,]

fit <- DStree(time~prevStroke+age+sex+alcohol+smoke,status="status",data=d.cost)

#Predictions from Test Data
predict(fit,Test)

Run the code above in your browser using DataLab