Extracts tree information from a ocf.forest object.
tree_info(object, tree = 1)A data.frame with the following columns:
nodeIDNode IDs.
leftChildIDs of the left child node.
rightChildIDs of the right child node.
splitvarIDIDs of the splitting variable.
splitvarNameName of the splitting variable.
splitvalSplitting value.
terminalLogical, TRUE for terminal nodes.
predictionOne column with the predicted conditional class probabilities.
Nodes and variables IDs are 0-indexed, i.e., node 0 is the root node.
All values smaller than or equal to splitval go to the left and all values larger go to the right.
Di Francesco, R. (2025). Ordered Correlation Forest. Econometric Reviews, 1–17. doi:10.1080/07474938.2024.2429596 .
## Generate synthetic data.
set.seed(1986)
data <- generate_ordered_data(1000)
sample <- data$sample
Y <- sample$Y
X <- sample[, -1]
## Fit ocf.
forests <- ocf(Y, X)
## Extract information from tenth tree of first forest.
info <- tree_info(forests$forests.info$forest.1, tree = 10)
head(info)
#> nodeID leftChild rightChild splitvarID splitval terminal prediction
#> 1 0 1 2 0 -0.4391133 FALSE NA
#> 2 1 3 4 0 -1.0237835 FALSE NA
#> 3 2 5 6 0 0.9056179 FALSE NA
#> 4 3 7 8 2 0.0856919 FALSE NA
#> 5 4 9 10 0 -0.8822695 FALSE NA
#> 6 5 11 12 3 0.5000000 FALSE NA