rasbt / mlxtend

A library of extension and helper modules for Python's data analysis and machine learning libraries.
https://rasbt.github.io/mlxtend/
Other
4.85k stars 857 forks source link

mcnemar exact test equivalence #851

Open lorenzo-stacchio opened 2 years ago

lorenzo-stacchio commented 2 years ago

Doubt about equivalence in comments in the function mcnemar in mlxtend.evaluate.mcnemar.py module

Starting from this line it is described how to obtain an equivalent method to calculate mcnemar exact test.

However, I think that the last line of commented code should be changed with the following one:

p = min(2*p,1.)

otherwise, I believe that you could obtain a p-value greater than 1.

Maybe I am wrong, but using that formula I have obtained a p-value greater than one while using the real implementation no.