Arviz: Plot posterior gives anomalous results for small values

Created on 17 May 2019  路  9Comments  路  Source: arviz-devs/arviz

Describe the bug
I have a model with a small parameter, and on plot posterior the variable is displayed (incorrectly) as having a mean of "0.0" and an HPD between 0.0 and 0.0.

Here's a snippet of the picture:
image

To Reproduce

Attached a Jupyter notebook sufficient to reproduce the issue (had to attach it as a .txt file, but should simply be rename-able to run).

Wood Model.ipynb.txt

Expected behavior
Expected the values displayed to be scaled appropriately.

Additional context
arviz version 0.3.3
MacOS Mojave

All 9 comments

Hi @rpgoldman. By default plot_posterior will round the point_estimate and HPD bounds to the first decimal point. You can change that using the round_to argument.

Should we add some rules there? Like if values are less than x use scientific notation?

@aloctavodia Is this something that could be controlled somehow using the dims?
The documentation on dims in xarray is very sparse. The dims somehow are always a list of discrete values, and there's little guidance about what that will mean when the variable with the dimension is continuous. Should we be controlling the default plotting of our variables by putting ranges on these dimensions? If so, would that solve this problem?

@aloctavodia One more, if you don't mind -- if we are plotting a number of variables using plot_posterior, and they are on different scales, how should we be using round_to? It seems like it is applied uniformly across all subplots, yes?

@ahartikainen

Should we add some rules there? Like if values are less than x use scientific notation?

Could this be done by comparing the min and max computed for the HPD, and choosing a scale accordingly?

Should we add some rules there? Like if values are less than x use scientific notation?

What about allowing a custom format string? We could change the hpd[0].round(round_to) to format_str.format(hpd[0]) if format_string is present, otherwise, the round_to argument would be used. It could also allow the option of using a list instead of a string to use different format for every plot.

@aloctavodia One more, if you don't mind -- if we are plotting a number of variables using plot_posterior, and they are on different scales, how should we be using round_to? It seems like it is applied uniformly across all subplots, yes?

Yes, round_to must be an integer, and this same value is used in all plots.

Should we use significant digits instead of rounding?

@aloctavodia or @rpgoldman
Is this still an issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fbartolic picture fbartolic  路  3Comments

canyon289 picture canyon289  路  6Comments

canyon289 picture canyon289  路  3Comments

lucianopaz picture lucianopaz  路  6Comments

oscarbranson picture oscarbranson  路  6Comments