SLID1 <- read.table("c:/temp/SLID-Ontario.txt",sep = "\t",header=F,skip=1) names(SLID1) <- c("age","sex","wages","yearsed") SLID1$male <- as.numeric(SLID1$sex == "Male") library(MASS) # plotting the log-likelihood function for the Box-Cox transformation # start with a broader range SLID1BC <- boxcox(wages ~ male +age +yearsed, data=SLID1, lambda = seq(-2.00, 2.00, length = 50)) # zoom in for a closer look SLID1BC <- boxcox(wages ~ male +age +yearsed, data=SLID1, lambda = seq(-.25, .25, length = 50)) # the function box.cox.var in the car package creates the constructed variable library(car) SLID1.lm1BC <- lm(wages ~ male +age +yearsed +box.cox.var(wages), data=SLID1) av.plots(SLID1.lm1BC,"box.cox.var(wages)")