summary
method for class "lm"
.# S3 method for lm
summary(object, correlation = FALSE, symbolic.cor = FALSE, …)# S3 method for summary.lm
print(x, digits = max(3, getOption("digits") - 3),
symbolic.cor = x$symbolic.cor,
signif.stars = getOption("show.signif.stars"), …)
"lm"
, usually, a result of a
call to lm
."summary.lm"
, usually, a result of a
call to summary.lm
.TRUE
, the correlation matrix of
the estimated parameters is returned and printed.TRUE
, print the correlations in
a symbolic form (see symnum
) rather than as numbers.TRUE
, ‘significance stars’
are printed for each coefficient.summary.lm
computes and returns a list of summary
statistics of the fitted linear model given in object
, using
the components (list elements) "call"
and "terms"
from its argument, plus
lm
.residuals[i]
.cov.unscaled
, if correlation = TRUE
is specified.correlation
is true.) The value
of the argument symbolic.cor
.object
, if present there.print.summary.lm
tries to be smart about formatting the
coefficients, standard errors, etc. and additionally gives
‘significance stars’ if signif.stars
is TRUE
. Aliased coefficients are omitted in the returned object but restored
by the print
method. Correlations are printed to two decimal places (or symbolically): to
see the actual correlations print summary(object)$correlation
directly.lm
, summary
. Function coef
will extract the matrix of coefficients
with standard errors, t-statistics and p-values.
##-- 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
## model with *aliased* coefficient:
lm.D9. <- lm(weight ~ group + I(group != "Ctl"))
Sm.D9. <- summary(lm.D9.)
Sm.D9. # shows the NA NA NA NA line
stopifnot(length(cc <- coef(lm.D9.)) == 3, is.na(cc[3]),
dim(coef(Sm.D9.)) == c(2,4), Sm.D9.$df == c(2, 18, 3))
Run the code above in your browser using DataLab