Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_posterior and plot_density give a mode outside of the hdi #1549

Closed
gdindi opened this issue Feb 9, 2021 · 5 comments · Fixed by #1552
Closed

plot_posterior and plot_density give a mode outside of the hdi #1549

gdindi opened this issue Feb 9, 2021 · 5 comments · Fixed by #1552

Comments

@gdindi
Copy link

gdindi commented Feb 9, 2021

Short Description

I am plotting densities and I ask for a point estimate as 'mode'. The value of the mode is outside of the HDI.

Code Example or link

az.plot_posterior(inference_data, point_estimate = 'mode', hdi_prob = 0.9, var_names = ('a', 'b', 'c', 'sigma_lai'), figsize=(10,5), grid=(2,2))

The result looks like this https://postimg.cc/K4RpK4gg

az.version
Out[88]: '0.11.1'

@aloctavodia
Copy link
Contributor

HI @gdindi thanks for taking the time to report this issue. I am not able to reproduce this error, could you share your data or share a minimal working example?

@gdindi
Copy link
Author

gdindi commented Feb 10, 2021

Hi,

Here goes a minimal working example:

# get the data file here
# https://upload.disroot.org/r/7cWwZ7y7#vbkqLUsIKbTmTaCDYhNkt4xfRG/d0qSOeY84aD1JpbQ=
import arviz as az
import matplotlib.pyplot as plt
inf_data = az.from_netcdf("posterior_1.netcdf")
az.plot_posterior(inf_data.posterior, point_estimate = 'mode', hdi_prob = 0.9, var_names = ('a', 'b', 'c', 'sigma_lai'), figsize=(10,5), grid=(3,2))
plt.savefig("test.png")

Thank you.

@aloctavodia
Copy link
Contributor

Thanks. I find the problem and I will fix it later today.

@gdindi
Copy link
Author

gdindi commented Feb 10, 2021

Thank you. I am using arviz from conda-forge. What is the recommended way to be able to use the fixed code?

@aloctavodia
Copy link
Contributor

@gdindi To install the version from master use pip install git+https://github.com/arviz-devs/arviz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants