I am using Random Forest (regression) to analyze data on civil conflict. I have plotted two different things: variable importance and the distribution of the min depth (using the package randomForest randomForestExplainer in R).

My question is: How come the variable with the highest variable importance is not the variable with the lowest mean min depth? And what does this mean that they are not equal? I included the two images.

The dependent variable is conflict intensity. The data is structured in a country-year format, so for every country I have a data-point for every year. The independent variables include population, region, gdp etc.



randomF <- randomForest(max_intensity ~ nrgroups + GDPlog_lag + logPopulation + Polity_lag + Asia + Africa + MiddleEast + Europe + Americas, data=MAR_regressions, na.action=na.exclude)

plot(randomF, type="l", main= "Random Forest Protest and Rebellion")

varImpPlot(randomF, main="Variable Importance Random Forest Prot & Reb", col="blue")


Variable Importance Min Depth


Variable importance is calculated by considering the average increase in node purity a split on that variable causes. Variables whos splits cause larger increases in node purity are more important. The first split typically causes the largest increase in node purity. I am assuming that min depth in this package means what is the first time this variable is used to split the tree. If this is the case it makes sense that more important variables have lower min depth values. The splits that cause the larger increases in purity happen early and so the important variables are split on early.

  • $\begingroup$ Thank you for your answer! Yes you are correct about the min depth. But why aren't the most important variables the same for both variable importance and min depth? And shouldn't they be the same? $\endgroup$ – Anouk May 27 '19 at 19:34
  • $\begingroup$ That’s what I’m saying in my answer... they are the same for both. Importance is measured in min depth by having a small min depth. The order is not exactly the same but that’s to be expected they are measuring slightly different things $\endgroup$ – astel May 28 '19 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.