8
$\begingroup$

I'm not sure how to interpret a partial dependence plot for a categorical variable. For instance, the partial dependence (command partialPlot from the randomForest package) for a binary predictor would give two values, one for each category.

How exactly do you interpret those values? The documentation of partialPlot is quite cryptic in this respect.

My confusion arises, I guess because I'm thinking in terms of a logistic regression, where with a dummy coding system you in general obtain the log-odds of the variable of interest against the baseline category.

$\endgroup$
1
  • $\begingroup$ Here is another similar question asked after this. $\endgroup$
    – utobi
    Commented Nov 13, 2022 at 7:40

1 Answer 1

4
$\begingroup$

In general partial plots are the average of a series of hypothetical predictions.

For continuous variables, partialPlot selects a series of n.pt values along the variable of interest. It creates a test data set identical to the training data, and sequentially sets the variable of interest for all observations to a selected value. It then takes the average value of the predicted response for each test set and plots the results against the select value. For a binary categorical predictor, this process would result in only two values.

It is helpful to use partial plots in combination with variable dependence and interpret them together. The variable dependence figure is generated by plotting the forest predicted value against the variable of interest for each observation.

$\endgroup$
2
  • $\begingroup$ So in the case of a binary predictor, could you interpret the difference between the partialPlot values as the logit of one category against the other (assuming RF gives calibrated probabilities)? $\endgroup$
    – utobi
    Commented Mar 5, 2015 at 10:08
  • 1
    $\begingroup$ Yes that is correct. See also Partial Dependence Plot interpretation. $\endgroup$ Commented Nov 30, 2016 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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