How to ensure our model is not that bad? Posterior predictive checks allow to verify if it captured essential features of data.
## Observed vs. predicted distribution
bayesplot::ppc_dens_overlay(Nemostan$y[,1], prey_rep)
bayesplot::ppc_dens_overlay(Nemostan$y[,2], pred_rep)
## Observed vs. predicted patterns
ggplot() + geom_ribbon(data = prey_quant, alpha = 0.3,
aes(x = 1:nrow(prey_quant), ymin = `10%`, ymax = `90%`)) +
geom_ribbon(data = pred_quant, alpha = 0.3,
aes(x = 1:nrow(pred_quant), ymin = `10%`, ymax = `90%`)) +
geom_point(data = Nemobius, aes(x = times, y = Prey), col = "blue") +
geom_point(data = Nemobius, aes(x = times, y = Pred), col = "red") +
geom_line(data = Nemobius, aes(x = times, y = Prey), col = "blue") +
geom_line(data = Nemobius, aes(x = times, y = Pred), col = "red")