arviz 0.18.0__tar.gz → 0.19.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. {arviz-0.18.0 → arviz-0.19.0}/CHANGELOG.md +27 -1
  2. {arviz-0.18.0 → arviz-0.19.0}/PKG-INFO +3 -21
  3. {arviz-0.18.0 → arviz-0.19.0}/arviz/__init__.py +2 -1
  4. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_cmdstan.py +4 -0
  5. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_numpyro.py +1 -1
  6. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/ecdfplot.py +1 -2
  7. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/khatplot.py +8 -3
  8. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/pairplot.py +2 -6
  9. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/ecdfplot.py +1 -2
  10. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/khatplot.py +7 -3
  11. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/traceplot.py +1 -1
  12. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/bpvplot.py +2 -2
  13. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/densityplot.py +1 -1
  14. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/dotplot.py +2 -2
  15. arviz-0.19.0/arviz/plots/ecdfplot.py +364 -0
  16. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/essplot.py +2 -2
  17. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/forestplot.py +1 -1
  18. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/hdiplot.py +2 -2
  19. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/khatplot.py +23 -6
  20. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/loopitplot.py +2 -2
  21. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/mcseplot.py +3 -1
  22. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/plot_utils.py +2 -4
  23. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/posteriorplot.py +1 -1
  24. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/rankplot.py +2 -2
  25. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/violinplot.py +1 -1
  26. arviz-0.19.0/arviz/preview.py +17 -0
  27. {arviz-0.18.0 → arviz-0.19.0}/arviz/rcparams.py +27 -2
  28. {arviz-0.18.0 → arviz-0.19.0}/arviz/stats/diagnostics.py +13 -9
  29. {arviz-0.18.0 → arviz-0.19.0}/arviz/stats/ecdf_utils.py +11 -8
  30. {arviz-0.18.0 → arviz-0.19.0}/arviz/stats/stats.py +31 -16
  31. {arviz-0.18.0 → arviz-0.19.0}/arviz/stats/stats_utils.py +8 -6
  32. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_data.py +1 -2
  33. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_data_zarr.py +0 -1
  34. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_diagnostics_numba.py +2 -7
  35. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_helpers.py +2 -2
  36. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_plot_utils.py +5 -13
  37. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_plots_matplotlib.py +92 -2
  38. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_rcparams.py +12 -0
  39. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_stats.py +1 -1
  40. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_stats_numba.py +2 -7
  41. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_utils_numba.py +2 -5
  42. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_pystan.py +5 -5
  43. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/helpers.py +17 -9
  44. {arviz-0.18.0 → arviz-0.19.0}/arviz/utils.py +4 -0
  45. {arviz-0.18.0 → arviz-0.19.0}/arviz.egg-info/PKG-INFO +3 -21
  46. {arviz-0.18.0 → arviz-0.19.0}/arviz.egg-info/SOURCES.txt +1 -0
  47. {arviz-0.18.0 → arviz-0.19.0}/arviz.egg-info/requires.txt +8 -3
  48. {arviz-0.18.0 → arviz-0.19.0}/requirements-docs.txt +1 -1
  49. {arviz-0.18.0 → arviz-0.19.0}/requirements-optional.txt +2 -2
  50. {arviz-0.18.0 → arviz-0.19.0}/requirements.txt +1 -1
  51. {arviz-0.18.0 → arviz-0.19.0}/setup.py +4 -1
  52. arviz-0.18.0/arviz/plots/ecdfplot.py +0 -248
  53. {arviz-0.18.0 → arviz-0.19.0}/CODE_OF_CONDUCT.md +0 -0
  54. {arviz-0.18.0 → arviz-0.19.0}/CONTRIBUTING.md +0 -0
  55. {arviz-0.18.0 → arviz-0.19.0}/GOVERNANCE.md +0 -0
  56. {arviz-0.18.0 → arviz-0.19.0}/LICENSE +0 -0
  57. {arviz-0.18.0 → arviz-0.19.0}/MANIFEST.in +0 -0
  58. {arviz-0.18.0 → arviz-0.19.0}/README.md +0 -0
  59. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/__init__.py +0 -0
  60. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/base.py +0 -0
  61. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/converters.py +0 -0
  62. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/datasets.py +0 -0
  63. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/example_data/code/radon/radon.json +0 -0
  64. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/example_data/data/centered_eight.nc +0 -0
  65. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/example_data/data/non_centered_eight.nc +0 -0
  66. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/example_data/data_local.json +0 -0
  67. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/example_data/data_remote.json +0 -0
  68. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/inference_data.py +0 -0
  69. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_beanmachine.py +0 -0
  70. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_cmdstanpy.py +0 -0
  71. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_datatree.py +0 -0
  72. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_dict.py +0 -0
  73. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_emcee.py +0 -0
  74. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_json.py +0 -0
  75. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_netcdf.py +0 -0
  76. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_pyjags.py +0 -0
  77. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_pyro.py +0 -0
  78. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_pystan.py +0 -0
  79. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/io_zarr.py +0 -0
  80. {arviz-0.18.0 → arviz-0.19.0}/arviz/data/utils.py +0 -0
  81. {arviz-0.18.0 → arviz-0.19.0}/arviz/labels.py +0 -0
  82. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/__init__.py +0 -0
  83. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/autocorrplot.py +0 -0
  84. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/__init__.py +0 -0
  85. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/__init__.py +0 -0
  86. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/autocorrplot.py +0 -0
  87. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/bfplot.py +0 -0
  88. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/bpvplot.py +0 -0
  89. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/compareplot.py +0 -0
  90. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/densityplot.py +0 -0
  91. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/distcomparisonplot.py +0 -0
  92. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/distplot.py +0 -0
  93. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/dotplot.py +0 -0
  94. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/elpdplot.py +0 -0
  95. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/energyplot.py +0 -0
  96. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/essplot.py +0 -0
  97. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/forestplot.py +0 -0
  98. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/hdiplot.py +0 -0
  99. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/kdeplot.py +0 -0
  100. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/lmplot.py +0 -0
  101. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/loopitplot.py +0 -0
  102. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/mcseplot.py +0 -0
  103. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/parallelplot.py +0 -0
  104. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/posteriorplot.py +0 -0
  105. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/ppcplot.py +0 -0
  106. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/rankplot.py +0 -0
  107. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/separationplot.py +0 -0
  108. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/traceplot.py +0 -0
  109. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/bokeh/violinplot.py +0 -0
  110. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/__init__.py +0 -0
  111. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/autocorrplot.py +0 -0
  112. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/bfplot.py +0 -0
  113. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/bpvplot.py +0 -0
  114. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/compareplot.py +0 -0
  115. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/densityplot.py +0 -0
  116. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/distcomparisonplot.py +0 -0
  117. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/distplot.py +0 -0
  118. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/dotplot.py +0 -0
  119. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/elpdplot.py +0 -0
  120. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/energyplot.py +0 -0
  121. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/essplot.py +0 -0
  122. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/forestplot.py +0 -0
  123. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/hdiplot.py +0 -0
  124. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/kdeplot.py +0 -0
  125. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/lmplot.py +0 -0
  126. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/loopitplot.py +0 -0
  127. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/mcseplot.py +0 -0
  128. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/pairplot.py +0 -0
  129. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/parallelplot.py +0 -0
  130. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/posteriorplot.py +0 -0
  131. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/ppcplot.py +0 -0
  132. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/rankplot.py +0 -0
  133. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/separationplot.py +0 -0
  134. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/tsplot.py +0 -0
  135. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/backends/matplotlib/violinplot.py +0 -0
  136. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/bfplot.py +0 -0
  137. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/compareplot.py +0 -0
  138. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/distcomparisonplot.py +0 -0
  139. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/distplot.py +0 -0
  140. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/elpdplot.py +0 -0
  141. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/energyplot.py +0 -0
  142. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/kdeplot.py +0 -0
  143. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/lmplot.py +0 -0
  144. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/pairplot.py +0 -0
  145. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/parallelplot.py +0 -0
  146. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/ppcplot.py +0 -0
  147. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/separationplot.py +0 -0
  148. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-bluish.mplstyle +0 -0
  149. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-brownish.mplstyle +0 -0
  150. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-colors.mplstyle +0 -0
  151. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-cyanish.mplstyle +0 -0
  152. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-darkgrid.mplstyle +0 -0
  153. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-doc.mplstyle +0 -0
  154. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-docgrid.mplstyle +0 -0
  155. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-grayscale.mplstyle +0 -0
  156. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-greenish.mplstyle +0 -0
  157. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-orangish.mplstyle +0 -0
  158. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-plasmish.mplstyle +0 -0
  159. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-purplish.mplstyle +0 -0
  160. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-redish.mplstyle +0 -0
  161. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-royish.mplstyle +0 -0
  162. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-viridish.mplstyle +0 -0
  163. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-white.mplstyle +0 -0
  164. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/styles/arviz-whitegrid.mplstyle +0 -0
  165. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/traceplot.py +0 -0
  166. {arviz-0.18.0 → arviz-0.19.0}/arviz/plots/tsplot.py +0 -0
  167. {arviz-0.18.0 → arviz-0.19.0}/arviz/py.typed +0 -0
  168. {arviz-0.18.0 → arviz-0.19.0}/arviz/sel_utils.py +0 -0
  169. {arviz-0.18.0 → arviz-0.19.0}/arviz/static/css/style.css +0 -0
  170. {arviz-0.18.0 → arviz-0.19.0}/arviz/static/html/icons-svg-inline.html +0 -0
  171. {arviz-0.18.0 → arviz-0.19.0}/arviz/stats/__init__.py +0 -0
  172. {arviz-0.18.0 → arviz-0.19.0}/arviz/stats/density_utils.py +0 -0
  173. {arviz-0.18.0 → arviz-0.19.0}/arviz/stats/stats_refitting.py +0 -0
  174. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/__init__.py +0 -0
  175. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/__init__.py +0 -0
  176. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_diagnostics.py +0 -0
  177. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_labels.py +0 -0
  178. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_plots_bokeh.py +0 -0
  179. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_stats_ecdf_utils.py +0 -0
  180. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_stats_utils.py +0 -0
  181. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/base_tests/test_utils.py +0 -0
  182. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/conftest.py +0 -0
  183. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/__init__.py +0 -0
  184. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_beanmachine.py +0 -0
  185. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_cmdstan.py +0 -0
  186. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_cmdstanpy.py +0 -0
  187. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_emcee.py +0 -0
  188. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_numpyro.py +0 -0
  189. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_pyjags.py +0 -0
  190. {arviz-0.18.0 → arviz-0.19.0}/arviz/tests/external_tests/test_data_pyro.py +0 -0
  191. {arviz-0.18.0 → arviz-0.19.0}/arviz/wrappers/__init__.py +0 -0
  192. {arviz-0.18.0 → arviz-0.19.0}/arviz/wrappers/base.py +0 -0
  193. {arviz-0.18.0 → arviz-0.19.0}/arviz/wrappers/wrap_pymc.py +0 -0
  194. {arviz-0.18.0 → arviz-0.19.0}/arviz/wrappers/wrap_stan.py +0 -0
  195. {arviz-0.18.0 → arviz-0.19.0}/arviz.egg-info/dependency_links.txt +0 -0
  196. {arviz-0.18.0 → arviz-0.19.0}/arviz.egg-info/top_level.txt +0 -0
  197. {arviz-0.18.0 → arviz-0.19.0}/pyproject.toml +0 -0
  198. {arviz-0.18.0 → arviz-0.19.0}/requirements-dev.txt +0 -0
  199. {arviz-0.18.0 → arviz-0.19.0}/requirements-external.txt +0 -0
  200. {arviz-0.18.0 → arviz-0.19.0}/requirements-test.txt +0 -0
  201. {arviz-0.18.0 → arviz-0.19.0}/setup.cfg +0 -0
@@ -1,9 +1,29 @@
1
1
  # Change Log
2
2
 
3
- ## v0.18.0 (2024 Apr 4)
3
+ ## v0.19.0 (2024 Jul 19)
4
4
 
5
5
  ### New features
6
+ - Use revised Pareto k threshold ([2349](https://github.com/arviz-devs/arviz/pull/2349))
7
+ - Added arguments `ci_prob`, `eval_points`, `rvs`, and `random_state` to `plot_ecdf` ([2316](https://github.com/arviz-devs/arviz/pull/2316))
8
+ - Deprecated rcParam `stats.hdi_prob` and replaced with `stats.ci_prob` ([2316](https://github.com/arviz-devs/arviz/pull/2316))
9
+ - Expose features from [arviz-base](https://arviz-base.readthedocs.io), [arviz-stats](https://arviz-stats.readthedocs.io) and [arviz-plots](https://arviz-plots.readthedocs.io) as `arviz.preview`
10
+ submodule ([2361](https://github.com/arviz-devs/arviz/pull/2361))
11
+
12
+ ### Maintenance and fixes
13
+ - Ensure support with numpy 2.0 ([2321](https://github.com/arviz-devs/arviz/pull/2321))
14
+ - Update testing strategy to include an environment without optional dependencies and
15
+ an environment with [scientific python nightlies](https://anaconda.org/scientific-python-nightly-wheels) ([2321](https://github.com/arviz-devs/arviz/pull/2321))
16
+ - Address bokeh related deprecations ([2362](https://github.com/arviz-devs/arviz/pull/2362))
17
+
18
+ - Fix legend overwriting issue in `plot_trace` ([2334](https://github.com/arviz-devs/arviz/pull/2334))
19
+
20
+ ### Deprecation
21
+ - Support for arrays and DataArrays in plot_khat has been deprecated. Only ELPDdata will be supported in the future ([2349](https://github.com/arviz-devs/arviz/pull/2349))
22
+ - Removed arguments `values2`, `fpr`, `pointwise`, and `pit` in `plot_ecdf` ([2316](https://github.com/arviz-devs/arviz/pull/2316))
23
+
24
+ ## v0.18.0 (2024 Apr 4)
6
25
 
26
+ ### New features
7
27
  - Add new example data `rugby_field` and update `rugby` example data ([2322](https://github.com/arviz-devs/arviz/pull/2322))
8
28
  - Support for `pytree`s and robust to nested dictionaries. ([2291](https://github.com/arviz-devs/arviz/pull/2291))
9
29
  - Add `.close` method to `InferenceData` ([2338](https://github.com/arviz-devs/arviz/pull/2338))
@@ -13,6 +33,12 @@
13
33
  - Fix deprecation warnings in multiple dependencies ([2329](https://github.com/arviz-devs/arviz/pull/2329),
14
34
  [2332](https://github.com/arviz-devs/arviz/pull/2332) and [2333](https://github.com/arviz-devs/arviz/pull/2333))
15
35
 
36
+ ### Deprecation
37
+
38
+ - Removed arguments `values2`, `fpr`, `pointwise`, `npoints`, and `pit` in `plot_ecdf` ([2316](https://github.com/arviz-devs/arviz/pull/2316))
39
+
40
+ ### Documentation
41
+
16
42
  ## v0.17.1 (2024 Mar 13)
17
43
 
18
44
  ### Maintenance and fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arviz
3
- Version: 0.18.0
3
+ Version: 0.19.0
4
4
  Summary: Exploratory analysis of Bayesian models
5
5
  Home-page: http://github.com/arviz-devs/arviz
6
6
  Author: ArviZ Developers
@@ -20,27 +20,9 @@ Classifier: Topic :: Scientific/Engineering :: Visualization
20
20
  Classifier: Topic :: Scientific/Engineering :: Mathematics
21
21
  Requires-Python: >=3.10
22
22
  Description-Content-Type: text/markdown
23
- License-File: LICENSE
24
- Requires-Dist: setuptools>=60.0.0
25
- Requires-Dist: matplotlib>=3.5
26
- Requires-Dist: numpy<2.0,>=1.23.0
27
- Requires-Dist: scipy>=1.9.0
28
- Requires-Dist: packaging
29
- Requires-Dist: pandas>=1.5.0
30
- Requires-Dist: dm-tree>=0.1.8
31
- Requires-Dist: xarray>=2022.6.0
32
- Requires-Dist: h5netcdf>=1.0.2
33
- Requires-Dist: typing_extensions>=4.1.0
34
- Requires-Dist: xarray-einstats>=0.3
35
23
  Provides-Extra: all
36
- Requires-Dist: numba; extra == "all"
37
- Requires-Dist: netcdf4; extra == "all"
38
- Requires-Dist: bokeh<3.0,>=1.4.0; extra == "all"
39
- Requires-Dist: contourpy; extra == "all"
40
- Requires-Dist: ujson; extra == "all"
41
- Requires-Dist: dask[distributed]; extra == "all"
42
- Requires-Dist: zarr>=2.5.0; extra == "all"
43
- Requires-Dist: xarray-datatree; extra == "all"
24
+ Provides-Extra: preview
25
+ License-File: LICENSE
44
26
 
45
27
  <img src="https://raw.githubusercontent.com/arviz-devs/arviz-project/main/arviz_logos/ArviZ.png#gh-light-mode-only" width=200></img>
46
28
  <img src="https://raw.githubusercontent.com/arviz-devs/arviz-project/main/arviz_logos/ArviZ_white.png#gh-dark-mode-only" width=200></img>
@@ -1,6 +1,6 @@
1
1
  # pylint: disable=wildcard-import,invalid-name,wrong-import-position
2
2
  """ArviZ is a library for exploratory analysis of Bayesian models."""
3
- __version__ = "0.18.0"
3
+ __version__ = "0.19.0"
4
4
 
5
5
  import logging
6
6
  import os
@@ -37,6 +37,7 @@ from .stats import *
37
37
  from .rcparams import rc_context, rcParams
38
38
  from .utils import Numba, Dask, interactive_backend
39
39
  from .wrappers import *
40
+ from . import preview
40
41
 
41
42
  # add ArviZ's styles to matplotlib's styles
42
43
  _arviz_style_path = os.path.join(os.path.dirname(__file__), "plots", "styles")
@@ -738,6 +738,7 @@ def _process_configuration(comments):
738
738
  elif "=" in comment:
739
739
  match_int = re.search(r"^(\S+)\s*=\s*([-+]?[0-9]+)$", comment)
740
740
  match_float = re.search(r"^(\S+)\s*=\s*([-+]?[0-9]+\.[0-9]+)$", comment)
741
+ match_str_bool = re.search(r"^(\S+)\s*=\s*(true|false)$", comment)
741
742
  match_str = re.search(r"^(\S+)\s*=\s*(\S+)$", comment)
742
743
  match_empty = re.search(r"^(\S+)\s*=\s*$", comment)
743
744
  if match_int:
@@ -746,6 +747,9 @@ def _process_configuration(comments):
746
747
  elif match_float:
747
748
  key, value = match_float.group(1), match_float.group(2)
748
749
  results[key] = float(value)
750
+ elif match_str_bool:
751
+ key, value = match_str_bool.group(1), match_str_bool.group(2)
752
+ results[key] = int(value == "true")
749
753
  elif match_str:
750
754
  key, value = match_str.group(1), match_str.group(2)
751
755
  results[key] = value
@@ -194,7 +194,7 @@ class NumPyroConverter:
194
194
  )
195
195
  for obs_name, log_like in log_likelihood_dict.items():
196
196
  shape = (self.nchains, self.ndraws) + log_like.shape[1:]
197
- data[obs_name] = np.reshape(log_like.copy(), shape)
197
+ data[obs_name] = np.reshape(np.asarray(log_like), shape)
198
198
  return dict_to_dataset(
199
199
  data,
200
200
  library=self.numpyro,
@@ -13,7 +13,6 @@ def plot_ecdf(
13
13
  x_bands,
14
14
  lower,
15
15
  higher,
16
- confidence_bands,
17
16
  plot_kwargs,
18
17
  fill_kwargs,
19
18
  plot_outline_kwargs,
@@ -58,7 +57,7 @@ def plot_ecdf(
58
57
  plot_outline_kwargs.setdefault("color", to_hex("C0"))
59
58
  plot_outline_kwargs.setdefault("alpha", 0.2)
60
59
 
61
- if confidence_bands:
60
+ if x_bands is not None:
62
61
  ax.step(x_coord, y_coord, **plot_kwargs)
63
62
 
64
63
  if fill_band:
@@ -21,6 +21,7 @@ def plot_khat(
21
21
  figsize,
22
22
  xdata,
23
23
  khats,
24
+ good_k,
24
25
  kwargs,
25
26
  threshold,
26
27
  coord_labels,
@@ -53,7 +54,11 @@ def plot_khat(
53
54
 
54
55
  if hlines_kwargs is None:
55
56
  hlines_kwargs = {}
56
- hlines_kwargs.setdefault("hlines", [0, 0.5, 0.7, 1])
57
+
58
+ if good_k is None:
59
+ good_k = 0.7
60
+
61
+ hlines_kwargs.setdefault("hlines", [0, good_k, 1])
57
62
 
58
63
  cmap = None
59
64
  if isinstance(color, str):
@@ -75,7 +80,7 @@ def plot_khat(
75
80
  rgba_c = cmap(color)
76
81
 
77
82
  khats = khats if isinstance(khats, np.ndarray) else khats.values.flatten()
78
- alphas = 0.5 + 0.2 * (khats > 0.5) + 0.3 * (khats > 1)
83
+ alphas = 0.5 + 0.2 * (khats > good_k) + 0.3 * (khats > 1)
79
84
 
80
85
  rgba_c = vectorized_to_hex(rgba_c)
81
86
 
@@ -130,7 +135,7 @@ def plot_khat(
130
135
  xmax = len(khats)
131
136
 
132
137
  if show_bins:
133
- bin_edges = np.array([ymin, 0.5, 0.7, 1, ymax])
138
+ bin_edges = np.array([ymin, good_k, 1, ymax])
134
139
  bin_edges = bin_edges[(bin_edges >= ymin) & (bin_edges <= ymax)]
135
140
  hist, _, _ = histogram(khats, bin_edges)
136
141
  for idx, count in enumerate(hist):
@@ -174,12 +174,8 @@ def plot_pair(
174
174
  source = ColumnDataSource(data=source_dict)
175
175
 
176
176
  if divergences:
177
- source_nondiv = CDSView(
178
- source=source, filters=[GroupFilter(column_name=divergenve_name, group="0")]
179
- )
180
- source_div = CDSView(
181
- source=source, filters=[GroupFilter(column_name=divergenve_name, group="1")]
182
- )
177
+ source_nondiv = CDSView(filter=GroupFilter(column_name=divergenve_name, group="0"))
178
+ source_div = CDSView(filter=GroupFilter(column_name=divergenve_name, group="1"))
183
179
 
184
180
  def get_width_and_height(jointplot, rotate):
185
181
  """Compute subplots dimensions for two or more variables."""
@@ -13,7 +13,6 @@ def plot_ecdf(
13
13
  x_bands,
14
14
  lower,
15
15
  higher,
16
- confidence_bands,
17
16
  plot_kwargs,
18
17
  fill_kwargs,
19
18
  plot_outline_kwargs,
@@ -59,7 +58,7 @@ def plot_ecdf(
59
58
 
60
59
  ax.step(x_coord, y_coord, **plot_kwargs)
61
60
 
62
- if confidence_bands:
61
+ if x_bands is not None:
63
62
  if fill_band:
64
63
  ax.fill_between(x_bands, lower, higher, **fill_kwargs)
65
64
  else:
@@ -20,6 +20,7 @@ def plot_khat(
20
20
  figsize,
21
21
  xdata,
22
22
  khats,
23
+ good_k,
23
24
  kwargs,
24
25
  threshold,
25
26
  coord_labels,
@@ -61,8 +62,11 @@ def plot_khat(
61
62
  backend_kwargs.setdefault("figsize", figsize)
62
63
  backend_kwargs["squeeze"] = True
63
64
 
65
+ if good_k is None:
66
+ good_k = 0.7
67
+
64
68
  hlines_kwargs = matplotlib_kwarg_dealiaser(hlines_kwargs, "hlines")
65
- hlines_kwargs.setdefault("hlines", [0, 0.5, 0.7, 1])
69
+ hlines_kwargs.setdefault("hlines", [0, good_k, 1])
66
70
  hlines_kwargs.setdefault("linestyle", [":", "-.", "--", "-"])
67
71
  hlines_kwargs.setdefault("alpha", 0.7)
68
72
  hlines_kwargs.setdefault("zorder", -1)
@@ -102,7 +106,7 @@ def plot_khat(
102
106
  rgba_c = cmap(norm_fun(color))
103
107
 
104
108
  khats = khats if isinstance(khats, np.ndarray) else khats.values.flatten()
105
- alphas = 0.5 + 0.2 * (khats > 0.5) + 0.3 * (khats > 1)
109
+ alphas = 0.5 + 0.2 * (khats > good_k) + 0.3 * (khats > 1)
106
110
  rgba_c[:, 3] = alphas
107
111
  rgba_c = vectorized_to_hex(rgba_c)
108
112
  kwargs["c"] = rgba_c
@@ -151,7 +155,7 @@ def plot_khat(
151
155
  )
152
156
 
153
157
  if show_bins:
154
- bin_edges = np.array([ymin, 0.5, 0.7, 1, ymax])
158
+ bin_edges = np.array([ymin, good_k, 1, ymax])
155
159
  bin_edges = bin_edges[(bin_edges >= ymin) & (bin_edges <= ymax)]
156
160
  hist, _, _ = histogram(khats, bin_edges)
157
161
  for idx, count in enumerate(hist):
@@ -440,7 +440,7 @@ def plot_trace(
440
440
  [], [], label="combined", **dealiase_sel_kwargs(plot_kwargs, chain_prop, -1)
441
441
  ),
442
442
  )
443
- ax.figure.axes[0].legend(handles=handles, title="chain", loc="upper right")
443
+ ax.figure.axes[1].legend(handles=handles, title="chain", loc="upper right")
444
444
 
445
445
  if axes is None:
446
446
  axes = np.array(ax.figure.axes).reshape(-1, 2)
@@ -80,7 +80,7 @@ def plot_bpv(
80
80
  hdi_prob : float, optional
81
81
  Probability for the highest density interval for the analytical reference distribution when
82
82
  ``kind=u_values``. Should be in the interval (0, 1]. Defaults to the
83
- rcParam ``stats.hdi_prob``. See :ref:`this section <common_hdi_prob>` for usage examples.
83
+ rcParam ``stats.ci_prob``. See :ref:`this section <common_hdi_prob>` for usage examples.
84
84
  color : str, optional
85
85
  Matplotlib color
86
86
  grid : tuple, optional
@@ -202,7 +202,7 @@ def plot_bpv(
202
202
  raise TypeError("`reference` argument must be either `analytical`, `samples`, or `None`")
203
203
 
204
204
  if hdi_prob is None:
205
- hdi_prob = rcParams["stats.hdi_prob"]
205
+ hdi_prob = rcParams["stats.ci_prob"]
206
206
  elif not 1 >= hdi_prob > 0:
207
207
  raise ValueError("The value of hdi_prob should be in the interval (0, 1]")
208
208
 
@@ -209,7 +209,7 @@ def plot_density(
209
209
  )
210
210
 
211
211
  if hdi_prob is None:
212
- hdi_prob = rcParams["stats.hdi_prob"]
212
+ hdi_prob = rcParams["stats.ci_prob"]
213
213
  elif not 1 >= hdi_prob > 0:
214
214
  raise ValueError("The value of hdi_prob should be in the interval (0, 1]")
215
215
 
@@ -67,7 +67,7 @@ def plot_dot(
67
67
  The shape of the marker. Valid for matplotlib backend.
68
68
  hdi_prob : float, optional
69
69
  Valid only when point_interval is True. Plots HDI for chosen percentage of density.
70
- Defaults to ``stats.hdi_prob`` rcParam. See :ref:`this section <common_hdi_prob>`
70
+ Defaults to ``stats.ci_prob`` rcParam. See :ref:`this section <common_hdi_prob>`
71
71
  for usage examples.
72
72
  rotated : bool, default False
73
73
  Whether to rotate the dot plot by 90 degrees.
@@ -151,7 +151,7 @@ def plot_dot(
151
151
  values.sort()
152
152
 
153
153
  if hdi_prob is None:
154
- hdi_prob = rcParams["stats.hdi_prob"]
154
+ hdi_prob = rcParams["stats.ci_prob"]
155
155
  elif not 1 >= hdi_prob > 0:
156
156
  raise ValueError("The value of hdi_prob should be in the interval (0, 1]")
157
157
 
@@ -0,0 +1,364 @@
1
+ """Plot ecdf or ecdf-difference plot with confidence bands."""
2
+
3
+ import warnings
4
+
5
+ import numpy as np
6
+ from scipy.stats import uniform
7
+
8
+ try:
9
+ from scipy.stats import ecdf as scipy_ecdf
10
+ except ImportError:
11
+ scipy_ecdf = None
12
+
13
+ from ..rcparams import rcParams
14
+ from ..stats.ecdf_utils import ecdf_confidence_band, _get_ecdf_points
15
+ from ..utils import BehaviourChangeWarning
16
+ from .plot_utils import get_plotting_function
17
+
18
+
19
+ def plot_ecdf(
20
+ values,
21
+ values2=None,
22
+ eval_points=None,
23
+ cdf=None,
24
+ difference=False,
25
+ confidence_bands=False,
26
+ ci_prob=None,
27
+ num_trials=500,
28
+ rvs=None,
29
+ random_state=None,
30
+ figsize=None,
31
+ fill_band=True,
32
+ plot_kwargs=None,
33
+ fill_kwargs=None,
34
+ plot_outline_kwargs=None,
35
+ ax=None,
36
+ show=None,
37
+ backend=None,
38
+ backend_kwargs=None,
39
+ npoints=100,
40
+ pointwise=False,
41
+ fpr=None,
42
+ pit=False,
43
+ **kwargs,
44
+ ):
45
+ r"""Plot ECDF or ECDF-Difference Plot with Confidence bands.
46
+
47
+ Plots of the empirical cumulative distribution function (ECDF) of an array. Optionally, A `cdf`
48
+ argument representing a reference CDF may be provided for comparison using a difference ECDF
49
+ plot and/or confidence bands.
50
+
51
+ Alternatively, the PIT for a single dataset may be visualized.
52
+
53
+ Notes
54
+ -----
55
+ This plot computes the confidence bands with the simulated based algorithm presented in [1]_.
56
+
57
+ Parameters
58
+ ----------
59
+ values : array-like
60
+ Values to plot from an unknown continuous or discrete distribution.
61
+ values2 : array-like, optional
62
+ values to compare to the original sample.
63
+
64
+ .. deprecated:: 0.18.0
65
+ Instead use ``cdf=scipy.stats.ecdf(values2).cdf.evaluate``.
66
+ cdf : callable, optional
67
+ Cumulative distribution function of the distribution to compare the original sample.
68
+ The function must take as input a numpy array of draws from the distribution.
69
+ difference : bool, default False
70
+ If True then plot ECDF-difference plot otherwise ECDF plot.
71
+ confidence_bands : str or bool
72
+
73
+ - False: No confidence bands are plotted (default).
74
+ - True: Plot bands computed with the default algorithm (subject to change)
75
+ - "pointwise": Compute the pointwise (i.e. marginal) confidence band.
76
+ - "simulated": Use Monte Carlo simulation to estimate a simultaneous confidence
77
+ band.
78
+
79
+ For simultaneous confidence bands to be correctly calibrated, provide `eval_points` that
80
+ are not dependent on the `values`.
81
+ ci_prob : float, default 0.94
82
+ The probability that the true ECDF lies within the confidence band. If `confidence_bands`
83
+ is "pointwise", this is the marginal probability instead of the joint probability.
84
+ eval_points : array-like, optional
85
+ The points at which to evaluate the ECDF. If None, `npoints` uniformly spaced points
86
+ between the data bounds will be used.
87
+ rvs: callable, optional
88
+ A function that takes an integer `ndraws` and optionally the object passed to
89
+ `random_state` and returns an array of `ndraws` samples from the same distribution
90
+ as the original dataset. Required if `method` is "simulated" and variable is discrete.
91
+ random_state : int, numpy.random.Generator or numpy.random.RandomState, optional
92
+ num_trials : int, default 500
93
+ The number of random ECDFs to generate for constructing simultaneous confidence bands
94
+ (if `confidence_bands` is "simulated").
95
+ figsize : (float,float), optional
96
+ Figure size. If `None` it will be defined automatically.
97
+ fill_band : bool, default True
98
+ If True it fills in between to mark the area inside the confidence interval. Otherwise,
99
+ plot the border lines.
100
+ plot_kwargs : dict, optional
101
+ Additional kwargs passed to :func:`mpl:matplotlib.pyplot.step` or
102
+ :meth:`bokeh.plotting.figure.step`
103
+ fill_kwargs : dict, optional
104
+ Additional kwargs passed to :func:`mpl:matplotlib.pyplot.fill_between` or
105
+ :meth:`bokeh:bokeh.plotting.Figure.varea`
106
+ plot_outline_kwargs : dict, optional
107
+ Additional kwargs passed to :meth:`mpl:matplotlib.axes.Axes.plot` or
108
+ :meth:`bokeh:bokeh.plotting.Figure.line`
109
+ ax :axes, optional
110
+ Matplotlib axes or bokeh figures.
111
+ show : bool, optional
112
+ Call backend show function.
113
+ backend : {"matplotlib", "bokeh"}, default "matplotlib"
114
+ Select plotting backend.
115
+ backend_kwargs : dict, optional
116
+ These are kwargs specific to the backend being used, passed to
117
+ :func:`matplotlib.pyplot.subplots` or :class:`bokeh.plotting.figure`.
118
+ For additional documentation check the plotting method of the backend.
119
+ npoints : int, default 100
120
+ The number of evaluation points for the ecdf or ecdf-difference plots, if `eval_points` is
121
+ not provided or `pit` is `True`.
122
+
123
+ .. deprecated:: 0.18.0
124
+ Instead specify ``eval_points=np.linspace(np.min(values), np.max(values), npoints)``
125
+ unless `pit` is `True`.
126
+ pointwise : bool, default False
127
+
128
+ .. deprecated:: 0.18.0
129
+ Instead use `confidence_bands="pointwise"`.
130
+ fpr : float, optional
131
+
132
+ .. deprecated:: 0.18.0
133
+ Instead use `ci_prob=1-fpr`.
134
+ pit : bool, default False
135
+ If True plots the ECDF or ECDF-diff of PIT of sample.
136
+
137
+ .. deprecated:: 0.18.0
138
+ See below example instead.
139
+
140
+ Returns
141
+ -------
142
+ axes : matplotlib_axes or bokeh_figure
143
+
144
+ References
145
+ ----------
146
+ .. [1] Säilynoja, T., Bürkner, P.C. and Vehtari, A. (2022). Graphical Test for
147
+ Discrete Uniformity and its Applications in Goodness of Fit Evaluation and
148
+ Multiple Sample Comparison. Statistics and Computing, 32(32).
149
+
150
+ Examples
151
+ --------
152
+ In a future release, the default behaviour of ``plot_ecdf`` will change.
153
+ To maintain the original behaviour you should do:
154
+
155
+ .. plot::
156
+ :context: close-figs
157
+
158
+ >>> import arviz as az
159
+ >>> import numpy as np
160
+ >>> from scipy.stats import uniform, norm
161
+ >>>
162
+ >>> sample = norm(0,1).rvs(1000)
163
+ >>> npoints = 100
164
+ >>> az.plot_ecdf(sample, eval_points=np.linspace(sample.min(), sample.max(), npoints))
165
+
166
+ However, seeing this warning isn't an indicator of anything being wrong,
167
+ if you are happy to get different behaviour as ArviZ improves and adds
168
+ new algorithms you can ignore it like so:
169
+
170
+ .. plot::
171
+ :context: close-figs
172
+
173
+ >>> import warnings
174
+ >>> warnings.filterwarnings("ignore", category=az.utils.BehaviourChangeWarning)
175
+
176
+ Plot an ECDF plot for a given sample evaluated at the sample points. This will become
177
+ the new behaviour when `eval_points` is not provided:
178
+
179
+ .. plot::
180
+ :context: close-figs
181
+
182
+ >>> az.plot_ecdf(sample, eval_points=np.unique(sample))
183
+
184
+ Plot an ECDF plot with confidence bands for comparing a given sample to a given distribution.
185
+ We manually specify evaluation points independent of the values so that the confidence bands
186
+ are correctly calibrated.
187
+
188
+ .. plot::
189
+ :context: close-figs
190
+
191
+ >>> distribution = norm(0,1)
192
+ >>> eval_points = np.linspace(*distribution.ppf([0.001, 0.999]), 100)
193
+ >>> az.plot_ecdf(
194
+ >>> sample, eval_points=eval_points,
195
+ >>> cdf=distribution.cdf, confidence_bands=True
196
+ >>> )
197
+
198
+ Plot an ECDF-difference plot with confidence bands for comparing a given sample
199
+ to a given distribution.
200
+
201
+ .. plot::
202
+ :context: close-figs
203
+
204
+ >>> az.plot_ecdf(
205
+ >>> sample, cdf=distribution.cdf,
206
+ >>> confidence_bands=True, difference=True
207
+ >>> )
208
+
209
+ Plot an ECDF plot with confidence bands for the probability integral transform (PIT) of a
210
+ continuous sample. If drawn from the reference distribution, the PIT values should be uniformly
211
+ distributed.
212
+
213
+ .. plot::
214
+ :context: close-figs
215
+
216
+ >>> pit_vals = distribution.cdf(sample)
217
+ >>> uniform_dist = uniform(0, 1)
218
+ >>> az.plot_ecdf(
219
+ >>> pit_vals, cdf=uniform_dist.cdf,
220
+ >>> rvs=uniform_dist.rvs, confidence_bands=True
221
+ >>> )
222
+
223
+ Plot an ECDF-difference plot of PIT values.
224
+
225
+ .. plot::
226
+ :context: close-figs
227
+
228
+ >>> az.plot_ecdf(
229
+ >>> pit_vals, cdf = uniform_dist.cdf, rvs = uniform_dist.rvs,
230
+ >>> confidence_bands = True, difference = True
231
+ >>> )
232
+ """
233
+ if confidence_bands is True:
234
+ if pointwise:
235
+ warnings.warn(
236
+ "`pointwise` has been deprecated. Use `confidence_bands='pointwise'` instead.",
237
+ FutureWarning,
238
+ )
239
+ confidence_bands = "pointwise"
240
+ else:
241
+ confidence_bands = "simulated"
242
+ elif confidence_bands == "simulated" and pointwise:
243
+ raise ValueError("Cannot specify both `confidence_bands='simulated'` and `pointwise=True`")
244
+
245
+ if fpr is not None:
246
+ warnings.warn(
247
+ "`fpr` has been deprecated. Use `ci_prob=1-fpr` or set `rcParam['stats.ci_prob']` to"
248
+ "`1-fpr`.",
249
+ FutureWarning,
250
+ )
251
+ if ci_prob is not None:
252
+ raise ValueError("Cannot specify both `fpr` and `ci_prob`")
253
+ ci_prob = 1 - fpr
254
+
255
+ if ci_prob is None:
256
+ ci_prob = rcParams["stats.ci_prob"]
257
+
258
+ if values2 is not None:
259
+ if cdf is not None:
260
+ raise ValueError("You cannot specify both `values2` and `cdf`")
261
+ if scipy_ecdf is None:
262
+ raise ValueError(
263
+ "The `values2` argument is deprecated and `scipy.stats.ecdf` is not available. "
264
+ "Please use `cdf` instead."
265
+ )
266
+ warnings.warn(
267
+ "`values2` has been deprecated. Use `cdf=scipy.stats.ecdf(values2).cdf.evaluate` "
268
+ "instead.",
269
+ FutureWarning,
270
+ )
271
+ cdf = scipy_ecdf(np.ravel(values2)).cdf.evaluate
272
+
273
+ if cdf is None:
274
+ if confidence_bands:
275
+ raise ValueError("For confidence bands you must specify cdf")
276
+ if difference is True:
277
+ raise ValueError("For ECDF difference plot you must specify cdf")
278
+ if pit:
279
+ raise ValueError("For PIT plot you must specify cdf")
280
+
281
+ values = np.ravel(values)
282
+ values.sort()
283
+
284
+ if pit:
285
+ warnings.warn(
286
+ "`pit` has been deprecated. Specify `values=cdf(values)` instead.",
287
+ FutureWarning,
288
+ )
289
+ values = cdf(values)
290
+ cdf = uniform(0, 1).cdf
291
+ rvs = uniform(0, 1).rvs
292
+ eval_points = np.linspace(1 / npoints, 1, npoints)
293
+
294
+ if eval_points is None:
295
+ warnings.warn(
296
+ "In future versions, if `eval_points` is not provided, then the ECDF will be evaluated"
297
+ " at the unique values of the sample. To keep the current behavior, provide "
298
+ "`eval_points` explicitly.",
299
+ BehaviourChangeWarning,
300
+ )
301
+ if confidence_bands == "simulated":
302
+ warnings.warn(
303
+ "For simultaneous bands to be correctly calibrated, specify `eval_points` "
304
+ "independent of the `values`"
305
+ )
306
+ eval_points = np.linspace(values[0], values[-1], npoints)
307
+ else:
308
+ eval_points = np.asarray(eval_points)
309
+
310
+ if difference or confidence_bands:
311
+ cdf_at_eval_points = cdf(eval_points)
312
+ else:
313
+ cdf_at_eval_points = np.zeros_like(eval_points)
314
+
315
+ x_coord, y_coord = _get_ecdf_points(values, eval_points, difference)
316
+
317
+ if difference:
318
+ y_coord -= cdf_at_eval_points
319
+
320
+ if confidence_bands:
321
+ ndraws = len(values)
322
+ x_bands = eval_points
323
+ lower, higher = ecdf_confidence_band(
324
+ ndraws,
325
+ eval_points,
326
+ cdf_at_eval_points,
327
+ method=confidence_bands,
328
+ prob=ci_prob,
329
+ num_trials=num_trials,
330
+ rvs=rvs,
331
+ random_state=random_state,
332
+ )
333
+
334
+ if difference:
335
+ lower -= cdf_at_eval_points
336
+ higher -= cdf_at_eval_points
337
+ else:
338
+ x_bands, lower, higher = None, None, None
339
+
340
+ ecdf_plot_args = dict(
341
+ x_coord=x_coord,
342
+ y_coord=y_coord,
343
+ x_bands=x_bands,
344
+ lower=lower,
345
+ higher=higher,
346
+ figsize=figsize,
347
+ fill_band=fill_band,
348
+ plot_kwargs=plot_kwargs,
349
+ fill_kwargs=fill_kwargs,
350
+ plot_outline_kwargs=plot_outline_kwargs,
351
+ ax=ax,
352
+ show=show,
353
+ backend_kwargs=backend_kwargs,
354
+ **kwargs,
355
+ )
356
+
357
+ if backend is None:
358
+ backend = rcParams["plot.backend"]
359
+ backend = backend.lower()
360
+
361
+ plot = get_plotting_function("plot_ecdf", "ecdfplot", backend)
362
+ ax = plot(**ecdf_plot_args)
363
+
364
+ return ax