2
$\begingroup$

The function powerTranform from the "car" package in R mentions the following code for Box-Cox transformation for multiple regression:

summary(p1 <- powerTransform(cycles ~ len + amp + load, Wool))
# fit linear model with transformed response:
coef(p1, round=TRUE)
summary(m1 <- lm(bcPower(cycles, p1$roundlam) ~ len + amp + load, Wool))

Is it sensible to apply Box-Cox method to just the dependent variable (and not the whole formula) and proceed with the regression:

library(fifer)
cycles = boxcoxR(cycles)
summary(m1 <- lm(cycles ~ len + amp + load, Wool))

I suspect this method is not right but I am not sure.

$\endgroup$
  • 1
    $\begingroup$ It is possible, of course (if it is sensible is another question). The function powerTransform from the car package accepts a single vector. So you could use p1 <- powerTransform(cycles) and then use bcPower(cycles, p1$roundlam) to perform the transformation. Then proceed with the regression as usual. $\endgroup$ – COOLSerdash May 5 '15 at 18:43
  • 1
    $\begingroup$ @Irish Another explicit purpose of this family of transformations is to help linearize relationships. At least Tukey claimed as much. Plausibly, it could be used with predictor series for that purpose. $\endgroup$ – whuber May 6 '15 at 0:14
  • 1
    $\begingroup$ @IrishStat While Box and Cox (1964) does largely focus on transformation of DVs, this would be expected, since (as Box&Cox mentions) Box and Tidwell (1962) address transformation of IVs. In addition, section 8 of Box&Cox does discuss simultaneous transformation of both y and the x's. So while the prime focus of the Box&Cox paper itself is on tranformation of IVs I think it's too strong to state it was never intended to relate to independent variables. If we then add Tukey's work on simultaneous transformations of both (where he also includes log as the '0th power'), ...(ctd) $\endgroup$ – Glen_b May 6 '15 at 0:57
  • 1
    $\begingroup$ @IrishStat I don't dispute your evaluation of it; they're frequently overused and like any model selection process there are biases introduced by trying to optimize them. In general transformations, if used at all, should be based on sounder ground (theoretical considerations, for example); if that's unavoidable, the impact of the selection process on inference needs to be properly accounted for. $\endgroup$ – Glen_b May 6 '15 at 1:28
  • 1
    $\begingroup$ It is interesting that the original Box and Cox paper had two examples in which the eventual choices were logging and taking reciprocals respectively, both of which would have been evident to experienced analysts independently of the Box-Cox machinery.. I think that is the way to use it, as suggestive; taking the estimated power too literally and using e.g. 0.123 or -0.456 often leads to models that are hard to interpret and fits that can't be reproduced on similar data. (I set aside fitting power laws $y = ax^b$ where taking logarithms is usually natural as a way to estimate parameters.) $\endgroup$ – Nick Cox May 6 '15 at 7:40
3
$\begingroup$

It depends on your process. For instance, your independent variables are stationary, but your dependent variable is not. You observe that it's variance seems to increase with the level. In this case it's appropriate to apply Box-Cox to the dependent variable only.

The point is that you use this particular transformation to solve certain issue such as as heteroscedasticity of certain kind, and if this issue is not present in other variables then do not apply the transformation to them.

UPDATE: Here's the typical example when Box-Cox is prescribed, it's from this page. You see how the variable seems to swing wider when the level grows. Personally, I would consider an exponential growth with multiplicative errors, but this is a classic example for Box-Cox. enter image description here

$\endgroup$
  • $\begingroup$ Whether or not the variance of Y increases/changes with level is not the issue. That kind of non-stationarity or Gaussian violation can often be more easily treated with Intervention Detection schemes. Box-Cox tests ( is a remedy) for the linkage between the expected value of Y and the models error variance ... nothing to do with the variance of Y or X $\endgroup$ – IrishStat May 6 '15 at 0:39
  • $\begingroup$ @IrishStat The model errors are not observable. It's convenient to talk about them as if we knew them, of course, but the reality's that we don't know them. What you observe is Y and X. When your Y looks like swinging more at higher levels than at lower levels you consider applying Box-Cox. $\endgroup$ – Aksakal May 6 '15 at 0:59
  • $\begingroup$ autobox.com/cms/index.php/news/… presents a counter example ( start with slide 14 ) where there is larger/ higher variability of Y for higher levels of Y BUT this goes away when you model Y taking into account a few pulses/unusual values. To reiterate the Box_cox test evaluates the dependency/linkage between Y and the error variance. It has nothing to do with the actual variablility of Y itself. $\endgroup$ – IrishStat May 6 '15 at 1:12
  • $\begingroup$ @Irish I cannot recognize the data in your analysis beginning at p. 14. In particular, your plot of annual SD vs. annual mean on p. 15 doesn't look remotely consistent with the data shown on the preceding page. (The plot you describe on p. 15, as I understand it, can be produced in R with the commands x <- matrix(AirPassengers, 12); plot(colMeans(x), apply(x, 2, sd))) $\endgroup$ – whuber May 6 '15 at 17:25
  • $\begingroup$ @wuber thanks for picking up on this. The plot (inadvertently) shows the relationship between the standard deviation of the transformed data versus the mean of the observed values. If one simply plots the annual standard deviation and the annual mean in the observed metric there is visual linkage. We will fix this. Trust but Verify ! $\endgroup$ – IrishStat May 6 '15 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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