I am using the package rpart to explore various classification structures.  

 

The call looks like: 

 

seekhi1<-rpart(pvol~spec+a1+psize+eppres+numpt+icds+bivalcrt+stents+ppshare+
nhosp+nyrs,data=dat,method="class",

            control=rpart.control(minsplit=30,xval=10)) 

 

The output is

1) root 198 87 1 (0.5606061 0.4393939)  

   2) psize=1,2 122 43 1 (0.6475410 0.3524590)  

     4) a1=3 23  5 1 (0.7826087 0.2173913) *

     5) a1=1,2 99 38 1 (0.6161616 0.3838384)  

      10) numpt=1 53 16 1 (0.6981132 0.3018868) *

      11) numpt=2 46 22 1 (0.5217391 0.4782609)  

        22) nhosp=1 18  5 1 (0.7222222 0.2777778) *

        23) nhosp=2 28 11 2 (0.3928571 0.6071429) *

   3) psize=3 76 32 2 (0.4210526 0.5789474)  

     6) spec=3 16  5 1 (0.6875000 0.3125000) *

     7) spec=1,2 60 21 2 (0.3500000 0.6500000)  

      14) bivalcrt=2 34 16 2 (0.4705882 0.5294118)  

        28) stents=2 17  6 1 (0.6470588 0.3529412) *

        29) stents=1 17  5 2 (0.2941176 0.7058824) *

      15) bivalcrt=1 26  5 2 (0.1923077 0.8076923) *

 

I'd like to force rpart to use a specific variable, namely "spec" as the
first split and then allow it to proceed as usual.  Is there a way to do
this?

 

Thanks,

Bruce

 

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to