4
$\begingroup$

I'm working as a liaison between a researcher and a stats team at a university. I'm a database admin who is working on using business intelligence tools to offer the option of (as of right now) offer CART analyses in .PDF form over the internet. I'm using Microsoft Business Intelligence Development Studio to do this. Recently I received an email saying that the measure (or independent variable I guess it should be called here) was highly skewed and the original CART analysis didn't make sense. Fair enough, I know that sometimes these things don't work out like you had hoped. Then, another analysis was done with a log transformation. Can someone point me to a good quick and dirty resource so I can read up on this? I'm not a complete stats novice, but ANOVAs and logistic regressions are about as far as my knowledge extends.

$\endgroup$
1
  • $\begingroup$ Could you clarify what the "this" is that you want to read up on? CART? Re-expressing variables? Logarithms? Skewed datasets? Things not working out? Analyses not making sense? $\endgroup$
    – whuber
    Mar 6, 2013 at 21:38

1 Answer 1

10
$\begingroup$

Taking the log of a predictor (independent) variable should have no effect, as CART is invariant to monotonic transformations of the predictors.

See this example where I fit a CART with Age (named fit1) and log(Age) (named fit2). The split points are the same for both trees (only that the split points in fit2 are on the log scale, e.g., $4.706 \approx \ln(111)$), the predictions and nodes are exactly the same.

R> library(rpart)
R> fit <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis)
R> fit2 <- rpart(Kyphosis ~ log(Age) + Number + Start, data=kyphosis)
R> fit
n= 81 

node), split, n, loss, yval, (yprob)
      * denotes terminal node

 1) root 81 17 absent (0.79012 0.20988)  
   2) Start>=8.5 62  6 absent (0.90323 0.09677)  
     4) Start>=14.5 29  0 absent (1.00000 0.00000) *
     5) Start< 14.5 33  6 absent (0.81818 0.18182)  
      10) Age< 55 12  0 absent (1.00000 0.00000) *
      11) Age>=55 21  6 absent (0.71429 0.28571)  
        22) Age>=111 14  2 absent (0.85714 0.14286) *
        23) Age< 111 7  3 present (0.42857 0.57143) *
   3) Start< 8.5 19  8 present (0.42105 0.57895) *
R> fit2
n= 81 

node), split, n, loss, yval, (yprob)
      * denotes terminal node

 1) root 81 17 absent (0.79012 0.20988)  
   2) Start>=8.5 62  6 absent (0.90323 0.09677)  
     4) Start>=14.5 29  0 absent (1.00000 0.00000) *
     5) Start< 14.5 33  6 absent (0.81818 0.18182)  
      10) log(Age)< 4.005 12  0 absent (1.00000 0.00000) *
      11) log(Age)>=4.005 21  6 absent (0.71429 0.28571)  
        22) log(Age)>=4.706 14  2 absent (0.85714 0.14286) *
        23) log(Age)< 4.706 7  3 present (0.42857 0.57143) *
   3) Start< 8.5 19  8 present (0.42105 0.57895) *
$\endgroup$
1
  • 3
    $\begingroup$ (+1) I think whoever sent the email doesn't really understand how CART analysis works. One of the primary advantages of CART over linear regression is that you don't need to worry about transforming the independent variables. $\endgroup$
    – Zach
    Mar 6, 2013 at 22:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.