Computes and optionally plots profile loglikelihoods for the parameter of the
BoxCox power family, the YeoJohnson power family, or for either of the parameters in a skew power family. This is a slight generalization of the
boxcox
function in the MASS package that allows for families of transformations
other than the BoxCox power family.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  boxCox(object, ...)
## Default S3 method:
boxCox(object,
lambda = seq(2, 2, 1/10), plotit = TRUE,
interp = plotit, eps = 1/50,
xlab=NULL, ylab=NULL,
family="bcPower",
param=c("lambda", "gamma"), gamma=NULL,
grid=TRUE, ...)
## S3 method for class 'formula'
boxCox(object, lambda = seq(2, 2, 1/10), plotit = TRUE, ...)
## S3 method for class 'lm'
boxCox(object, lambda = seq(2, 2, 1/10), plotit = TRUE, ...)
## S3 method for class 'lmerMod'
boxCox(object,
lambda = seq(2, 2, 1/10), plotit = TRUE, interp = plotit, eps = 1/50,
xlab=NULL, ylab=NULL, family="bcPower",
param=c("lambda", "gamma"), gamma=NULL, grid=TRUE, ...)

object 
a formula or fitted model object of class 
lambda 
vector of values of lambda, with default (2, 2) in steps of 0.1, where the profile loglikelihood will be evaluated. 
plotit 
logical which controls whether the result should be plotted; default 
interp 
logical which controls whether spline interpolation is used. Default to

eps 
Tolerance for lambda = 0; defaults to 0.02. 
xlab 
defaults to 
ylab 
defaults to 
family 
Defaults to 
param 
Relevant only to 
gamma 
For use when the 
grid 
If TRUE, the default, a lightgray background grid is put on the graph. 
... 
passes arguments from methods to the default, or from the default to 
This routine is an elaboration of the boxcox
function in the
MASS package. The first 7 arguments are the same as in boxcox
, and if the argument family="bcPower"
is used, the result is essentially identical to the function in MASS. Two additional families are the yjPower
and skewPower
families that allow a few values of the response to be nonpositive.
The skew power family has two parameters: a power lambda and a start or location parameter gamma, and this function can be used to obtain a profile loglikelihood for either parameter with lambda as the default.
A list of the lambda (or possibly, gamma) vector and the computed profile loglikelihood vector,
invisibly if the result is plotted. If plotit=TRUE
plots loglikelihood vs
lambda and indicates a 95
lambda. If interp=TRUE
, spline interpolation is used to give a smoother plot.
Sanford Weisberg, <sandy@umn.edu>
Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. Journal of the Royal Statisistical Society, Series B. 26 21146.
Cook, R. D. and Weisberg, S. (1999) Applied Regression Including Computing and Graphics. Wiley.
Fox, J. (2008) Applied Regression Analysis and Generalized Linear Models, Second Edition. Sage.
Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage.
Hawkins, D. and Weisberg, S. (2015) Combining the BoxCox Power and Genralized Log Transformations to Accomodate Negative Responses, submitted for publication.
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, 954959.
boxcox
, yjPower
, bcPower
, skewPower
,
powerTransform
1 2 3 4 5 6 
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.