[R] summary.glm() print problem(?) with cor = TRUE

Martin Maechler maechler at stat.math.ethz.ch
Fri Feb 28 15:45:03 CET 2003


>>>>> "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