Skip to content

Pearson corelation and p-value for matrix

3 messages · Liaw, Andy, Dren Scott, John Fox

#
Ah, yes, the "..." isn't likely to help here!  Also, it will 
only work correctly if there are no NA's, for example (or 
else the degree of freedom would be wrong).  

Best,
Andy
2 days later
#
Dear Dren,

Since cor(), on which Andy's solution is based, can compute pairwise-present
correlations, you could adapt his function -- you'll have to adjust the df
for each pair. Alternatively, you could probably save some time (programming
time + computer time) by just using my solution:
[1] 518.19   1.11 520.23     NA     NA

I know that time is money, but nine minutes (on my machine) probably won't
bankrupt anyone.

Regards,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
--------------------------------