Aura-healthcare / hrv-analysis

Package for Heart Rate Variability analysis in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong divisor in computing pnni_50/pnni_20

marchv opened this issue · comments

Hi :)

I think I have just spotted a minor error when computing pnni_xx. Currently you have:

diff_nni = np.diff(nn_intervals)
length_int = len(nn_intervals)

nni_50 = sum(np.abs(diff_nni) > 50)
pnni_50 = 100 * nni_50 / length_int
nni_20 = sum(np.abs(diff_nni) > 20)
pnni_20 = 100 * nni_20 / length_int

The problem is that the divisor is length_int. I believe the divisor should be len(diff_nni) instead?

This error is also in the description:

- **nni_50**: Number of interval differences of successive RR-intervals greater than 50 ms.

- **pnni_50**: The proportion derived by dividing nni_50 (The number of interval differences \
of successive RR-intervals greater than 50 ms) by the total number of RR-intervals.

- **nni_20**: Number of interval differences of successive RR-intervals greater than 20 ms.

- **pnni_20**: The proportion derived by dividing nni_20 (The number of interval differences \
of successive RR-intervals greater than 20 ms) by the total number of RR-intervals.

Cheers!

Hi Jens,

Thanks for raising this issue. We'll take a look quickly and get back to you on this ASAP.
Stay tuned !

Cheers,
Laurent

Hi Jens,

Thanks for your question :) I looked again at the core paper I used to develop this library and I still don't think that we should divide by "len(diff_nni)".

Actually, the "p" in "pnn_20" or "pnn_50" stands for "proportion". What we want is the proportion of nn_intervals, among all the nn_intervals, which have a successive value superior to a threshold (respectively 20ms and 50ms).

Here is a screenshot of the important part:

Capture d’écran 2019-10-14 à 18 42 16

The core paper is available here if you want to take a deeper look...
=> https://www.escardio.org/static_file/Escardio/Guidelines/Scientific-Statements/guidelines-Heart-Rate-Variability-FT-1996.pdf

I hope that helps! If you still have concerns, please ask me any questions.

Have a good day,
Cheers,
Robin

Hi @robinchampseix and thanks :)

But for example if it should happen that all diff_nnis are above 50 ms then you will not get to 100%.

But anyways I think this can be ignored...