[R] Find the cutoff correlation value for Pearson correlation test

David Carlson dcarlson at tamu.edu
Fri Nov 15 17:03:55 CET 2013


I should have added, that these limits are not been corrected
for multiple comparisons. With 1000 tests, we expect about 50 to
be outside the limits. So you might want to use p.adjust() to
take multiple comparisons into account.

David

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of David Carlson
Sent: Friday, November 15, 2013 9:42 AM
To: 'Jim Lemon'; 'jpm miao'
Cc: 'r-help'
Subject: Re: [R] Find the cutoff correlation value for Pearson
correlation test

I haven't looked at fBasics::correlationTest, but cor.test uses
the t distribution to evaluate significance:

t = sqrt(df) * r/sqrt(1 - r^2)

where df=n-2

If you solve that for r, you get

r = t/sqrt(t^2+100-2)

If you choose t as qt(.975, df) for a two-tailed test at p<.05
you can plug in t and place your limits at +/- of that value. Eg
for 100 observations:

> t <- qt(.975, 98)
> t
[1] 1.984467
> rlim <- t/sqrt(t^2+100-2)
> rlim
[1] 0.1965512
> rs <- replicate(1000, cor(rnorm(100), rnorm(100)))
> hist(rs)
> abline(v=c(-rlim, rlim))

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Jim Lemon
Sent: Thursday, November 14, 2013 9:44 PM
To: jpm miao
Cc: r-help
Subject: Re: [R] Find the cutoff correlation value for Pearson
correlation test

On 11/15/2013 12:53 PM, jpm miao wrote:
> Hi,
>
>     I find a few Pearson correlation test functions like
>
>     fBasics::correlationTest or stats::cor.test
>
> which give the p-value of the test result. Is there a function
that
> calculate the cutoff correlation value for a specific p-value
, e.g., p =
> 0.05?
>
> I have a plot for the cross correlations between two time
series, and I
> would like to add a horizontal line that marks the
significance of the
> correlations.

Hi Miao,
Perhaps you could use the confidence interval.

Jim

______________________________________________
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.

______________________________________________
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