a formula or fitted model object. Currently only lm and
aov objects are handled.
lambda
vector of values of lambda
– default (-2, 2) in steps of 0.1.
plotit
logical which controls whether the result should be plotted.
interp
logical which controls whether spline interpolation is
used. Default to TRUE if plotting with lambda of
length less than 100.
eps
Tolerance for lambda = 0; defaults to 0.02.
xlab
defaults to "lambda".
ylab
defaults to "log-Likelihood".
...
additional parameters to be used in the model fitting.
Value
A list of the lambda vector and the computed profile
log-likelihood vector, invisibly if the result is plotted.
Side Effects
If plotit = TRUE plots log-likelihood vslambda and
indicates a 95% confidence interval about the maximum observed value
of lambda. If interp = TRUE, spline interpolation is
used to give a smoother plot.
References
Box, G. E. P. and Cox, D. R. (1964)
An analysis of transformations (with discussion).
Journal of the Royal Statistical Society B, 26, 211–252.
Venables, W. N. and Ripley, B. D. (2002)
Modern Applied Statistics with S. Fourth edition. Springer.
Examples
boxcox(Volume ~ log(Height) + log(Girth), data = trees,
lambda = seq(-0.25, 0.25, length = 10))
boxcox(Days+1 ~ Eth*Sex*Age*Lrn, data = quine,
lambda = seq(-0.05, 0.45, len = 20))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MASS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MASS/boxcox.Rd_%03d_medium.png", width=480, height=480)
> ### Name: boxcox
> ### Title: Box-Cox Transformations for Linear Models
> ### Aliases: boxcox boxcox.default boxcox.formula boxcox.lm
> ### Keywords: regression models hplot
>
> ### ** Examples
>
> boxcox(Volume ~ log(Height) + log(Girth), data = trees,
+ lambda = seq(-0.25, 0.25, length = 10))
>
> boxcox(Days+1 ~ Eth*Sex*Age*Lrn, data = quine,
+ lambda = seq(-0.05, 0.45, len = 20))
>
>
>
>
>
> dev.off()
null device
1
>