data(cost)
## Discretize observed days to years
d.cost<-dis.cost(cost)
# Bagging Tree
bag <- bag(time~prevStroke+age+sex+alcohol+smoke,status="status",data=d.cost[1:330,],nBoot=10)
pred <- predict(bag,newdata=d.cost[331:518,])
pred$MedSurv
Run the code above in your browser using DataLab