[R] using rpart with a tree misclassification condition

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Nov 22 09:10:38 CET 2010



On 22.11.2010 08:32, meytar wrote:
>
> Hello
> I want to build a classification tree for a binary response variable
> while the condition for the final tree should be :
> The total misclassification for each group (zero or one) will be less then
> 10% .
> for example: if I have in the root 100 observations, 90 from group 0 and 10
> from group 1, I want that in the final tree a maximum of 9 and 1
> observations out of group 0 and 1, respectively, will be misclassified.
> Does anyone know what code will be appropriate for implementing this
> condition?


If you mean the misclassification for new observations: no, otherwise I 
would be extremely rich.

If you meant the apparent error rate: Just grow a full tree and then 
prune step by step until the error is too large for your condition. Then 
just take the tree model from one step before ....

Uwe Ligges







> Thank you in advance
> Meytar



More information about the R-help mailing list