[R] Correlation Matrix - p value?

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Tue Aug 9 15:10:54 CEST 2011


Just pointing out that Jorge wrote 

cor.test

not cor. 

Don't know if you saw that but it should help. 

Michael Weylandt


On Aug 9, 2011, at 8:58 AM, ScottM <scott.mcgrane at abdn.ac.uk> wrote:

> Cheers Jorge,
> 
> I've tried this, but keep getting error messages, relating to either:
> 
> Error: unexpected '$' in "$"
> 
> or
> 
> Error in cor(data, method = "spearman")$p.value :
>  $ operator is invalid for atomic vectors
> 
> Very annoying!
> 
> S
> 
> Scott McGrane MA (Hons), MRes
> SAGES Theme 1 PhD Student
> Northern Rivers Institute
> St Mary's Building
> University of Aberdeen
> 
> http://www.abdn.ac.uk/nri
> ________________________________________
> From: Jorge Ivan Velez [via R] [ml-node+3729864-606556654-252737 at n4.nabble.com]
> Sent: 09 August 2011 01:55 PM
> To: Mcgrane, Scott
> Subject: Re: Correlation Matrix - p value?
> 
> ?cor.test
> cor.test(x, y, method = "spearman")$p.value
> 
> HTH,
> Jorge
> 
> 
> On Tue, Aug 9, 2011 at 8:44 AM, ScottM <> wrote:
> 
>> Hello all,
>> 
>> I've run a Spearman's Rank test to discern relationships between landscape
>> characteristics and a specific aspect of river behaviour.
>> 
>> I've executed a correlation matrix between the one dependent variable and
>> all of the predictors, which gives me a nice output of Spearman's Rho
>> values.
>> 
>> However, I also need to somehow find the "p" value, to assess the strength
>> of relationship.
>> 
>> Conducting a simple correlation between 2 variables using the:
>> 
>> cor(var1, var2, method="spearman")
>> 
>> command gives me an output with both the Rho and P value, but the default
>> output of the matrix is simply the Rho value.  I've tried using
>> summary(result), but it just produces the percentile/max/min values.
>> 
>> Any help appreciated.
>> 
>> Cheers,
>> 
>> S.
>> 
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Correlation-Matrix-p-value-tp3729838p3729838.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> [hidden email]</user/SendEmail.jtp?type=node&node=3729864&i=0> 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.
>> 
> 
>        [[alternative HTML version deleted]]
> 
> ______________________________________________
> [hidden email]</user/SendEmail.jtp?type=node&node=3729864&i=1> 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.
> 
> 
> ________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://r.789695.n4.nabble.com/Correlation-Matrix-p-value-tp3729838p3729864.html
> To unsubscribe from Correlation Matrix - p value?, click here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3729838&code=c2NvdHQubWNncmFuZUBhYmRuLmFjLnVrfDM3Mjk4Mzh8OTM1MjEwNDY5>.
> 
> 
> The University of Aberdeen is a charity registered in Scotland, No SC013683.
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Correlation-Matrix-p-value-tp3729838p3729868.html
> Sent from the R help mailing list archive at Nabble.com.
>    [[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.



More information about the R-help mailing list