vnmabus / dcor

Distance correlation and related E-statistics in Python
https://dcor.readthedocs.io
MIT License
144 stars 26 forks source link

Exponent implementation question #24

Closed multimeric closed 3 years ago

multimeric commented 3 years ago

Hi again. I wondered if you could explain the logic here: https://github.com/vnmabus/dcor/blob/161a6f5928ec0f30ce89fcfd5e90e6ed9315e383/dcor/distances.py#L56-L57 If, for example, we set exponent=2, which should test for mean differences only (James & Matteson, 2015), it seems that this line would raise the distance to the power of 1, making it equivalent to exponent=1. Is this correct, or am I misunderstanding something?

Thanks!

vnmabus commented 3 years ago

If you look at lines 51-52, when exponent is not 1, the distance computed is the square of the euclidean distance, so the exponent must be divided by 2 to compensate:

https://github.com/vnmabus/dcor/blob/161a6f5928ec0f30ce89fcfd5e90e6ed9315e383/dcor/distances.py#L51-L52

multimeric commented 3 years ago

Ah, I didn't appreciate what that meant. Thanks!