naturalistic-data-analysis / naturalistic_data_analysis

A jupyter book for the OHBM educational workshop on analyzing naturalistic data.
http://naturalistic-data.org/
40 stars 9 forks source link

IS-RSA tutorial - correcting for multiple comparisons #2

Closed rtansey closed 3 years ago

rtansey commented 3 years ago

Hello, thank you so much for the naturalistic imaging analysis Jupyter book, it has been extremely helpful to me. However, I think that I have either found an error or I might be understanding something incorrectly in the IS-RSA tutorial. Under the multiple comparisons section, you use a function to calculate the FDR threshold from nltools.stats. Here is the code in the Jupyter book:

fdr_thr = fdr(pd.Series(isrsa_nn_r).values)
print(f'FDR Threshold: {fdr_thr}')

view_img(threshold(isrsa_nn_r_brain, isrsa_nn_p_brain, thr=fdr_thr).to_nifti())

The input to this function is the isrsa_nn_r values, which, as I understand, are the r correlation values, not the p-values.

From the nltools documentation:

nltools.stats.fdr(p, q=0.05)
    Determine FDR threshold given a p value array and desired false discovery rate q. Written by Tal Yarkoni

    Parameters
            p – (np.array) vector of p-values
            q – (float) false discovery rate level

    Returns
        (float) p-value threshold based on independence or positive
            dependence

    Return type
        fdr_p

Given that the documentation states that the input to the fdr function is an array of p-values, shouldn't isrsa_nn_p be the input to the function, and not isrsa_nn_r? Or have I misunderstood something?

Thank you!

ljchang commented 3 years ago

Thanks @rtansey for catching this bug! We will fix it soon.

esfinn commented 3 years ago

This is now fixed. Thanks again!