Learn R Programming

car (version 2.0-21)

estimateTransform: Finding Univariate or Multivariate Power Transformations

Description

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.

Usage

estimateTransform(X, Y, weights=NULL, family="bcPower", start=NULL,
         method="L-BFGS-B", ...)

Arguments

X
A matrix or data.frame giving the right-side variables.
Y
A vector or matrix or data.frame giving the left-side variables.
weights
Weights as in lm.
family
The transformation family to use. This is the quoted name of a function for computing the transformed values. The default is bcPower for the Box-Cox power family and the most likely alternative is yjPower for the Yeo-
start
Starting values for the computations. It is usually adequate to leave this at its default value of NULL.
method
The computing alogrithm used by optim for the maximization. The default "L-BFGS-B" appears to work well.
...
Additional arguments that are passed to the optim function that does the maximization. Needed only if there are convergence problems.

Value

  • An object of class powerTransform with components
  • valueThe value of the loglikelihood at the mle.
  • countsSee optim.
  • convergenceSee optim.
  • messageSee optim.
  • hessianThe hessian matrix.
  • startStarting values for the computations.
  • lambdaThe ml estimate
  • roundlamConvenient rounded values for the estimates. These rounded values will often be the desirable transformations.
  • familyThe transformation family
  • xqrQR decomposition of the predictor matrix.
  • yThe responses to be transformed
  • xThe predictors
  • weightsThe weights if weighted least squares.

Details

See the documentation for the function powerTransform.

References

Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. Journal of the Royal Statisistical Society, Series B. 26 211-46. Cook, R. D. and Weisberg, S. (1999) Applied Regression Including Computing and Graphics. Wiley. Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage. Velilla, S. (1993) A note on the multivariate Box-Cox transformation to normality. Statistics and Probability Letters, 17, 259-263. Weisberg, S. (2014) Applied Linear Regression, Fourth Edition, Wiley. Yeo, I. and Johnson, R. (2000) A new family of power transformations to improve normality or symmetry. Biometrika, 87, 954-959.

See Also

powerTransform, testTransform, optim.

Examples

Run this code
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