[R] rpart with only two small groups
Birgitle
birgit.lemcke at systbot.uzh.ch
Wed Sep 17 09:17:08 CEST 2008
Thanks Gavin and sorry to all for this unnecessary question.
B.
Gavin Simpson wrote:
>
> On Tue, 2008-09-16 at 10:47 -0700, Birgitle wrote:
>> Hello R-User!
>>
>> I try to do the following:
>>
>> New<-iris[c(1:7,90:97),1:5]
>> New.rpart<-rpart(Species~., data=New, method="class")
>>
>> New.rpart
>> n= 15
>>
>> node), split, n, loss, yval, (yprob)
>> * denotes terminal node
>>
>> 1) root 15 7 versicolor (0.4666667 0.5333333) *
>>
>> Does it mean it is not possible to find a variable that splits my groups
>> or
>> are my groups just to small?
>> Is there a way to find out the variable that splits my groups best?
>
> Yes, as always, read the help file ;-)
>
> ?rpart leads you to ?rpart.control, which has argument minsplit with
> default 20, which is the minimum number of observations in a node for a
> split to be attempted. As 15 is less than 20, the root node could not be
> split.
>
> E.g.:
>> New<-iris[c(1:7,90:97),1:5]
>> New.rpart<-rpart(Species~., data=New, method="class", control =
> rpart.control(minsplit = 2))
>> New.rpart
> n= 15
>
> node), split, n, loss, yval, (yprob)
> * denotes terminal node
>
> 1) root 15 7 versicolor (0.4666667 0.5333333)
> 2) Petal.Length< 2.5 7 0 setosa (1.0000000 0.0000000) *
> 3) Petal.Length>=2.5 8 0 versicolor (0.0000000 1.0000000) *
>
> HTH
>
> G
>
>>
>> Thanks in advance for help.
>>
>> B.
>>
>> -----
>> The art of living is more like wrestling than dancing.
>> (Marcus Aurelius)
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Dr. Gavin Simpson [t] +44 (0)20 7679 0522
> ECRC, UCL Geography, [f] +44 (0)20 7679 0565
> Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
> Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
> UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
> ______________________________________________
> 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.
>
>
-----
The art of living is more like wrestling than dancing.
(Marcus Aurelius)
--
View this message in context: http://www.nabble.com/rpart-with-only-two-small-groups-tp19516515p19526594.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list