

   FFiittttiinngg LLiinneeaarr MMooddeellss

        lm(formula, data = list(), subset, weights, na.action=na.omit,
           method="qr", model=TRUE, singular.ok = TRUE, ...)

        anova(lm.obj, ...)
        summary(lm.obj, correlation = FALSE)
        predict(lm.obj,newdata = model.frame(object), conf.level = 0.95,
                tol.level = conf.level)

        coefficients(lm.obj)
        deviance(lm.obj)
        df.residual(lm.obj)
        effects(lm.obj)
        fitted.values(lm.obj)
        residuals(lm.obj)
        weights(lm.obj)

        lm.fit(x, y, method = "qr", tol = 1e-7, ...)
        lm.wfit(x, y, w, method = "qr", tol = 1e-7, ...)

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

    formula: a symbolic description of the model to be fit.
             The details of model specification are given
             below.

       data: an optional data frame containing the variables in
             the model.  By default the variables are taken
             from the environment which `lm' is called from.

     subset: an optional vector specifying a subset of observa-
             tions to be used in the fitting process.

    weights: an optional vector of weights to be used in the
             fitting process.

   na.action: a function which indicates what should happen
             when the data contain `NA's.  The default action
             (`na.omit') is to omit any incomplete observa-
             tions.  The alternative action `na.fail' causes
             `lm' to print an error message and terminate if
             there are any incomplete observations.

      model: logical.  If `TRUE' (default), the model.frame is
             also returned.

   singular.ok: logical, defaulting to `TRUE'. `FALSE' is not
             yet implemented.

     lm.obj: an object of class `lm'.

     method: currently, only `method="qr"' is supported.

        tol: tolerance for `qr' decomposition.  Default is
             1e-7.

        ...: currently, disregarded.

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

        `lm' is used to fit linear models.  It can be used to
        carry out regression, single stratum analysis of vari-
        ance and analysis of covariance.

        Models for `lm' are specified symbolically.  A typical
        model has the form `reponse ~ terms' where `response'
        is the (numeric) response vector and `terms' is a
        series of terms which specifies a linear predictor for
        `response'.  A terms specification of the form
        `first+second' indicates all the terms in `first'
        together with all the terms in `second' with duplicates
        removed.  A specification of the form `first:second'
        indicates the the set of terms obtained by taking the
        interactions of all terms in `first' with all terms in
        `second'.  The specification `first*second' indicates
        the cross of `first' and `second'.  This is the same as
        `first+second+first:second'.

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

        `lm' returns an object of class `lm'.  The function
        `summary' can be used to obtain or print a summary of
        the results and the function `anova' and be used to
        produce and analysis of variance table.  The generic
        accessor functions `coefficients', `effects', `fit-
        ted.values' and `residuals' can be used to extract var-
        ious useful features of the value returned by `lm'.

        The function `predict' produces predicted values with
        confidence and prediction (tolerance) intervals in the
        form of a data frame with components `predictor',
        `conf.l', `conf.u', `pred.l', and `pred.u', obtained by
        evaluating the regression function in the frame `new-
        data', the arguments `conf.level' and `tol.level' con-
        trol the respective intervals.

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

        `anova' for the ANOVA table, `coefficients', `effects',
        `fitted.values', `glm' for generalized linear models,
        `lm.influence' for regression diagnostics, `residuals',
        `summary'.

   EExxaammpplleess::

        ## Annette Dobson (1990) "An Introduction to Statistical Modelling".
        ## Page 9: Plant Weight Data.
        ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
        trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
        group <- gl(2,10,20,labels=c("Ctl","Trt"))
        weight <- c(ctl,trt)
        anova(lm.D9 <- lm(weight~group))
        summary(lm.D90 <- lm(weight ~ group -1))# omitting intercept
        summary(resid(lm.D9) - resid(lm.D90)) #- residual are practically identical

        ## Predictions
        x<-rnorm(15)
        y<-x+rnorm(15)
        predict(lm(y~x))
        predict(lm(y~x),data.frame(x=seq(-3,3,0.1)),.99,.90)

