Next: regresshelp() Up: MacAnova Help File Previous: regpred()   Contents

regress()

Usage:
regress([Model] [,print:F or silent:T,pvals:T,coefs:F,marginal:T])



Keywords: glm, regression
regress(Model) performs a least squares fit of the regression model
given in the quoted string or CHARACTER variable Model.  It prints out
the regression coefficients, their standard errors, and t statistics,
plus other summary statistics (see below).  If option 'pvals' is True,
regress() also prints P values for each coefficient based on Student's t
distribution.  See subtopic 'options:"pvals"'.

No ANOVA table is printed by regress().  To see one, type 'anova()' as
the next GLM command after regress().

Examples (y, x, x1, x2, and x3 all REAL vectors of length 10):
   regress("y = x")                 Simple linear regression of y on x
   regress("y = x - 1")             Linear regression through origin of
                                    y on x
   regress("y = {run(10)}")         Simple linear regression of y on
                                    vector(1,2,3,4,5,6,7,8,9,10)
   regress("y = x1 + x2 + x3")      3 variable multiple regression of y
                                    on x1, x2 and x3
   regress("{sqrt(y)} = x + {x^2}") Quadratic polynomial regression of
                                    sqrt(y) on x
   regress("{sqrt(y)} = P2(x)")     Same as preceding.

regress(Model,weights:Wts) performs a weighted least squares fit, using
REAL vector Wts as case weights. The elements of Wts must not be
negative.  The results are what you would get by multiplying by
sqrt(Wts) the response vector and all independent variables, including
the contant vector, and then doing a least squares fit.

Model is of the form "Response = Var1 + Var2 + ... + Vark", where
Response, Var1, ..., Vark are either variable names or have the form
{expr}, where expr is a MacAnova expression.  All variables or evaluated
expressions must be REAL with the same number of rows.  The variables to
the right of '=' must be vectors or n by 1 matrices.  If any right hand
side variable is actually a factor, it is treated as a quantitative
variate whose values are the levels of the factor.  The associated sum
of squares has only 1 degree of freedom regardless of the number of
levels of the factor.

You specify regression through the origin by including "-1" in the
model.  See also topic 'models'.

regress() or regress(,weights:Wts) with no model specified computes a
least squares regression using the same model as was used by the most
recent GLM command such as regress(), anova(), or poisson().  See topic
'glm'.

Other printed output from regress() includes multiple R-squared, the
overall F-statistic for the model excluding the constant term, the mean
squared error and the Durbin Watson statistic.

regress() computes side effect variables RESIDUALS, HII, SS, DF,
DEPVNAME, TERMNAMES, STRMODEL, COEF, and XTXINV.  When weights are used,
RESIDUALS = response - fit and WTDRESIDUALS = sqrt(Wts)*RESIDUALS is an
additional side effect variable.  When an independent variable is of the
form {expr}, the corresponding element of TERMNAMES is "{expr}".  See
topic 'glm'.

You can retrieve coefficients and/or their standard errors using coefs()
or secoefs().

                          Other Keywords
Keyword phrase  Default  Meaning
  print:F          T     Suppress all output except warning and error
                         messages.  Side effect variables are set.

  silent:T         F     Suppress all output except error messages.
                         Side effect variables are set.

  pvals:T          F     Print P values.  Default is T when option pvals
                         is T (see subtopic 'options:"pvals"')

  marginal:T       F     Specifies that the elements of the side effect
                         variable SS are computed marginally. When none
                         of the X-variables are aliased, the computed SS
                         are equivalent to SAS Type III SS.  See topic
                         'glm' for details.  SS will be printed by
                         anova() with no intervening GLM command.

Keyword phrase 'coefs:F' is not legal with regress().

See also anova().


Gary Oehlert 2003-01-15