

   CCoommppuuttee DDiiaaggnnoossttiiccss ffoorr ``llssffiitt'' RReeggrreessssiioonn RReessuullttss

        ls.diag(ls.out)

   AArrgguummeennttss::

     ls.out: Typically the result of `lsfit()'

   DDeessccrriippttiioonn::

        Computes basic statistics, including standard errors,
        t- and p-values for the regression coefficients.

   VVaalluuee::

        A `list' with the following numeric components.

    std.dev: The standard deviation of the errors, an estimate
             of sigma.

        hat: diagonal entries h_{ii} of the hat matrix H

    std.res: standardized residuals

   stud.res: studentized residuals

      cooks: Cook's distances

      dfits: DFITS statistics

   correlation: correlation matrix

    std.err: standard errors of the regression coefficients

   cov.scaled: Scaled covariance matrix of the coefficients

   cov.unscaled: Unscaled covariance matrix of the coefficients

   RReeffeerreenncceess::

        Belsley, D. A., E. Kuh and R. E. Welsch (1980).
        Regression Diagnostics.  New York: Wiley.

   SSeeee AAllssoo::

        `hat' for the hat matrix diagonals, `ls.print',
        `lm.influence', `summary.lm', `anova'.

   EExxaammpplleess::

        ##-- Using the same data as the lm(.) example:
        lsD9 <- lsfit(x = as.numeric(gl(2, 10, 20)), y = weight)
        dlsD9 <- ls.diag(lsD9)
        str(dlsD9, give.attr=FALSE)
        abs(1 - sum(dlsD9$hat) / 2) < 10*.Machine$double.eps # sum(h.ii) = p
        plot(dlsD9$hat, dlsD9$stud.res, xlim=c(0,0.11))
        abline(h = 0, lty = 2, col = "lightgray")

        ##-- Using the same data as the lm(.) example:
        lsD9 <- lsfit(x = as.numeric(gl(2, 10, 20)), y = weight)
        dlsD9 <- ls.diag(lsD9)
        str(dlsD9, give.attr=FALSE)
        abs(1 - sum(dlsD9$hat) / 2) < 10*.Machine$double.eps # sum(h.ii) = p
        plot(dlsD9$hat, dlsD9$stud.res, xlim=c(0,0.11))
        abline(h = 0, lty = 2, col = "lightgray")

