# Cost-complexity pruning: what the method does exactly?

The tree::prune.tree R function has a method parameter, described in the guide as:

character string denoting the measure of node heterogeneity used to guide cost-complexity pruning. For regression trees, only the default, deviance, is accepted. For classification trees, the default is deviance and the alternative is misclass (number of misclassifications or total loss).

For regressions, method must be deviance, for classification, it can be deviance or misclass.

In The Elements of Statistical Learning (2nd ed), cost-complexity pruning is described for regression trees at pag. 308.

Given the full tree T_0, for every $$\alpha$$, we find the sub-tree $$T_\alpha \subseteq T_0$$ that minimizes $$C_{\alpha}(T)$$.

$$C_{\alpha}(T) = \sum_{m=1}^{|T|} \sum_{x_i \in R_m} (y_i - \hat{c}_m)^2 + \alpha |T|$$

Where is the deviance of the method parameter of the tree::prune.tree R function?

In case of classification tree, how should we modify $$C_{\alpha}(T)$$ in case we want to use the deviance method?

What in case we want to use the misclass method?