.BG
.EQ
delim $$
.EN
.FN lsfit
.TL
Linear Least-Squares Fit
.CS
lsfit(x, y, wt, intercept=T, tolerance=1.e-07,
      yname=NULL)
.AG x
$X$ matrix for fitting $Y~=~Xb~+~e$ with variables in columns,
observations across rows.  Should not contain column of 1's,
(see argument `intercept').  Number of rows of `x' should equal
the number of rows of `y'.  There should be fewer
columns than rows.
.AG y
y vector (or matrix with one column for each regression).
.AG wt
vector of weights for weighted regression.  Should
have length equal to the number of rows of `y'.
If the different observations have non-equal variances, `wt' should
be inversely proportional to the variance.
By default, an unweighted regression is carried out.
.AG intercept
if `TRUE' a constant (intercept)
term is included in each regression.
.AG tolerance
numerical value used to test for singularity in the regression.
.AG yname
optional name to be used for the `y' variate in the regression output.
However, in the case that `y' is a matrix, its `dimnames' attribute
should have the desired (column) names.
.RT
a list representing the result of the regression, with the following
components:
.RC coef
matrix of coefficients with
one column for each regression and
(optional) constant terms in first row.
.RC residuals
object like `y' containing residuals.
.RC qr
object representing the numerical decomposition of the `x' matrix (plus a
column of `1's, if an intercept was included).
If `wt' was specified, the `qr' object will represent the decomposition
of the weighted `x' matrix.
See function `qr' for the details of this object.  It is used primarily with
functions like `qr.qty', that compute auxiliary results for the regression
from the decomposition.
.RC wt
if `wt' was given as an argument, it is also returned as part of the result.
.RC intercept
records whether an intercept was used in this regression.
.SA
Function `ls.summary' computes various summary statistics
when given the output of `lsfit'.
.EX
lsfit(cbind(a,b,c),y)    #regress y on a, b, and c with intercept
.KW array
.KW regression
.EQ
delim off
.EN
.WR
