markallenthornton / MatlabTFCE

Standalone MATLAB implementation of permutation TFCE correction
MIT License
42 stars 21 forks source link

Pearson/Spearman correlation #3

Closed jrmxn closed 6 years ago

jrmxn commented 6 years ago

Hi - thank you for your contribution. I have been using the correlation option in this, and it seems to work well and gives me results consistent with other methods.

In my data I am not really expecting a linear relationship between voxel activity and the parameters I am correlating.

I am thinking that swapping out the Pearson correlations for Spearman correlations should be fine - I was mainly concerned that the following Fisher transformation would somehow be inappropriate (although a quick google search suggests that it is: https://onlinecourses.science.psu.edu/stat509/book/export/html/157).

Essentially, I was just looking for a second opinion on this in case there is something I am missing - seems like a simple change for an increase in robustness.

Thank you for your time.

EDIT: OK, I see that using Pearson is maybe 25x faster than Spearman (on my data).

markallenthornton commented 6 years ago

I think the default option should remain as Pearson, since that is what most people will expect when performing a correlation test. However, if you modify the code to use a Spearman correlation, there should be no problem subsequently Fisher z transforming it - that step is to ensure the normality/linearity of correlation coefficients themselves, not the underlying variables you are correlating. However, as you point out, Spearman correlations are likely to be much slower, because they require rank transformation of every voxel in every permutation.

jrmxn commented 6 years ago

Thank you for your quick reply - agree on all points.