\Header{boxcox}{Box-Cox Transformations for Linear Models}
\methalias{boxcox.default}{boxcox}
\methalias{boxcox.formula}{boxcox}
\methalias{boxcox.lm}{boxcox}
\keyword{regression}{boxcox}
\keyword{models}{boxcox}
\keyword{hplot}{boxcox}
\begin{Description}\relax
Computes and optionally plots profile log-likelihoods for the
parameter of the Box-Cox simple power transformation \code{y\textasciicircum{}lambda}.\end{Description}
\begin{Usage}
\begin{verbatim}
boxcox(object, ...)

## Default S3 method:
boxcox(object, lambda = seq(-2, 2, 1/10), plotit = TRUE,
       interp, eps = 1/50, xlab = "lambda", ylab = "log-Likelihood", ...)

## S3 method for class 'formula':
boxcox(object, lambda = seq(-2, 2, 1/10), plotit = TRUE,
       interp, eps = 1/50, xlab = "lambda", ylab = "log-Likelihood", ...)

## S3 method for class 'lm':
boxcox(object, lambda = seq(-2, 2, 1/10), plotit = TRUE,
       interp, eps = 1/50, xlab = "lambda", ylab = "log-Likelihood", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] a formula or fitted model object.  Currently only \code{lm} and \code{aov} objects
are handled.

\item[\code{lambda}] vector of values of \code{lambda} -- default \eqn{(-2, 2)}{} in steps of 0.1

\item[\code{plotit}] logical which controls whether the result should be plotted.

\item[\code{interp}] logical which controls whether spline interpolation is used.
Default to \code{true} if plotting with \code{lambda} of length less than 100.

\item[\code{eps}] Tolerance for \code{lambda = 0}; defaults to 0.02

\item[\code{xlab}] defaults to \code{"lambda"}

\item[\code{ylab}] defaults to \code{"log-Likelihood"}

\item[\code{...}] additional parameters to be used in the model fitting.

\end{ldescription}
\end{Arguments}
\begin{Value}
A list of the \code{lambda} vector and the computed profile
log-likelihood vector, invisibly if the result is plotted.\end{Value}
\begin{Section}{Side Effects}
If \code{plotit = TRUE} plots loglik \emph{vs} \code{lambda} and indicates a 95\%
confidence interval about the maximum observed value of \code{lambda}. If
\code{interp = TRUE}, spline interpolation is used to give a smoother plot.\end{Section}
\begin{References}\relax
Venables, W. N. and Ripley, B. D. (2002)
\emph{Modern Applied Statistics with S.} Fourth edition.  Springer.\end{References}
\begin{Examples}
\begin{ExampleCode}
data(trees)
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))
\end{ExampleCode}
\end{Examples}

