Computes and optionally plots profile log-likelihoods for the parameter of the Box-Cox power transformation.
boxcox(object, ...)# S3 method for default
boxcox(object, lambda = seq(-2, 2, 1/10), plotit = TRUE,
interp, eps = 1/50, xlab = expression(lambda),
ylab = "log-Likelihood", ...)
# S3 method for formula
boxcox(object, lambda = seq(-2, 2, 1/10), plotit = TRUE,
interp, eps = 1/50, xlab = expression(lambda),
ylab = "log-Likelihood", ...)
# S3 method for lm
boxcox(object, lambda = seq(-2, 2, 1/10), plotit = TRUE,
interp, eps = 1/50, xlab = expression(lambda),
ylab = "log-Likelihood", ...)
A list of the lambda
vector and the computed profile
log-likelihood vector, invisibly if the result is plotted.
a formula or fitted model object. Currently only lm
and
aov
objects are handled.
vector of values of lambda
-- default
logical which controls whether the result should be plotted.
logical which controls whether spline interpolation is
used. Default to TRUE
if plotting with lambda
of
length less than 100.
Tolerance for lambda = 0
; defaults to 0.02.
defaults to "lambda"
.
defaults to "log-Likelihood"
.
additional parameters to be used in the model fitting.
If plotit = TRUE
plots log-likelihood vs lambda
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.
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.
boxcox(Volume ~ log(Height) + log(Girth), data = trees,
lambda = seq(-0.25, 0.25, length.out = 10))
boxcox(Days+1 ~ Eth*Sex*Age*Lrn, data = quine,
lambda = seq(-0.05, 0.45, length.out = 20))
Run the code above in your browser using DataLab