Skip to content

Commit 0dacd23

Browse files
authored
fix plots (#106)
1 parent 6903d1b commit 0dacd23

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Chapters/Prior_posterior_predictive_checks.qmd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#| echo: false
55
#| warning: false
66
import arviz as az
7+
import arviz_base as azb
78
import arviz_plots as azp
89
import arviz_stats as azs
910
import numpy as np
@@ -340,17 +341,20 @@ counts from 6 onward are also underpredicted. This pattern is an indication of o
340341
```{python}
341342
#| label: fig-ppc_rootogram_crab_poisson
342343
#| fig-cap: "Rootogram showing the uncertainty in the predictions for a Poisson model."
343-
azp.plot_ppc_rootogram(crabs_poisson)
344+
pc = azp.plot_ppc_rootogram(crabs_poisson)
345+
pc.viz["satellite"].plot.item().set_xlim(-0.5, 20)
344346
```
345347

346-
Now we will check the fit for the hurdle model. As expected for a hurdle model we get a perfect fit for the zeros. For the positive values, we still get some deviations, but the fit is better than with the Poisson model. The model predict more values at the tail than observed.
348+
Now we will check the fit for the hurdle model. As expected for a hurdle model we get a perfect fit for the zeros. For the positive values, we still get some deviations, but the fit is better than with the Poisson model.
347349

348350
```{python}
349351
#| label: fig-ppc_rootogram_crab_hurdle_nb
350352
#| fig-cap: "Rootogram showing the uncertainty in the predictions for a Hurdle Negative Binomial model."
351-
azp.plot_ppc_rootogram(crabs_hurdle_nb)
353+
pc = azp.plot_ppc_rootogram(crabs_hurdle_nb)
354+
pc.viz["satellite"].plot.item().set_xlim(-0.5, 20)
352355
```
353356

357+
Both models predict more values in the tail than observed, even if with low probability. For both plots, we restrict the x-range to (0, 20).
354358

355359
### Posterior predictive checks for binary data
356360

0 commit comments

Comments
 (0)