[R] Help on CHAID info

Marcelo L. Arruda mlarruda at terra.com.br
Mon Nov 10 18:15:58 CET 2014


Dear friends,

     I am analyzing a big dataset via CHAID and the resulting tree has 
dozens of terminal nodes. My question is: since I want to use these 
categories in further analysis, how can I get a summarized listing 
(preferably in a vector format) about the content of each category. For 
example, suppose that my resulting tree was like that:


Fitted party:
[1] root
|   [2] color in 0
|   |   [3] year in 0: 0 (n = 311, err = 49.5%)
|   |   [4] year in 1: 1 (n = 249, err = 35.3%)
|   [5] color in 1
|   |   [6] size in 0: 0 (n = 159, err = 47.8%)
|   |   [7] size in 1:
|   |   |   [8] price in 0: 0 (n = 127, err = 22.0%)
|   |   |   [9] price in 1: 0 (n = 115, err = 40.9%)

     So, I wished a function which could return a list of informations 
like that:

         terminal node 3: color = 0 and year = 0
         terminal node 4: color = 0 and year = 1
         terminal node 6: color = 1 and size = 0
         terminal node 8: color = 1, size = 1 and price = 0
         terminal node 9: color = 1, size = 1 and price = 1

     For example, a matrix like that would be more than good to my goals:

      term_node color year size price
[1,]         3     0    0   NA    NA
[2,]         4     0    1   NA    NA
[3,]         6     1   NA    0    NA
[4,]         8     1   NA    1     0
[5,]         9     1   NA    1     1

     Many thanks in advance for any help,

Marcelo L. Arruda

	[[alternative HTML version deleted]]



More information about the R-help mailing list