[R] cross-correlation table with subscript or superscript to indicate significant differences
David Winsemius
dwinsemius at comcast.net
Thu May 5 19:45:19 CEST 2011
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
More information about the R-help
mailing list