0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
61 stars 21 forks source link

p-Values #60

Closed SinaDavid closed 7 years ago

SinaDavid commented 7 years ago

Hey Todd, I just recognized something I can't explain: If I compare datasets via ttest2 in a two-tailed approach, I get an p_value of 0.021 If I change die orientation of my datasets by simply multiplying them by -1 (need to do this for some figures), and than recalculate the p-value, it changes to 0.047. In my opinion there shouldn't be a difference, but probably I'm wrong. Thanks in advance! Sina

0todd0000 commented 7 years ago

Hi Sina,

I agree with you, the results should be the same.

However, I can't reproduce the problem. Please see the two examples below, which are slight modifications of ./spm1d/examples/stats1d/ex_ttest2.py. These two examples produce the same p values (0.031).

If these two examples don't solve your problem, please let me know, and please copy code which replicates the error.

Example 1:

dataset    = spm1d.data.uv1d.t2.PlantarArchAngle()
YA,YB      = dataset.get_data()
t          = spm1d.stats.ttest2(YB, YA, equal_var=True)
ti         = t.inference(0.05, two_tailed=True)

example1

Example 2 (data multiplied by -1):

dataset    = spm1d.data.uv1d.t2.PlantarArchAngle()
YA,YB      = dataset.get_data()
YA,YB      = -YA, -YB
t          = spm1d.stats.ttest2(YB, YA, equal_var=True)
ti         = t.inference(0.05, two_tailed=True)

example2

Cheers,

Todd

0todd0000 commented 7 years ago

Hi Sina,

My response above pertains to the Python version, which appears to be working fine. The MATLAB version does indeed have a problem, thank you so much for finding this bug! Please find that I've replicated this issue in spm1d's MATLAB forum:

https://github.com/0todd0000/spm1dmatlab/issues/31

I'll close the issue here in the Python forum, please use the link above to follow-up on the issue.

Cheers, Todd