# Disrepencies between Information Gain and Tree Growth

I was wondering if someone can explain to me why in my decision tree some of the variable with the highest importance (highest information - script shown below) do not appear into my tree at all, while the one in the first node (which from my understanding is the one doing the best split) is ranked 6th in terms of information gain!

I had run the decision tree using the rpart library in R and then pruned the tree using the following code:

tree <- rpart(factor(PREDICTOR) ~ ...
,data = data)

printcp(tree) # display the results

--bestcp*root node errror

bestcp <- tree$cptable[which.min(tree$cptable[,"xerror"]),"CP"]
tree.pruned <- prune(tree, cp = bestcp)


Afterwards I run the function published by looking at that post:How to measure/rank "variable importance" when using CART? (specifically using {rpart} from R). I also run the same process using SPSS with the CRT method. It gave me an almost identical tree as rpart and an identical variable importance table.