gettree.ICcforest {ICcforest} | R Documentation |
Extract an individual tree from an ICcforest object
Description
Extract the i-th individual tree from the established ICcforest. The resulting object can be printed or plotted, and predictions can be made using it.
Usage
## S3 method for class 'ICcforest'
gettree(object, tree = 1L, ...)
Arguments
object |
an object as returned by |
tree |
an integer, the number of the tree to extract from the forest. |
... |
additional arguments. |
Value
An object of class party
.
Examples
#### Example with dataset miceData
library(icenReg)
data(miceData)
## For ICcforest to run, Inf should be set to be a large number, for example, 9999999.
idx_inf <- (miceData$u == Inf)
miceData$u[idx_inf] <- 9999999.
## First, fit an iterval-censored conditional inference forest
Cforest <- ICcforest(formula = Surv(l,u,type="interval2")~grp, data = miceData, ntree = 50L)
## Extract the 50-th tree from the forest
plot(gettree(Cforest, tree = 50L))
[Package ICcforest version 0.5.1 Index]