[R] Correlation matrix one side with significance

Henrique Dallazuanna wwwhsd at gmail.com
Thu Mar 6 20:17:26 CET 2008


Please provide a example of what you want

On 06/03/2008, Martin Kaffanke <technik at roomandspace.com> wrote:
>
>  Am Mittwoch, den 05.03.2008, 14:38 -0300 schrieb Henrique Dallazuanna:
>
> > Try this:
>  >
>  > On 05/03/2008, Martin Kaffanke <technik at roomandspace.com> wrote:
>  > > Hi there!
>  > >
>  > >  In my case,
>  > >
>  > >  cor(d[1:20])
>  > >
>  > >  makes me a good correlation matrix.
>  > >
>  > >  Now I'd like to have it one sided, means only the left bottom side to be
>  > >  printed (the others are the same) and I'd like to have * where the
>  > >  p-value is lower than 0.05 and ** lower than 0.01.
>  > >
>  > >  How can I do this?
>  >
>  > d <- matrix(rexp(16, 2), 4)
>  > corr <- cor(d)
>  > sign <- symnum(cor(d), cutpoints=c(0.05, 0.01), corr = T,
>  > symbols=c("***", "**", "*"), abbr=T, diag=F)
>  >
>  > noquote(mapply(function(x, y)paste(x, format(y, dig=3), sep=''),
>  > as.data.frame(unclass(sign)), as.data.frame(corr)))
>
>
> Seems that we mark the value itself, but not the p-value.
>
>  So lets say, in a way I have to get the lower left half of a
>
>  cor(el[1:20])
>
>  Then I need to calc all the values with a cor.test() to see for the
>  p-value.  And the p-value should be lower than .05 or .01 -> this should
>  make the * to the value.
>
>  Thanks,
>
> Martin
>
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list