# r :Does rpart require normalized data set for the input variable?

Does rpart function require normalized data when using the "anova" method? Im assuming so, but I do not like to assume. I have looked and no where has it said it needs to be, but the method makes me think it does. Thanks

Scott

-

No, it doesn't. Here's an example;

library("rpart")
# grow first tree
fit <- rpart(Kyphosis ~ Age + Number + Start, method="anova", data=kyphosis)
fit

# grow with transformed data
fit2 <- rpart(Kyphosis ~ I(10*Age+3) + Number + Start, method="anova", data=kyphosis)
fit2 # note equivalence with first version

-
Thank you very much! What about the response variable or in this case "Kyphosis"? When I transform my Kyphosis variable I get a different tree with more branches, the same first branches but a few more later on. –  Scott Feb 25 '12 at 14:39
Any monotonic transformation of the independent variables should make no difference. But a transformation of the response can make a difference, if it changes the fit measures. So, if you took the log, for example, the result could be different, but if you simply multiply by a constant, it should not be. –  Peter Flom Feb 25 '12 at 14:58
Exactly, so would the response variable need to be normalized? –  Scott Feb 25 '12 at 15:08
It doesn't need to be. It depends on what you are trying to do. Having a non-normal DV does not violate any assumptions. (Even for ANOVA on its own, the assumption is about the residuals not the DV) –  Peter Flom Feb 25 '12 at 15:11
Scott, what exactly do you mean by "normalize"? I mean subtracting off the mean and dividing by the standard deviation - so after transformation, the variable has mean zero and variance one. –  guest Feb 27 '12 at 5:24