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? And another thing: Is there a way to output that table as a latex table? Thanks, Martin -- Ihr Partner f?r Webdesign, Webapplikationen und Webspace. http://www.roomandspace.com/ Martin Kaffanke +43 650 4514224 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Dies ist ein digital signierter Nachrichtenteil Url : https://stat.ethz.ch/pipermail/r-help/attachments/20080305/76b53b70/attachment.bin
Henrique Dallazuanna
2008-Mar-05 17:38 UTC
[R] Correlation matrix one side with significance
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)))> And another thing: Is there a way to output that table as a latex table?See ?latex function in Hmisc package and also xtable package> Thanks, > Martin > > > -- > Ihr Partner f?r Webdesign, Webapplikationen und Webspace. > http://www.roomandspace.com/ > Martin Kaffanke +43 650 4514224 > > ______________________________________________ > 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. > > >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
On 3/5/08, Martin Kaffanke <technik at roomandspace.com> wrote:> 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.Look here [1], at "Visualizing Correlations". You might find interesting the example of a plotted correlation matrix. Liviu [1] http://www.statmethods.net/stats/correlations.html