0todd0000 / spm1d

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

Change two_tailed=False to two_tailed=true #216

Closed GustavChatterton closed 1 year ago

GustavChatterton commented 2 years ago

Hi,

I'm currently performing a one-way ANOVA with repeated measures, and testing for any significant difference between three conditions, and I'm performing the test in Python (Spyder v. 5). I would like to change the default settings where two_tailed = False to two_tailed = True. I have tried this by doing the following in the code:

alpha = 0.05 equal_var = True F = spm1d.stats.anova1(Y, A, equal_var) Frm = spm1d.stats.anova1rm(Y, A, B, equal_var) Fi = F.inference(alpha) Firm = Frm.inference(alpha, two_tailed=True)

I have also tried the MATLAB way: Firm = Frm.inference(alpha, 'two_tailed', True)'

I can run the code in with both scenarios but when I look in my variable "Firm", it has not changed, as shown in the picture below. Firm

Is there a way, where I can change it, so two_tailed will be True? best regards, Gustav

0todd0000 commented 2 years ago

For ANOVA the test statistic is the F statistic, which is always bigger than zero, so all ANOVA inference is one-tailed.

The inference call signature for the F statistic is:

f.inference(alpha=0.05, cluster_size=0, interp=True, circular=False)

As you can see there is no two_tailed option. You can find this signature on Line 469 of the _spm.py module.

So if you are able to use two_tailed=True along with the F statistic it would suggest that someone has altered the source code. Please note that we cannot provide support for the original, unaltered source code.

GustavChatterton commented 2 years ago

Great I understand now, thanks!