[R] lm() intercept at the end, rather than at the beginning
Greg.Snow at intermountainmail.org
Mon Apr 9 16:53:18 CEST 2007
Gabor has already showed you one way to make your own summary function
that does this. I want to address a different aspect of your question.
Your question implies that less interesting things belong at the bottom
of the summary output. On the other hand, when I was teaching full time
I tried to convince my students that the summary output for lm models
(and others) should be read from the bottom up (and to some degree from
right to left). After all, you really should not be looking at the
p-values for the individual coefficients until after you look at the
overall F-test p-value (at the very bottom), and you should not try to
interpret the coefficient values until you have looked at their standard
errors (and possibly p-values). Anything that I want to know about the
residuals I learn from the diagnostic plots, not the 5 number summary
that is at the top of the output (I am not arguing for that to go away,
others may find it more useful than I do, and I do occasionally look at
it, but it seems least important of the output). If your model includes
interactions and/or polynomial terms, then these should be looked at
before the main effects and linear terms (and the genererally are below
their corresponding main effects/linear terms). And looking at the
sequential test from the anova function when given only 1 model really
only makes sense reading from the bottom up.
So, if you think in those terms (and I like it staying that way, with a
scrolling computer screen, reading from the bottom up is quicker and
easier), then having the uninteresting intercept at the top of the list
of the coefficients is the best place for it.
Just a couple of thougts,
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at intermountainmail.org
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Dimitri Szerman
> Sent: Thursday, April 05, 2007 6:34 PM
> To: R-Help
> Subject: [R] lm() intercept at the end, rather than at the beginning
> I wonder if someone has already figured out a way of making
> summary(mylm) # where mylm is an object of the class lm()
> to print the "(Intercept)" at the last line, rather than the
> first line of the output. I don't know about, say,
> biostatistics, but in economics the intercept is usually the
> least interesting of the parameters of a regression model.
> That's why, say, Stata prints by default the intercept at the
> end. Just a suggestion for R-developers...
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help