getAncestryTree: retrieves the path from node to root for all nodes of a tree

Description Usage Arguments Value Note See Also Examples

Description

For each (not terminal) node of a tree this function retrieves the path from the according node to the root of the considered tree.

Usage

1

Arguments

tree

A matrix containing tree information that is returned by the getTree function.

Value

A list of the same length as number of not terminal nodes in the tree. Each element contains the path from the according node to the root of the tree, by providing the index of the variables used for splitting. First value is the closest ancestor, last value equals the root.

Note

For reasons of efficiency this function does not apply getAncestryNode. Therefore the result for a specific node differs slightly regarding the layout, e.g. node indices are omitted.

See Also

getAncestryNode, getAncestryForest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## data
YX <- simulateSNPdata(seed = 123)

## forest
rF <- randomForest(x = YX[ , -1], y = YX[ , 1], keep.forest = TRUE, 
		keep.inbag = TRUE, importance = TRUE, ntree = 500)
		
## ancestry
getAncestryTree(getTree(rF, 1))[5:10]
getAncestryNode(10, getTree(rF,1))

adibender/rFtools documentation built on May 14, 2019, 5:13 a.m.