# Box Cox transformation in R

I understand how to use the box cox transformation in R and how to get the graph and lambda.

These are the things that are confusing me. For simplicity assume this example:

 Weight = Gender + Height + Age + Income


gender = categorical variable 1 = male, 0 = female

continuous variables - weight, height, age, income.

I've done:

model = lm(weight ~ gender + height + age + income)


and applied box-cox to this model which is about 1 so no transformation is needed for weight.

The questions are:

1. How do I apply Box-Cox to the 'x' variables to see if they need to be transformed (I read they can be applied to all x variables, the only disadvantage is its time consuming, but this isn't an issue for me).
2. How do I know if they need a transformation for sure e.g. if lambda is 0.4 should I use a square root transformation or does it 'have' to be 0.5? what is lambda is 2?
3. If one or two or all variables need a transformation then how do I adjust the main model formula?
• Why do you need to use Box-Cox to check your IVs? Usually Box-Cox is used to check for an optimal transformation for the DV to help with the assumption of normally distributed residuals (that is, a normally distributed DV \emph{conditional} on the IVs). Feb 15 '14 at 17:25
– whuber
Feb 15 '14 at 20:28

• I looked up AVAS and it looks like thats what I need. However, I'm a little stuck on implementing it. I took x = matrix with height, age etc, y = weight and a = avas(x,y). however, only plot(a$x, a$tx) and plot(a$y, a$ty) work i.e. not plot(a$tx, a$ty). Also I'm unsure of how to interpret the charts and determine if a transformation is needed as my graphs do not look anything like the graphs presented in the example. Can you help me please? Feb 16 '14 at 16:49