[R] summary.glm() print problem(?) with cor = TRUE
Gavin Simpson
gavin.simpson at ucl.ac.uk
Fri Feb 28 18:47:04 CET 2003
Dear Martin,
Thanks for explaining this.
One thing that might be considered IMHO could be to replace the named column
heads (or both column and row head if so desired) with a number
corresponding to the position of the term in the printed table.
1 2 3 4
pH * 1
I(pH^2) * B 1
Ca . . 1
I(Ca^2) . . B
or even
1 2 3 4
1 * 1
2 * B 1
3 . . 1
4 . . B
That keeps the property of square formatting of the table, well almost.
Then a line under the correlation table explaining the 1, 2, 3, etc. as well
and the legend for the symbolic characters.
Also printing the legend attribute as it is presented for the regression
terms (i.e. without attr(,"legend") and [1]) would also improve the look of
the thing.
All the best,
Gavin
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpson at ucl.ac.uk
UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/
London. WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
-----Original Message-----
From: Martin Maechler [mailto:maechler at stat.math.ethz.ch]
Sent: 28 February 2003 14:44
To: gavin.simpson
Cc: 'r-help'
Subject: Re: [R] summary.glm() print problem(?) with cor = TRUE
>>>>> "GS" == Gavin Simpson <gavin.simpson at ucl.ac.uk>
>>>>> on Fri, 28 Feb 2003 13:07:55 -0000 writes:
GS> Hi,
GS> I've had a look the bug list and searched though the R
documentation, email
GS> lists etc. but didn't see anything on this:
GS> when I do:
GS> summary(species.glm1, correlation = TRUE)
GS> I get a correlation matrix like this:
GS> Correlation of Coefficients:
GS> ( p I(H C
GS> pH * 1
GS> I(pH^2) * B 1
GS> Ca . . 1
GS> I(Ca^2) . . B
GS> attr(,"legend")
GS> [1] 0 ` ' 0.3 `.' 0.6 `,' 0.8 `+' 0.9 `*' 0.95 `B' 1
GS> I'm not worried about the symbolic representation, but
GS> should the columns be labelled this way? I can work out
GS> which is which, but it isn't immediately clear and
GS> doesn't look "nice". Is this printing intended?
[we are talking about the print method for class "summary.lm",
i.e. print.summary.glm() , and *.*.lm() ]
Yes, these column labels have been critized before and rightly so.
Currently, for R-devel, the default has even been changed from
`symbolic.cor = p > 4' to `symbolic.cor = FALSE' -- mostly
because of this, AFAIR -- and against my own opinion.
I would have voted to change it to `symbolic.cor = p > 6' or so
(*and* to improve the column labels, too, see below).
As the original implementor I can tell you:
I've liked the idea of graphical correlation matrices which
motivated the "symbolic.cor" option to print.summary.* and the
underlying symnum() function.
Since this is ASCII graphic, and showing (the lower triangle of)
a square matrix, I've felt the matrix should remain close to
``square'', also in its graphical form.
Hence, the row labels were kept and the column labels
abbreviated "as much as possible" using R's internal abbreviate().
And this has given the very ugly "(" for "(Intercept)".
One easy possibility was to use more customized version of abbreviate()
either inside symnum() or by postprocessing ..
Given the topic, I'm really interested about your opinions on
the symbolic printing of correlation matrices.
GS> Because when I do:
GS> print(summary(species.glm3, correlation = TRUE), symbolic.cor =
FALSE)
GS> I get a much more nicely formatted correlation matrix:
GS> Correlation of Coefficients:
GS> (Intercept) pH I(pH^2) Ca
GS> pH -0.9321
GS> I(pH^2) 0.9233 -0.9968
GS> Ca 0.1442 -0.4893 0.4950
GS> I(Ca^2) -0.1619 0.5009 -0.5162 -0.9876
It nicer only as long as it stays small, IMHO.
no longer for a 10 x 10 case; look at the examples in
help(symnum) !
Note that you can always say
sglm <- summary(species.glm3, correlation = TRUE)
sglm$corr
to see the matrix in its usual form
Martin Maechler <maechler at stat.math.ethz.ch>
http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
More information about the R-help
mailing list