[R] Rpart - best split selection for class method and Gini splitting index

Prof Brian Ripley
Thu, 21 May 2009 07:17:10 -0000

On Thu, 21 May 2009, Paolo Radaelli wrote:

>
> Dear R-users,
> I'm working with the Rpart package and trying to understand how the
procedure

I presume you mean 'rpart': R package names are case sensitive.

> select the best split in the case the method "class" and the
> splitting index "Gini" are used. In particular I'd like to
have look
> to the source code that works out the best split for un unordered
> predictor.

> Does anyone can suggest me which functions in the sources I should
> consider ?

It done in C.  Start with file bsplit.c, that says

** The routine which will find the best split for a node

Then look at gini.c (again, pretty obvious, I believe).

> Any input would be highly appreciated.
>
> Thank you
> Paolo
>
> Paolo Radaelli
> Dipartimento di Metodi Quantitativi per le Scienze Economiche ed Aziendali
> Facolt? di Economia
> Universit? degli Studi di Milano-Bicocca
> Via Bicocca degli Arcimboldi, 8
> 20126 Milano
> Italy
> e-mail paolo.radaelli at unimib.it
> Tel +39 02 6448 3163
> Fax +39 02 6448 3105
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

--
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