[R] ctree ordering nodes

Achim Zeileis Achim.Zeileis at uibk.ac.at
Wed Jul 7 10:13:40 CEST 2010


On Tue, 6 Jul 2010, Paras Sharma wrote:

> Hello,
>
> When using the ctree function, from library (party) what is the syntax to
> order the Variables in the nodes in a specific way?
>
> For example, how would I specify to make a binary come first, then a
> continuous variable?

Not sure what you mean here. There is only one splitting variable in each 
node... The order in which the variables are tested is simply the order in 
which they appear in the model formula.

If you want to force ctree() to use a specific variable in the first split 
and a specific variable in the second split, this is currently not 
possible. ctree() always selects the locally optimal splitting variable.

> Also is there a way to force ctree to show variables which are not
> significant?

You can inspect the fitted ctree in various ways. See
   vignette("party", package = "party")
for a few helpful examples, especially Section 5.3.

If you want to construct your own trees using different algorithms, the 
package "partykit" might be of interest which is currently under 
development on R-Forge.

hth,
Z



More information about the R-help mailing list