\Header{lm.fit}{Fitter Functions for Linear Models}
\methalias{lm.fit.null}{lm.fit}
\alias{lm.wfit}{lm.fit}
\methalias{lm.wfit.null}{lm.fit}
\keyword{regression}{lm.fit}
\keyword{array}{lm.fit}
\begin{Description}\relax
These are the basic computing engines called by \code{\Link{lm}} used
to fit linear models.  These should usually \emph{not} be used
directly unless by experienced users.\end{Description}
\begin{Usage}
\begin{verbatim}
lm.fit (x, y,    offset = NULL, method = "qr", tol = 1e-7, ...)
lm.wfit(x, y, w, offset = NULL, method = "qr", tol = 1e-7, ...)
lm.fit.null (x, y,    method = "qr", tol = 1e-7, ...)
lm.wfit.null(x, y, w, method = "qr", tol = 1e-7, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] design matrix of dimension \code{n * p}.
\item[\code{y}] vector of observations of length \code{n}.
\item[\code{w}] vector of weights (length \code{n}) to be used in the fitting
process for the \code{wfit} functions.  Weighted least squares is
used with weights \code{w}, i.e., \code{sum(w * e\textasciicircum{}2)} is minimized.
\item[\code{offset}] numeric of length \code{n}).  This can be used to
specify an \emph{a priori} known component to be included in the
linear predictor during fitting.
\item[\code{method}] currently, only \code{method="qr"} is supported.
\item[\code{tol}] tolerance for the \code{\Link{qr}} decomposition.  Default
is 1e-7.
\item[\code{...}] currently disregarded.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The functions \code{lm.\{w\}fit.null} are called by \code{lm.fit} or
\code{lm.wfit} respectively, when \code{x} has zero columns.\end{Details}
\begin{Value}
a list with components
\begin{ldescription}
\item[\code{coefficients}] \code{p} vector
\item[\code{residuals}] \code{n} vector
\item[\code{fitted.values}] \code{n} vector
\item[\code{effects}] \code{n} vector; \dots\dots
\item[\code{weights}] \code{n} vector --- \emph{only} for the \code{*wfit*}
functions.
\item[\code{rank}] integer, giving the rank
\item[\code{df.residual}] degrees of freedom of residuals
\item[\code{qr}] the QR decomposition, see \code{\Link{qr}}.
\end{ldescription}
\end{Value}
\begin{SeeAlso}\relax
\code{\Link{lm}} which you should use for linear least squares regression,
unless you know better.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
set.seed(129)
n <- 7 ; p <- 2
X <- matrix(rnorm(n * p), n,p) # no intercept!
y <- rnorm(n)
w <- rnorm(n)^2

str(lmw <- lm.wfit(x=X, y=y, w=w))

str(lm. <- lm.fit (x=X, y=y))

str(lm0 <-  lm.fit.null (x=X, y=y))
str(lmw0 <- lm.wfit.null(x=X, y=y,w=w))

\end{ExampleCode}
\end{Examples}

