FOREST Procedure
Residual Sum of Squares Importance Method
The residual sum of squares (RSS) for regression trees is defined as
where
The residual sum of squares (RSS) for classification trees is defined as
where
For a single tree in the forest, the RSS-based metric measures variable importance based on the change in RSS when a split is found at a node. The change for variable v is
where
If the change in RSS is negative (which is possible when you use the validation set), then the change is set to 0.
The RSS-based importance for a single variable, v, in a single tree is then defined as
where D is the total number of nodes in which v was used as the splitting variable.
The RSS variable importance for the forest is the average of the RSS variable importance across all trees in the forest.
Variable Interaction Importance
In some cases, interactions of variables are of more interest than a single variable. When you specify the VII= option in the PROC FOREST statement, the procedure computes variable interaction importance as follows.
The two-way interaction importance for variables v and w is
where
d and e denote nodes, where node d is the parent of node e
v and w are variables, where v is the splitting variable for node d and w is the splitting variable for node e
This summation is across all parent-child node combinations with respect to the variables v and w.
The three-way interaction importance for variables v, w, and x is
where
d, e, and f denote nodes, where node d is the parent of node e, which is the parent of node f
v, w, and x are variables, where v is the splitting variable for node d, w is the splitting variable for node e, and x is the splitting variable for node f
This summation is across all parent-child-grandchild node combinations with respect to the variables v, w, and x.
When comparing variable importance values, you should compare a two-way interaction only with another two-way interaction, or a three-way interaction only with another three-way interaction. Comparing a two-way interaction to a three-way interaction is not meaningful, because the values for the importance are not on the same scale.
In addition to calculating the variable interaction importance, you can also generate SAS DATA step code to create interaction variables and save the code to a file by using the VIICODE statement. When you run the generated SAS DATA step code on the original data or on new data, interaction variables are created.
Created interaction variables are of the form ,
, or
, where the values used in the calculations come from the variables whose interactions are determined to be important. The values used are as follows:
For continuous variables, the raw value of the variable is used.
For categorical variables, the proportion of observations in the training set that is assigned to a specific branch is used.