I train a conditional inference tree with binary outcome variable (rent: Y/N) and binary predictors (0 or 1).
Here is the output:
1) find_wemo_circle_center_count>=2 == {1}; criterion = 1, statistic = 729.653
2) wemoscooter_notification_allow_or_block_count>=2 == {1}; criterion = 1, statistic = 264.485
3) find_wemo_tap_scooter_count>=2 == {0}; criterion = 1, statistic = 61.355
4)* weights = 266
3) find_wemo_tap_scooter_count>=2 == {1}
5) find_wemo_circle_center_count>=3 == {1}; criterion = 0.988, statistic = 63.176
6)* weights = 666
5) find_wemo_circle_center_count>=3 == {0}
7)* weights = 164
2) wemoscooter_notification_allow_or_block_count>=2 == {0}
8) side_menu_select_count>=2 == {1}; criterion = 1, statistic = 296.55
9)* weights = 696
8) side_menu_select_count>=2 == {0}
10)* weights = 6830
1) find_wemo_circle_center_count>=2 == {0}
11) find_wemo_reserve_click_flash_light_count>=1 == {1}; criterion = 1, statistic = 694.357
12) find_wemo_zoom_in_count>=9 == {1}; criterion = 1, statistic = 77.995
13) find_wemo_reserve_count>=2 == {1}; criterion = 0.999, statistic = 53.655
14)* weights = 1533
13) find_wemo_reserve_count>=2 == {0}
15)* weights = 692
12) find_wemo_zoom_in_count>=9 == {0}
16) wemoscooter_notification_allow_or_block_count>=2 == {0}; criterion = 0.999, statistic = 72.525
17)* weights = 4608
16) wemoscooter_notification_allow_or_block_count>=2 == {1}
18)* weights = 699
11) find_wemo_reserve_click_flash_light_count>=1 == {0}
19) find_wemo_circle_center_count>=1 == {1}; criterion = 1, statistic = 544.989
20) device_operating_system == {ANDROID}; criterion = 1, statistic = 96.835
21)* weights = 548
20) device_operating_system == {IOS}
22)* weights = 2135
19) find_wemo_circle_center_count>=1 == {0}
23) find_wemo_reserve_count>=2 == {1}; criterion = 1, statistic = 406.679
24)* weights = 10224
23) find_wemo_reserve_count>=2 == {0}
25)* weights = 21955
I read Test statistics used for a conditional inference regression tree? and try to carry out the tests by hand. For the root node, I can replicate the results find_wemo_circle_center_count>=2 == {1}; criterion = 1, statistic = 729.653
by using independence_test() function and get the same results as the tree show to me.
independence_test(rent ~ `find_wemo_circle_center_count>=2`, data = dummy.temp.df, teststat = "quadratic")
## Asymptotic General Independence Test
## data: rent by find_wemo_circle_center_count>=2
## chi-squared = 729.65, df = 1, p-value < 2.2e-16
However, when I try to replicate the results for node 2 2) wemoscooter_notification_allow_or_block_count>=2 == {1}; criterion = 1, statistic = 264.485
, I did not get the same statistic.
filter.data <- filter(dummy.temp.df, `find_wemo_circle_center_count>=2`> 0)
independence_test(rent ~ `wemoscooter_notification_allow_or_block_count>=2`, data = filter.data, teststat = "quadratic")
## Asymptotic General Independence Test
##data: rent by
wemoscooter_notification_allow_or_block_count>=2
##chi-squared = 237.85, df = 1, p-value < 2.2e-16
So I read Conditional inference trees vs traditional decision trees and try to carry out the tests by this way, but it only shows an example when both outcome variable and predictor are numeric. What if the outcome variable and predictor are both categorical? In the answer, it said
if both DV and the covariates are nominal (unordered categorical), the test statistic is computed from a contingency table.
I do not understand what it means. Could anyone explain it and show an example how conditional inference tree calculate test statistic for node 2. Here is the contingency table for observations in node 2:
N Y
0 386 7140
1 193 903
or could anyone explain how a conditional inference works when both outcome variable and predictor are binary?