

   CChhoooossee aa mmooddeell bbyy AAIICC iinn aa SStteeppwwiissee AAllggoorriitthhmm

        stepAIC(object, scope, scale, direction=c("both", "backward", "forward"),
             trace=1, keep=NULL, steps=1000, screen=inherits(object, "glm"),
             use.start=F, k=2, ...)

   AArrgguummeennttss::

     object: an object representing a model of an appropriate
             class.  This is used as the initial model in the
             stepwise search.

      scope: defines the range of models examined in the step-
             wise search.

      scale: used in the definition of the AIC statistic for
             selecting the models, currently only for `lm',
             `aov' and `glm' models.

   direction: the mode of stepwise search, can be one of
             `"both"', `"backward"', or `"forward"', with a
             default of `"both"'.  If the `scope' argument is
             missing, the default for `direction' is `"back-
             ward"'.

      trace: if `TRUE', information is printed during the run-
             ning of `stepAIC()'.

       keep: a filter function whose input is a fitted model
             object and the associated `AIC' statistic, and
             whose output is arbitrary.  Typically `keep' will
             select a subset of the components of the object
             and return them. The default is not to keep any-
             thing.

      steps: the maximum number of steps to be considered.  The
             default is 1000 (essentially as many as required).
             It is typically used to stop the process early.

     screen: if true, uses score tests (local linearization) to
             exclude additions of terms.  Useful for models of
             class `glm'.  Use with care.

   use.start: if true the updated fits are done starting at the
             linear predictor for the currently selected model.
             This may speed up the iterative calculations for
             `glm' (and other fits), but it can also slow them
             down.

          k: the multiple of the number of degrees of freedom
             used for the penalty.  Only `k=2' gives the gen-
             uine AIC: `k = log(n)' is sometimes referred to as
             BIC or SBC.

        ...: any additional arguments to `extractAIC'.

   DDeessccrriippttiioonn::

        Performs stepwise model selection by exact AIC.

   VVaalluuee::

        the stepwise-selected model is returned, with up to two
        additional components.  There is an `"anova"' component
        corresponding to the steps taken in the search, as well
        as a `"keep"' component if the `keep=' argument was
        supplied in the call. The `"Resid. Dev"' column of the
        analysis of deviance table refers to a constant minus
        twice the maximized log likelihood: it will be a
        deviance only in cases where a saturated model is well-
        defined (thus excluding `lm', `aov' and `survreg' fits,
        for example).

   SSeeee AAllssoo::

        `step', `step.glm'

