\Header{lm.summaries}{Accessing Linear Model Fits}
\alias{anova.lm}{lm.summaries}
\methalias{anova.lm.null}{lm.summaries}
\alias{anovalist.lm}{lm.summaries}
\alias{coefficients.lm}{lm.summaries}
\alias{df.residual.lm}{lm.summaries}
\alias{family.lm}{lm.summaries}
\alias{fitted.values.lm}{lm.summaries}
\alias{formula.lm}{lm.summaries}
\alias{print.lm}{lm.summaries}
\methalias{print.lm.null}{lm.summaries}
\alias{print.summary.lm}{lm.summaries}
\methalias{print.summary.lm.null}{lm.summaries}
\alias{residuals.lm}{lm.summaries}
\alias{summary.lm}{lm.summaries}
\methalias{summary.lm.null}{lm.summaries}
\alias{summary.mlm}{lm.summaries}
\alias{weights}{lm.summaries}
\methalias{weights.default}{lm.summaries}
\methalias{weights.lm}{lm.summaries}
\keyword{regression}{lm.summaries}
\begin{Description}\relax
All these functions are \code{\Link{methods}} for class \code{lm} or
\code{summary.lm} and \code{anova.lm} objects.\end{Description}
\begin{Usage}
\begin{verbatim}
anova(object, ...)
anovalist.lm(object, ..., test = NULL)
summary(object, correlation = FALSE)
coefficients(object) ; coef(object)
df.residual(object)
family(object)
formula(object)
fitted.values(object)
residuals(object,
          type=c("working","response", "deviance","pearson", "partial"), ...)
weights(object)

print(summary.lm.obj, digits = max(3, getOption("digits") - 3),
      symbolic.cor = p > 4,
      signif.stars= getOption("show.signif.stars"), ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object, x}] an object of class \code{lm}, usually, a result of a
call to \code{\Link{lm}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{print.summary.lm} tries to be smart about formatting the
coefficients, standard errors, etc. and additionally gives
``significance stars'' if \code{signif.stars} is \code{TRUE}.

\code{anova.lm} produces an analysis of variance (\code{anova}) table.

The generic accessor functions \code{coefficients}, \code{effects},
\code{fitted.values} and \code{residuals} can be used to extract
various useful features of the value returned by \code{lm}.\end{Details}
\begin{Value}
The function \code{summary.lm} computes and returns a list of summary
statistics of the fitted linear model given in \code{lm.obj}, using
the components (list elements) \code{"call"} and \code{"terms"}
from its argument, plus
\begin{ldescription}
\item[\code{residuals}] the \emph{weighted} residuals, the usual residuals
rescaled by the square root of the weights specified in the call to
\code{lm}.
\item[\code{coefficients}] a \eqn{p \times 4}{p x 4} matrix with columns for
the estimated coefficient, its standard error, t-statistic and
corresponding (two-sided) p-value.
\item[\code{sigma}] the square root of the estimated variance of the random
error
\deqn{\hat\sigma^2 = \frac{1}{n-p}\sum_i{R_i^2},}{sigma^2 = 1/(n-p) Sum(R[i]^2),}
where \eqn{R_i}{R[i]} is the \eqn{i}{}-th residual, \code{residuals[i]}.
\item[\code{df}] degrees of freedom, a 3-vector \eqn{(p, n-p, p*)}{}.
\item[\code{fstatistic}] a 3-vector with the value of the F-statistic with
its numerator and denominator degrees of freedom.
\item[\code{r.squared}] \eqn{R^2}{}, the ``fraction of variance explained by
the model'',
\deqn{R^2 = 1 - \frac{\sum_i{R_i^2}}{\sum_i(y_i- y^*)^2},}{R^2 = 1 - Sum(R[i]^2) / Sum((y[i]- y*)^2),}
where \eqn{y^*}{y*} is the mean of \eqn{y_i}{y[i]} if there is an
intercept and zero otherwise.
\item[\code{adj.r.squared}] the above \eqn{R^2}{} statistic
\emph{``adjusted''}, penalizing for higher \eqn{p}{}.
\item[\code{cov.unscaled}] a \eqn{p \times p}{p x p} matrix of (unscaled)
covariances of the \eqn{\hat\beta_j}{coef[j]}, \eqn{j=1, \dots, p}{}.
\item[\code{correlation}] the correlation matrix corresponding to the above
\code{cov.unscaled}, if \code{correlation = TRUE} is specified.
\end{ldescription}
\end{Value}
\begin{Section}{Warning}
The comparison between two or more models by \code{anova} or
\code{anovalist.lm} will only be valid if they
are fitted to the same dataset. This may be a problem if there are
missing values and \R's default of \code{na.action = na.omit} is used.\end{Section}
\begin{SeeAlso}\relax
The model fitting function \code{\Link{lm}}.

\code{\Link{anova}} for the ANOVA table,
\code{\Link{coefficients}}, \code{\Link{deviance}},
\code{\Link{effects}}, \code{\Link{fitted.values}},
\code{\Link{glm}} for \bold{generalized} linear models,
\code{\Link{lm.influence}} for regression diagnostics,
\code{\Link{weighted.residuals}},
\code{\Link{residuals}}, \code{\Link{residuals.glm}},
\code{\Link{summary}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

##-- Continuing the  lm(.) example:
coef(lm.D90)# the bare coefficients
sld90 <- summary(lm.D90 <- lm(weight ~ group -1))# omitting intercept
sld90
coef(sld90)# much more

## The 2 basic regression diagnostic plots [plot.lm(.) is preferred]
plot(resid(lm.D90), fitted(lm.D90))# Tukey-Anscombe's
abline(h=0, lty=2, col = 'gray')

qqnorm(residuals(lm.D90))
\end{ExampleCode}
\end{Examples}

