Since the Box-Cox transformation is typically used on the dependent variable, you could try doing this (which I think would still be valid):
- Model your independent variable (I.V.) as a function of your dependent variable (D.V.)
- Use the
boxcox
function in MASS
to estimate lambda
- Switch the variables in the (backwards) model above (so that D.V. ~ I.V.) and check the model fit with and without the estimated lambda.
For example:
set.seed(123)
y1 <- rnorm(200,10,2)
set.seed(321)
x1 <- .8*(y1^3)-rnorm(200)
##
require(MASS)
lm.xy <- lm(x1~y1) ## first model I.V. ~ D.V.
boxcox(lm.xy) ## for graph
bcTest <- boxcox(lm.xy,plotit=FALSE) ## for output
lambda <- bcTest$x[which.max(bcTest$y)] ## estimate of optimal lambda
## reverse your first model so that D.V. ~ I.V.
## and compare with and without transformation:
lm0.yx <- lm(y1~x1)
lm1.yx <- lm(y1~I(((x1^lambda)-1)/lambda))
summary(lm0.yx)
summary(lm1.yx)
I am not completely positive that this is a valid approach so (anyone) please feel free to correct me if I'm wrong or if you have a better suggestion.
r
. $\endgroup$