Next: dastepstatus() Up: Multivariate Macros Help File Previous: dastepsetup()   Contents

# _DASTEPSTATE

Keywords: classification, discrimination, stepwise
```_DASTEPSTATE is an invisible variable which encapsulates the current
state of a process of stepwise response variable selection for a
multivariate linear model.  The model is most commonly of the form "y =
groups", groups a factor, and the stepwise process corresponds to
stepwise linear discriminant analysis.  You normally don't need to be
concerned with _DASTEPSTATE itself, since all interaction with it can
be done using macros.

In the following, p = number of variables, E = p by p error matrix from
manova() and H = p by p hypothesis matrix.  For a model of the form "y
= groups", H = matrix(SS[2,,]) and E = matrix(SS[3,,]).  H excludes
contributions from a constant term.  See topic 'models'

At a particular stage there are from 0 to p "in" variables, variables
tentatively considered important in rejecting the null hypothesis H0
associated with H; the remainder are "out" and either have not yet been
considered or are tentatively considered unimportant in rejecting H0.

At each stage there is an F-to-enter statistics for each "out"
variable, if any.  This is the F-statistic in an analysis of covariance
of the variable with the "in" variables as covariates.  When no
variables are "in", this is just the usual ANOVA F-statistic for the
variable.

Similarly, at each stage, there is an F-to-remove statistic for each
"in" variable, if any.  This is the F-to-enter statistic for the
variable that would be computed if it were to be removed and turned
into an "out" variable.

_DASTEPSTATUS has the form
structure(model:glmModel, hpluse:(H+E)swept, e:Eswept, in:ins,\
F:F_stats, fh:hypDF, fe:errDF, history:hist)

glmModel      CHARACTER scalar specifying a GLM model, usually of the
form "y = groups", groups a factor
ins           LOGICAL vector of length p with ins[j] = T when variable
j is "in"
(H+E)swept    H+E when no variables are "in"; swp(H+E,run(p)[ins]),
otherwise;  that is any "in" variables have been swept
Eswept        E when no variables are "in"; swp(E,run(p)[ins])
otherwise
F_statistics  A REAL vector of F-statistics, with F[ins] being values
of F-to-remove and F[!ins] being values of F-to-enter
hypDF         Numerator d.f. of F-to-enter and F-to-remove = fh, the
degrees of freedom associated with H
errDF         Denominator d.f of F_statistics = fe - k - 1 for "in"
and fe - k otherwise, where fe are the error d.f. and
k = sum(ins) = number of "in variables"
hist          An integer vector summarizing the path followed to
reach the current state.  when hist[i] = j > 0, variable
j was entered at step i; when hist[i] = -j < 0, variable
j was removed at step i.

You normally use macro dastepsetup() to initialize _DASTEPSTATUS.
dastepsetup() uses manova() to find E, H, fh and fe.  When variables j1,
j2, ... jk are specified as being "in", hist is initialized to
vector(j1,...,jk); when no variables are "in" at the start, hist is
NULL.  dastepsetup() calls stepstatus to compute component 'F' and
optionally report on the initial status.

You use macros daentervar() and daremovevar() to update _DASTEPSTATUS by
changing an "out" variable to an "in" or vice versa.  These optionally
print a report of the new status.

You use macro dastepstatus() to compute component F and optionally print
a report of the information in _DASTEPSTATUS.

You use macro dasteplook() to extract components of _DASTEPSTATUS
without changing it.

Macros daentervar(), daremovevar(), dastepsetup() and dasetupstatus()
return the new value of _DASTEPSTATUS as an "invisible" result which can
be assigned but is not printed.