
#Boxcox finds lam such that y^lam1) - 1) / lam1 has smallest Residual SS

library(foreign)
library(MASS)

x <- read.spss("U:\\My Documents\\beck.sav")
x1 <- data.frame(x)
x1
attach(x1,2)
mse <- matrix(NA,60,1)
mse1 <- matrix(NA,60,1)

beck1 <- beck+1
m1 <- lm(beck1 ~ sex, data=x1)
bc <- boxcox(beck1 ~ sex)
(lambda <- bc$x[which.max(bc$y)])

