[R] prune in rpart: choose number terminal nodes

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Sep 23 21:19:38 CEST 2012


On 23/09/2012 17:32, Uwe Ligges wrote:
>
>
> On 21.09.2012 11:49, agent dunham wrote:
>> Dear community,
>>
>> I've an rpart object, and I know the CP I want.  I'd like to know if it's
>> possible also to fix the number of terminal nodes I want.
>
> I don't know of any existing function, but you can write it yourself:
> All the information you need is available from the rpart object.

Up to a point.  The pruning sequence does not include all possible 
numbers of 'terminal notes' (aka 'leaves').

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list