library(MASS)
bc <- boxcox(Volume ~ log(Height) + log(Girth), data = trees)
To find the $\lambda$ value with the highest log-likelihood, this command could be used:
bc$x[which.max(bc$y)]
Is x=log(Height) in this example?
To find the $\lambda$ value with the highest log-likelihood, this command could be used:
Is |
||||
|
No, |
|||
|
|
|
If you only grab the highest lambda from that analysis then you are missing the point of the function and its return. Part of what it is trying to show you (look at the graph that it produces) is that there is a region of reasonable lambda values. You should use this and knowledge of the science behind the data to choose a reasonable value. If the "best" lambda value is 0.43, but the interval includes 0.5 and there is a meaningful reason why a square root transform makes sense then using 0.5 is better in many ways than using 0.43 even though it gives the maximum. The original paper by Box and Cox talked about understanding the science and finding reasonble candidates for lambda, not just trying everything and using the maximum value even when there is no justification (and there is justification for other values that are almost as good). |
|||
|
|
boxcox, but I read it myself and realized it is utterly useless: it doesn't say anything about what is actually getting transformed. Consulting this recent blog by Arthur Charpentier may help set you straight. – whuber♦ Dec 20 '12 at 14:56