0
$\begingroup$

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?

$\endgroup$
5
  • $\begingroup$ Hi, welcome to the site! In principle you are on the right track and looked at the relevant previous answers. It's hard to say what exactly goes wrong in your computations because you haven't provided a reproducible example. Please provide a simple and self-contained example, e.g., with a standard data set or a small simulated one. $\endgroup$ Apr 18, 2020 at 4:12
  • $\begingroup$ Hi Beverly: you should be able to edit your post without any review from the community. I'm not sure what process made your proposed edit go into the review queue, but I believe that in the future if you just make the edit (link through the "edit" control beneath your post) you should be fine. $\endgroup$
    – whuber
    Apr 20, 2020 at 19:14
  • $\begingroup$ @whuber Hi, since I have accidentally created a second account (the account that I used to post the question is an unregistered account), that's the reason why I can't edit my post directly. I have contacted the team and requested to merge them. $\endgroup$
    – Beverly
    Apr 21, 2020 at 7:55
  • $\begingroup$ @AchimZeileis Hi, because the dataset is protected by a non-disclosure agreement, I am not sure could I provide a simple example before getting permission. Could you explain the process of how a conditional inference works when both outcome variable and predictor are binary? e.g., the exact form of the test statistic used for a conditional inference tree with a binary outcome variable and binary predictors? $\endgroup$
    – Beverly
    Apr 21, 2020 at 8:03
  • $\begingroup$ As I wrote above: Please don't share your actual data but use a standard data set in R or simulate one that replicates your problem. $\endgroup$ Apr 21, 2020 at 9:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.