Re: [R] cross-correlation table with subscript or superscript to indicate significant differences

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Thu, 05 May 2011 13:45:19 -0400

On May 5, 2011, at 12:40 PM, yoav baranan wrote:

> Here is an example for my earlier question.
>
> Say you have a 3x3 correlation matrix:
> corrs <- matrix(c(0.25,0.32,0.66,0.14,0.24,0.34,0.44,0.34,0.11),
> nrow=3, ncol=3, dimnames = list(c('varA','varB', 'varC'),
> c('varA','varB', 'varC')))
> And another matrix for the sample size of each correlation:
> sizes <- matrix(c(44,68,313,142,144,207,201,100,99), nrow=3, ncol=3,
> dimnames = list(c('varA','varB', 'varC'), c('varA','varB', 'varC')))
>
> corrs looks like this:
> varA varB varC
> varA 0.05 0.14 0.44
> varB 0.32 0.24 0.34
> varC 0.66 0.57 0.50
>
> sizes:
> varA varB varC
> varA 44 142 201
> varB 68 144 100
> varC 313 207 99
>
> i.e., the correlation between variables A and C was 0.66 with sample
> size of 313. (I got these tables from rcorr).

Why not offer the result of dput() on the result from rcorrs cone on 3 variables. Then we should have the necessary building blocks for your original request. This way we do not have the matrix of p-values.

And as the Posting Guide clearly says ...Please post in plain text. In your case it is particularly annoying because I do not get the filtered version but rather you html version and the text is almost unreadable at a font size of 10 in whatever font it is specifying!

>
> What I want to do is to compare the correlations in each row
> (probably using r.test), and then create a correlation table with
> subscripts or superscripts indicating the significance
> "group" (again: correlations with different superscripts, in the
> same row, are significantly different from each other).
> Something like this:
> varA varB varC
> varA 0.05b 0.14b 0.44a
> varB 0.32a 0.24a 0.34a
> varC 0.66a 0.57ab 0.50b

At the moment we have no way of determining what values should be post- pended with which letters.

>
> Of course, I don't have a 3x3 table. I have about 20 tables of at
> least 7x7 each, so this is why I'm looking for methods to automate
> the process.
>
> Thanks,
> Yoav
>
> > CC: r-help_at_r-project.org
> > From: dwinsemius_at_comcast.net
> > To: ybaranan_at_hotmail.com
> > Subject: Re: [R] cross-correlation table with subscript or
> superscript to indicate significant differences
> > Date: Thu, 5 May 2011 12:17:25 -0400
> >
> >
> > On May 5, 2011, at 10:48 AM, yoav baranan wrote:
> >
> > >
> > > Hi, I wonder whether the following is possible with R, and whether
> > > anyone has done that and can share his/her code with me. I have a
> > > correlation matrix, and I want to create a correlation table
> that I
> > > can copy to Microsoft Word with a superscript above each
> > > correlation, indicating significant differences in the same row.
> > > That is, when correlations in the same row do not share
> superscript,
> > > it means that they are significantly different from each other.
> > > thanks,yoav
> > > [[alternative HTML version deleted]]
> >
> > An example with data and the desired result might help focus the
> > discussion.
> >
> > This shows how to set up an example showing how extract the row
> > numbers from a correlation matrix with absolute values above 0.5 but
> > less than 1 (to exclude the trivial cases).
> >
snipped
> >

David Winsemius, MD
West Hartford, CT



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 05 May 2011 - 17:56:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 May 2011 - 18:00:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive