form <- ~ boxcox.trans(gcsescore, p) | gender
という自分では使ったことのないコードがある.ただし,ここでの事例は,動作しないということで紹介されている.
10.1 ### p.166 \section{非標準評価}
boxcox.trans <- function(x, lambda) { if (lambda == 0) log(x) else (x^lambda - 1) / lambda } data(Chem97, package = "mlmRev") trellis.device(pdf, file = "Chem97BoxCox.pdf", width = 8, height = 6) for (p in seq(0, 3, by = 0.5)) { plot(qqmath(~boxcox.trans(gcsescore, p) | gender, data = Chem97, groups = score, f.value = ppoints(100), main = as.expression(substitute(lambda == v, list(v = p))))) } dev.off()
# 以下は動作しない
form <- ~ boxcox.trans(gcsescore, p) | gender qqboxcox <- function(lambda) { for (p in lambda) plot(qqmath(form, data = Chem97, groups = score, f.value = ppoints(100), main = as.expression(substitute(lambda == v, list(v = p))))) } qqboxcox(lambda = seq(0, 3, by = 0.5))