Last chance! 50% off unlimited learning
Sale ends in
estimateTransform
computes members of families of transformations
indexed by one
parameter, the Box-Cox power family, or the Yeo and Johnson (2000) family, or
the
basic power family, interpreting zero power as logarithmic.
The family can be modified to have Jacobian one, or not, except for the basic
power family. Most users will use the function powerTransform
, which
is a front-end for this function.estimateTransform(X, Y, weights=NULL, family="bcPower", start=NULL,
method="L-BFGS-B", ...)
lm
.bcPower
for the Box-Cox power family and the most likely alternative is
yjPower
for the Yeo-optim
for the
maximization. The default "L-BFGS-B"
appears to work well.optim
function that does the maximization. Needed only if there are convergence problems.powerTransform
with componentsoptim
.optim
.optim
.powerTransform
.powerTransform
, testTransform
,
optim
.data(trees,package="MASS")
summary(out1 <- powerTransform(Volume~log(Height)+log(Girth),trees))
# multivariate transformation:
summary(out2 <- powerTransform(cbind(Volume,Height,Girth)~1,trees))
testTransform(out2,c(0,1,0))
# same transformations, but use lm objects
m1 <- lm(Volume~log(Height)+log(Girth),trees)
(out3 <- powerTransform(m1))
# update the lm model with the transformed response
update(m1,basicPower(out3$y,out3$roundlam)~.)
Run the code above in your browser using DataLab