[R] Printing correlation matrices (lm/glm)

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Fri Dec 20 11:19:02 CET 2002


Hi Andy!
Thanks for the reply. It gives the clue: in fact it should be

  print(summary(lm2, corr=TRUE), symbolic.cor=FALSE)

(not "symbolic.corr"). However, this raises a further mystery!

I had spent ages with "?" and "help.search" (e.g. "summary.lm",
"summaru.glm", "summary", "print", "symbolic", "corr" ... ) trying
to find something relevant, with no success. Following your mail, I
grepped right down /usr/lib/R, first for "symbolic.corr" (with no
success) and then for "symbolic", and finally found "symbolic.cor"
in a help file for "lm.summary" in package "base" (Also "glm.summary").

Now: "?lm.summary" fails to find anything, likewise "?glm.summary",
nor does "help.search("lm.summary")".

So I'm wondering what is going wrong here: Using R-1.6.1 of Nov 2002,
version for Red Hat 7.2 installed from the RPM package.

Thanks,
Ted.

On 20-Dec-02 Liaw, Andy wrote:
> Try print(summary(lm2, corr=TRUE), symbolic.corr=FALSE).  It *is* in
> the
> help page.
> 
> HTH,
> Andy
> 
>> From: Ted.Harding at nessie.mcc.ac.uk 
>> Subject: [R] Printing correlation matrices (lm/glm)
>> 
>> Hi Folks,
>> 
>> I'm analysing some data which, in its simplest aspect,
>> has 3 factors A, B, C each at 2 levels.
>> 
>> If I do
>> 
>>   lm1 <- lm(y ~ A*B)
>> 
>> say, and then
>> 
>>   summary(lm1, corr=T)
>> 
>> I get the correlation matrix of the estimated coeffcients
>> with numerical values for the correlations (3 coeffs in this
>> case). Likewise with 'glm' instead of 'lm'.
>> 
>> However, if I do
>> 
>>   lm2 <- lm(y ~ A*B*C)
>> 
>> and then
>> 
>>   summary(lm2, corr=T)
>> 
>> I get only symbols (such as ".", "+", "*") for the values,
>> denoting ranges, and not numbers (7 coefficients in this case).
>> 
>> Presumably this happens when the number of columns is considered
>> to be getting a bit large for numbers -- though 7 is not huge ...
>> 
>> Anyway, is there any way I can get the full correlation matrix
>> out with numbers instead of symbols, even with several coefficients?
>> 
>> With thanks,
>> Ted.
> 
> ------------------------------------------------------------------------
> ------
> Notice: This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA)
> that may be confidential, proprietary copyrighted and/or legally
> privileged, and is intended solely for the use of the individual or
> entity named on this message.  If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by e-mail and then delete it.
> 
> ========================================================================
> ======

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 20-Dec-02                                       Time: 09:52:34
------------------------------ XFMail ------------------------------




More information about the R-help mailing list