Hi, I am trying to do Box-Cox transformation, but I am not sure how to do it correctly. Here is an example showing what I am trying:
# example from MASS require(MASS) boxcox(Days+1 ~ Eth*Sex*Age*Lrn, data = quine, lambda = seq(-0.05, 0.45, len = 20)) # Here is My attempt at getting the profile likelihood for the Box-Cox parameter lam <- seq(-0.05, 0.45, len = 20) dev <- rep(NA, length=20) for (i in 1:20) { a <- lam[i] ans <- glm(((Days+1)^a-1)/a ~ Eth*Sex*Age*Lrn, family=gaussian, data = quine) dev[i] <- ans$deviance } plot(lam, dev, type="b", xlab="lambda", ylab="deviance") I am trying to create the profile likelihood for the Box-Cox parameter, but obviously I am not getting it right. I am not sure that ans$deviance is the right thing to do. I would appreciate any guidance. Thanks & Best, Ravi [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.