Let's suppose that we perform Box-Cox transformation in R for the following data
library(MASS)
set.seed(1)
n <- 100
x <- runif(n, 1, 5)
y <- x^3 + rnorm(n)
run a linear model
m <- lm(y ~ x)
run the box-cox transformation
bc <- boxcox(y ~ x)
lambda <- bc$x[which.max(bc$y)])
What I'd now is to fit a new model
m2 <- lm(y^lambda ~ x)
The thing is, that $\lambda$ is chosen for the data that is centered at $1$, so should I divide all $y$ observations in the sample by the sample's median?
m2 <- lm((y/median(y))^lambda ~ x)
I know that operation only scales $y$ so it doesn't change the shape of the distribution. So is shifting the sample median to $1$ a necessity?
y^lambda ~ xor((y/median(y))^lambda - 1)/lambda ~ x, right? However, I guess that the effect (of usingy^lambdainstead of the full transformation) for tails ofycould be a lot more significant, wouldn't you agree? BTW I saw your excellent answer to this post the other day. A huge thank you for all the great work that you do! – Adam Bogdański Nov 14 '23 at 14:24