3
$\begingroup$

I'm attempting to use the rpart R package, and I'm having difficulty figuring out how to determine the quality of a given tree output. For most linear models I would just examine p-values and $r^2$ values to determine whether the model performs satisfactorally. Is there a similar number for decision trees, or is the only performance metric available how well it can fit the data?

(Note: I'm trying to use a decision tree to fit to a continuous dataset. I guess a very relevant separate question is, whether a decision tree is appropriate for that type of data?)

$\endgroup$
6
$\begingroup$

The only right performance measure for any method is how well it fits the data. This is what $R^2$ does for linear regression. It is also why you should not use p values to judge a model.

Trees can be used for both continuous and categorical dependent variables (and other types of DV as well). There are various measures of purity of the nodes. In a regression tree context, one such measure would be that the nodes each contain values that are similar to each other and different from those of other nodes. This relates well to the ANOVA concept of "between" and "within" error. It is also related to $R^2$, but the relationship is not quite as intuitive.

With continuous dependent variables, by the way, trees are called regression trees. Classification trees are for categorical variables.

$\endgroup$
  • $\begingroup$ Thanks for the answer. Two follow-ups: (1) Is there a name for "measure of node purity", as you're calling it? (2) When you refer to "purity", are you implying the nodes should be statistically independent, or are there other ways of determining how self-similar and other-dissimilar the node is? $\endgroup$ – eykanal Feb 14 '12 at 5:09
  • $\begingroup$ Regarding 1) there are a bunch of different names for different formulations of purity. These get a bit complex to write, but are covered in any good book on classification/regression trees or recursive partitioning. Regarding 2) I'm talking about self-similar and other dis-similar $\endgroup$ – Peter Flom Feb 14 '12 at 12:01

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.