Dear R-helpers, I would like to do a Spearman rank order test, and used the cor() function with the method "spearman". It gives me a number (correlation coefficient?) , but how can I get the p-value? Thank you for the help in advance! Regards, Anne-Katrin -- [[alternative HTML version deleted]]
On Thu, 2008-02-28 at 16:17 +0100, Anne-Katrin Link wrote:> Dear R-helpers, > > I would like to do a Spearman rank order test, and used the cor() function > with the method "spearman". > It gives me a number (correlation coefficient?) , but how can I get the > p-value? > Thank you for the help in advance!?cor.test HTH G> > Regards, > Anne-Katrin >-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
check function ?cor.test(). I hope it helps. Best, Dimitris ---- Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Anne-Katrin Link" <anne.link at gmx.de> To: <r-help at r-project.org> Sent: Thursday, February 28, 2008 4:17 PM Subject: [R] p-value in Spearman rank order> Dear R-helpers, > > I would like to do a Spearman rank order test, and used the cor() > function > with the method "spearman". > It gives me a number (correlation coefficient?) , but how can I get > the > p-value? > Thank you for the help in advance! > > Regards, > Anne-Katrin > > -- > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
On 2/28/08, Anne-Katrin Link <anne.link at gmx.de> wrote:> I would like to do a Spearman rank order test, and used the cor() function > with the method "spearman". > It gives me a number (correlation coefficient?) , but how can I get the > p-value?You're probably looking for rcorr() from Hmisc. It gives the correlation, missing values and p-values. Check [1] and [2] for examples and several explanations. There is also a nice plot [3]. Hope this is of help, Liviu [1] http://oit.utk.edu/scc/RforSAS&SPSSusers.pdf [2] http://www.statmethods.net/stats/correlations.html [3] http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=137
Has your question been answered yet? x=c(1,2,4,3,6,8) y=c(3,2,5,7,4,6) cor.test(x,y,method="spearman") ####And that's how you "extract" the p-value: cor.test(x,y,method="s")$p.value Cheers, Daniel -------------------------- Abstrakthelfer helfen wenig -------------------------- -----Urspr?ngliche Nachricht----- Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im Auftrag von Anne-Katrin Link Gesendet: Thursday, February 28, 2008 10:17 AM An: r-help at r-project.org Betreff: [R] p-value in Spearman rank order Dear R-helpers, I would like to do a Spearman rank order test, and used the cor() function with the method "spearman". It gives me a number (correlation coefficient?) , but how can I get the p-value? Thank you for the help in advance! Regards, Anne-Katrin -- [[alternative HTML version deleted]] ______________________________________________ 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.