.BG
.VE $Header: /usr/s/current/s/.help/RCS/reg,v 1.5 87/01/15 19:39:10 rab Exp $
.FN reg
.TL
reg: Regression
.CS
reg(x, y, wt, int, print, names, ynames, q, correlation)
.PP
.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 `int').  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.
Zero weights do not have the same effect as
observations deleted from `x' and `y';
an observation with zero weight is counted in the degrees of freedom.
.AG int
flag, if TRUE (the default) a constant (intercept)
term is included in each regression.
.AG print
flag, if TRUE (the default for `regress',
FALSE is the default for `reg'), the regression results are
given to `regprt' for printing.
.AG names
optional character vector giving the names of the variables
in the matrix `x'.  By default, names are "x1", "x2", etc.
.AG ynames
optional character vector giving the names of the columns
of the matrix `y'.
By default, names are "y1", "y2", etc.
.AG q
logical flag, if TRUE, the  `q' matrix from an orthogonal decomposition of
`x' is returned.  Default FALSE.
.AG correlation
logical flag.  If `print' is TRUE,
`correlation' determines whether or not the
correlation and covariance matrices are printed.
Default TRUE.
.RT
structure with the following components:
.PP
.RC coef
matrix of coefficients with 
one column for each regression and
(optional) constant terms in first row.
.RC resid
structure like `y' containing residuals.
.RC r,corth
components of orthogonal decomposition of `x' matrix.
.RC names
names of x variables (for later use by `regprt').
.RC ynames
names of y variables (for later use by `regprt').
.RC int
records whether intercept was used in this regression.
.RC q
matrix from orthogonal decomposition if `q' argument was
TRUE.
.RC sqrtw
vector of the square-roots of the input vector `wt' (only if
`wt' was given).
.EX
reg(cbind(a,b,c),y)    #regress y on a, b, and c with intercept
.KW array*
.KW regression
.WR
