Next: yates() Up: MacAnova Help File Previous: xrows()   Contents


xvariables(Model [, missing:val]), Model a CHARACTER scalar, val a REAL

Keywords: glm
xvariables(Model) returns the full design matrix (matrix of X-variables)
associated with Model, including a column for the intercept (constant
term), if any.  Model must be a scalar CHARACTER variable or quoted

See topic 'models' for information on specifying Model.

xvariables() (without a model) does the same except it uses the model
specified in STRMODEL which is usually the model used by the most recent
GLM (generalized linear or linear model) command such as regress(),
anova(), or poisson().

xvariables(Model, missing:val) and xvariables(missing:val), where val is
a REAL scalar, provides a value for cases with missing values.

Each variate in the model will appear as a column of the output.

Factors and interactions are translated to one or more "dummy" variables
with values 1, 0, or -1, or to products of dummy variables or of dummy
variables and variates.

Any row in which the dependent variable or any factor or variate is
MISSING is set entirely to 0, or, when 'missing:val' is an argument, to
val.  For example, xvariables(Model, missing:?)  or
xvariables(missing:?)  results in rows with missing data being set to
MISSING rather than to 0.

Note: When no model is specified and the previous command was regress(),
xvariables() does not compute dummy variables associated with any
factors in the model, but treats them as if they were variates.  Except
in this special case, the behavior of xvariables() differs sharply from
the behavior of modelvars() which retrieves factors and variates

When there are no factors in the model, a regression of the dependent
variable on the columns of xvariables()[,-1], that is, the result of
xvariables() excluding the constant column, should yield the same
coefficients as does coefs() after regress(Model) or anova(Model).

When there are factors in the model, the regression coefficients in such
a regression will differ from those produced by coefs() after
anova(Model), although the fitted values and residuals will be the same.
For example, following anova("y=a.x"), where a is a factor and x is a
variate, the coefficients from coefs("a.x") will be the slopes in a
model fitting separate lines for each level of a, but with a common
intercept.  This is not the parametrization implicit in a regression of
y on the columns of xvariables[,-1].

See also topics varnames(), modelvars(), modelinfo(), 'models'.

Gary Oehlert 2003-01-15