arviz-devs / arviz

Exploratory analysis of Bayesian models with Python
https://python.arviz.org
Apache License 2.0
1.6k stars 398 forks source link

Rhat values close to 1 not shown in the `plot_forest` plot #2065

Closed Alexander-Serov closed 2 years ago

Alexander-Serov commented 2 years ago

Describe the bug I have a fitted model (4 chains), for which I make a plot_forest plot with the r_hat option on. Here is the plot I get.

image image For some reason, the r_hat values are not shown in this plot.

Naturally, I was thinking that my r_hat values are sky-high and they just do not fit the [1,2] interval. However, if I calculate the directly for the same variable using arviz, I get values close to 1, so they pretty much should be on the plot. image I am confused as to how this is possible and was wondering whether you guys could indicate a possible reason? Have you encountered something similar before?

The re-sampled distributions seem to have indeed converged. image

To Reproduce It is 100% reproducible on my machine, but it may be specific to my data set / traces. I cannot unfortunately provide the data set due to confidentiality restrictions.

Expected behavior If the r_hat values are indeed close to 1 they should appear in the plot, or a message should be printed on why it's not possible.

Additional context The trace is calculated with pymc3 == 3.11.4 and I am using arviz 0.11.4 to plot.

absl-py==0.15.0
ansi2html==1.7.0
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arviz==0.11.4
astroid==2.7.3
astunparse==1.6.3
atomicwrites @ file:///home/conda/feedstock_root/build_artifacts/atomicwrites_1588182545583/work
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1640799537051/work
backcall==0.2.0
black==22.1.0
bleach==4.1.0
Brotli==1.0.9
cached-property==1.5.2
cachetools==4.2.4
certifi==2021.10.8
cffi==1.15.0
cfgrib==0.9.9.0
cfgv==3.3.1
cftime==1.5.2
charset-normalizer==2.0.12
clang==5.0
click==8.0.3
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1602866480661/work
coverage==6.3.1
cycler==0.11.0
dash==2.2.0
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
debugpy==1.5.1
decorator==5.1.1
defusedxml==0.7.1
dill==0.3.3
distlib==0.3.4
eccodes==1.4.0
ecmwflibs==0.4.17
emcee==3.0.2
entrypoints==0.4
et-xmlfile==1.0.1
execnet==1.9.0
fastprogress==1.0.2
filelock==3.6.0
findlibs==0.0.2
Flask==2.0.3
Flask-Compress==1.11
flatbuffers==1.12
func-timeout==4.3.5
gast==0.4.0
ghp-import==2.1.0
google-auth==1.35.0
google-auth-oauthlib==0.4.4
google-pasta==0.2.0
grpcio==1.44.0
h5py==3.1.0
httplib2==0.20.4
identify==2.4.10
idna==3.3
importlib-metadata @ file:///D:/bld/importlib-metadata_1648728499576/work
importlib-resources==5.4.0
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1603384189793/work
ipykernel==6.9.1
ipython==7.31.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
iso8601==0.1.14
isort==5.10.1
itsdangerous==2.1.0
jedi==0.18.1
Jinja2==3.0.3
joblib==1.0.1
jsonschema==4.4.0
julian==0.14
jupyter-client==7.1.2
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.5.1
jupyter-core==4.9.2
jupyter-dash==0.4.1
jupyter-highlight-selected-word==0.2.0
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.2
kaleido==0.2.1
keras==2.7.0
Keras-Preprocessing==1.1.2
kiwisolver==1.3.2
lazy-object-proxy==1.7.1
libclang==14.0.1
libcst==0.4.1
lttbc==0.2.0
lxml==4.8.0
lz4==3.1.3
Markdown==3.3.4
markdown-include==0.6.0
MarkupSafe==2.1.0
marshmallow==3.14.1
matplotlib==3.4.1
matplotlib-inline==0.1.3
mccabe==0.6.1
mdx-truly-sane-lists==1.2
mergedeep==1.3.4
missingno==0.5.1
mistune==0.8.4
mkdocs==1.3.0
mkdocs-autorefs==0.4.1
mkdocs-material==8.3.4
mkdocs-material-extensions==1.0.3
mkdocs-redirects==1.0.4
mkdocstrings==0.19.0
mkdocstrings-python-legacy==0.2.3
mkl-service==2.4.0
MonkeyType==22.2.0
more-itertools==8.12.0
multiprocess==0.70.11.1
mypy-extensions==0.4.3
nbclient==0.5.11
nbconvert==6.4.2
nbformat==5.1.3
nest-asyncio==1.5.4
netCDF4==1.5.8
nodeenv==1.6.0
nose==1.3.7
notebook==6.4.8
numpy==1.19.5
oauthlib==3.2.0
openpyxl==3.0.7
opt-einsum==3.3.0
orjson==3.6.7
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1637239678211/work
pandas==1.3.5
pandocfilters==1.5.0
parso==0.8.3
pathlib==1.0.1
pathos==0.2.7
pathspec==0.9.0
patsy==0.5.1
pickleshare==0.7.5
Pillow==9.0.1
pipdeptree==2.2.1
plantuml==0.3.0
plantuml-markdown==3.5.3
platformdirs==2.5.0
plotly==5.6.0
plotly-resampler==0.2.8
pluggy @ file:///D:/bld/pluggy_1648772784311/work
ply==3.11
pox==0.2.9
ppft==1.6.6.3
pre-commit==2.17.0
prometheus-client==0.13.1
prompt-toolkit==3.0.28
protobuf==3.15.7
py @ file:///home/conda/feedstock_root/build_artifacts/py_1636301881863/work
pyarrow==6.0.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
pydivsufsort==0.0.6
Pygments==2.12.0
pylint==2.10.2
pymc3==3.11.4
pymdown-extensions==9.5
Pympler==0.9
Pyomo==6.2
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1649603503565/work
pyrsistent==0.18.1
pytest==6.2.5
pytest-cov==3.0.0
pytest-forked==1.4.0
pytest-xdist==2.5.0
python-dateutil==2.8.2
pytkdocs==0.16.1
pytz==2021.3
PyUtilib==6.0.0
pywin32==303
pywinpty==2.0.2
PyYAML==6.0
pyyaml_env_tag==0.1
pyzmq==22.3.0
requests==2.27.1
requests-oauthlib==1.3.1
retrying==1.3.3
rsa==4.8
scikit-learn==1.0.2
scipy==1.7.3
seaborn==0.10.1
semver==2.13.0
Send2Trash==1.8.0
singledispatchmethod==1.0
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
snakeviz==2.1.1
statsmodels==0.12.2
tenacity==8.0.1
tensorboard==2.6.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.7.3
tensorflow-addons==0.16.1
tensorflow-estimator==2.7.0
tensorflow-io-gcs-filesystem==0.26.0
termcolor==1.1.0
terminado==0.13.1
testpath==0.5.0
Theano-PyMC==1.1.2
threadpoolctl==3.1.0
toml==0.10.2
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work
tornado==6.1
tqdm==4.62.3
trace-updater==0.0.6
traitlets==5.1.1
typed-ast==1.4.3
typeguard==2.12.0
typing-extensions==3.10.0.2
typing-inspect==0.7.1
urllib3==1.26.8
virtualenv==20.13.1
watchdog==2.1.9
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.0.3
widgetsnbextension==3.5.2
wrapt==1.12.1
xarray==0.20.2
xlrd==2.0.1
xmltodict==0.12.0
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1649012893348/work
OriolAbril commented 2 years ago

Hi, thanks for the issue. This looks like a duplicate of https://github.com/arviz-devs/arviz/issues/2039 which has code to reproduce the error and already some discussion on how to fix it.

I am going to close this issue in favour of the other one. You can manually subscribe to the other issue to be notified as soon as it is fixed on the development version

Alexander-Serov commented 2 years ago

Indeed, thanks @OriolAbril !