-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpublished-202312-favrot-hierarchical-supp.qmd
39 lines (28 loc) · 2.01 KB
/
published-202312-favrot-hierarchical-supp.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
```{r, message = FALSE, echo = FALSE}
library(ggplot2)
```
## Model adjustment and comparison to the negative binomial model { .unnumbered }
To check the model's fit to the data, we performed a posterior predictive check of our model to check that the data were compatible with the model assumptions. To do so, we computed the probability of exceeding each individual data with the fitted model (2). Note that the number of pest individuals per plant are not available in practice; the data correspond to observed numbers of pest individuals for groups of $N_i$ plants. Based on the posterior probability check (@fig-posterior-pred-check), the computed probabilities were all falling in the range 0.22-0.93 (except for the observations equal to 0, for which the probability of being greater was equal to 1), and were thus not extreme. This result indicates that the model specified is not incompatible with the observed data and that the over-dispersion was correctly taken into account.
We also fitted a new model including a negative binomial distribution instead of a Poisson distribution. The results were almost identical between both types of model (@fig-obs-vs-pred).
```{r, echo = FALSE}
MCMC_samples_of_predictions = readRDS(file = "data/MCMC_samples_of_predictions.rds")
```
```{r fig-S1, echo = FALSE, fig.height = 4}
#| label: fig-posterior-pred-check
#| fig-cap: "Posterior predictive check, The x-axis is on a logarithmic scale and represents the number of aphids increased by 1."
ggplot(MCMC_samples_of_predictions) +
geom_point(aes(x = Y + 1, y = posterior_predictive_check)) +
scale_x_continuous(trans = "log2") +
ylab("Posterior probability") +
xlab("Observed number of aphids") +
facet_wrap(~ model)
```
```{r fig-S2, echo = FALSE, fig.height = 4}
#| label: fig-obs-vs-pred
#| fig-cap: "Observed vs predicted values."
ggplot(MCMC_samples_of_predictions) +
geom_point(aes(x = Y, y = prediction)) +
xlab("Observed number of aphids") +
ylab("Predicted number of aphids") +
facet_wrap(~ model)
```