# Extracting lambda value with highest log-likelihood from boxcox output

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?

-
I was going to ask whether you consulted the documentation for 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
bc returns a list with two entries. Because your command is supposed to give the lambda value with the highest log-likelihood, I would say that lambda values are in the x-entry while the corresponding log-likelihood values are in the y-entry. Just a guess. –  ocram Dec 20 '12 at 15:10

No, x is not log(Height). If you write bc$x then you are extracting$\lambda$from the bc object. The bc object gives two values x and y. The x referes to the$\lambda\$ (or x axis) and y refers to the value of the log-likelihood. Check out this clip.