\HeaderA{lm.ridge}{Ridge Regression}{lm.ridge}
\aliasA{plot.ridgelm}{lm.ridge}{plot.ridgelm}
\aliasA{print.ridgelm}{lm.ridge}{print.ridgelm}
\aliasA{select}{lm.ridge}{select}
\methaliasA{select.ridgelm}{lm.ridge}{select.ridgelm}
\keyword{models}{lm.ridge}
\begin{Description}\relax
Fit a linear model by ridge regression.
\end{Description}
\begin{Usage}
\begin{verbatim}
lm.ridge(formula, data, subset, na.action, lambda = 0, model = FALSE,
         x = FALSE, y = FALSE, contrasts = NULL, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{formula}] a formula expression as for regression models, of the form
\code{response \textasciitilde{} predictors}. See the documentation of \code{formula}
for other details. \code{\LinkA{offset}{offset}} terms are allowed.

\item[\code{data}] an optional data frame in which to interpret the variables occurring
in \code{formula}.

\item[\code{subset}] expression saying which subset of the rows of the data should  be used
in the fit.  All observations are included by default.

\item[\code{na.action}] a function to filter missing data.

\item[\code{lambda}] A scalar or vector of ridge constants.

\item[\code{model}] should the model frame be returned?

\item[\code{x}] should the design matrix be returned?

\item[\code{y}] should the response be returned?

\item[\code{contrasts}] a list of contrasts to be used for some or all of factor terms in the
formula. See the \code{contrasts.arg} of \code{\LinkA{model.matrix.default}{model.matrix.default}}.

\item[\code{...}] additional arguments to \code{\LinkA{lm.fit}{lm.fit}}.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
If an intercept is present in the model, its coefficient is not
penalized.  (If you want to penalized an intercept, put in your own
constant term and remove the intercept.)
\end{Details}
\begin{Value}
A list with components

\begin{ldescription}
\item[\code{coef}] matrix of coefficients, one row for each value of \code{lambda}.
Note that these are not on the original scale and are for use by the
\code{\LinkA{coef}{coef}} method.

\item[\code{scales}] scalings used on the X matrix.

\item[\code{Inter}] was intercept included?

\item[\code{lambda}] vector of lambda values

\item[\code{ym}] mean of \code{y}

\item[\code{xm}] column means of \code{x} matrix

\item[\code{GCV}] vector of GCV values

\item[\code{kHKB}] HKB estimate of the ridge constant.

\item[\code{kLW}] L-W estimate of the ridge constant.

\end{ldescription}
\end{Value}
\begin{References}\relax
Brown, P. J. (1994)
\emph{Measurement, Regression and Calibration}
Oxford.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{lm}{lm}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(longley) # not the same as the S-PLUS dataset
names(longley)[1] <- "y"
lm.ridge(y ~ ., longley)
plot(lm.ridge(y ~ ., longley,
              lambda = seq(0,0.1,0.001)))
select(lm.ridge(y ~ ., longley,
               lambda = seq(0,0.1,0.0001)))
\end{ExampleCode}
\end{Examples}

