arviz icon indicating copy to clipboard operation
arviz copied to clipboard

HDI column names incorrect

Open sandstromviktor opened this issue 1 year ago • 2 comments

Issue: Incorrect Naming of HDI Columns in summary output

Thanks for producing a very useful and great tool! I've found a small thing that would improve Arviz.

The summary function produces HDI columns labeled as hdi_<alpha>% and hdi_<1-alpha>%, which is misleading. For example, a 94% HDI does not correspond to the 3% and 97% quantiles (as it’s not a confidence interval).

Proposed Fix

Rename the columns to reflect their meaning more accurately:

on lines 1424-1426 in arviz/stats/stats.py, this:

            metric_names.extend(
                ("mean", "sd", f"hdi_{100 * alpha / 2:g}%", f"hdi_{100 * (1 - alpha / 2):g}%")
            )

should be something similar to this:

            metric_names.extend(
                ("mean", "sd", f"hdi_{100 * alpha:g}_lower%", f"hdi_{100 * (alpha):g}_upper%")
            )

This change would improve clarity and prevent confusion about the nature of the HDI.

sandstromviktor avatar Dec 02 '24 06:12 sandstromviktor

Related to #2306 and proposes an alternative to the solution proposed there.

sethaxen avatar Dec 02 '24 07:12 sethaxen

Thanks for showing me the related issue that i didn't find before. Should I close this?

I don't have any strong opinions in this matter, only that this naming is (very much) incorrect and anything proposed in #2306 is better. 👍

sandstromviktor avatar Dec 02 '24 08:12 sandstromviktor