-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Dear STITCHIT-Team,
In the Test for p-values
using the vectors
Line 15 in 641dc07
| v1 = {1,2,3,4,5}; |
and
Line 20 in 641dc07
| v6 = {1,2,4,3,5}; |
the p-value is assumed to be 0.01866973
Lines 310 to 314 in 641dc07
| TEST_F(CORCOMPTest, pValueTest1){ | |
| CorComp cc (v6,v1); | |
| double cor = cc.computePearsonCorrelation(); | |
| ASSERT_NEAR(cc.getPvalue(cor),0.01866973,0.01); | |
| } |
The corresponding R code:
> cor.test(c(1,2,3,4,5), c(1,2,4,3,5), alternative = "greater", method = "pearson")
Pearson's product-moment correlation
data: c(1, 2, 3, 4, 5) and c(1, 2, 4, 3, 5)
t = 3.5762, df = 3, p-value = 0.01869
alternative hypothesis: true correlation is greater than 0
95 percent confidence interval:
0.2996475 1.0000000
sample estimates:
cor
0.9
> cor.test(c(1,2,3,4,5), c(1,2,4,3,5), alternative = "two.sided", method = "pearson")
Pearson's product-moment correlation
data: c(1, 2, 3, 4, 5) and c(1, 2, 4, 3, 5)
t = 3.5762, df = 3, p-value = 0.03739
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.08610194 0.99343752
sample estimates:
cor
0.9
As one can see, the alternative hypothesis used in the computation in STITCHIT is one-sided ("greater").
Line 170 in 641dc07
| return 1.0-cdf(fisher.first/fisher.second); |
To also account for significant negative correlations, STITCHIT uses the absolute correlation for the Fisher's transformation:
Lines 141 to 149 in 641dc07
| double cor2 = std::abs(cor); | |
| if (observationCount_ < 5) | |
| error=1.0; | |
| else | |
| error=1.0/sqrt(observationCount_-3.0); | |
| if (std::abs(cor)==1.0) | |
| return std::make_pair(std::numeric_limits<double>::max(),error); | |
| else | |
| return std::make_pair((0.5)*log((1.0+cor2)/(1.0-cor2)),error); |
Does this violate the alternative hypothesis, which should be two-sided (corr != 0)?
Best,
Quirin
Metadata
Metadata
Assignees
Labels
No labels