class: center, middle, inverse, title-slide # SBC Intro ### Martin Modrák ### 2021/08/24 (updated: 2021-08-31) --- <img src="elixir_logo.png" width="780px" height="auto" /> This work was supported by ELIXIR CZ research infrastructure project (MEYS Grant No: LM2018131) including access to computing and storage facilities. --- # Context -- - SBC can be a useful tool to check you implemented your model correctly. -- - It just one of tools to validate your model in a Bayesian workflow -- - SBC can be run even before you collect data -- - The goal of this tutorial is to show you that with the `SBC` package, there is little cost to including (some form of) SBC in your everyday modelling workflow. -- - In this tutorial, we'll let you use SBC to find and diagnose a bug. -- - We will show toy problems, but have applied it to non-toy problems as well. --- # Two types of problems with Stan model 1. Bug in model -- 2. Data - model mismatch -- We will focus on 1. --- # Result of SBC (1) ### SBC fails: There is a mismatch between our model, algorithm and simulator. !(sbc_intro_short_files/figure-html/unnamed-chunk-2-1.png)<!-- --> -- The mismatch can be anywhere! --- # Result of SBC (2) ### SBC passes: To the precision availabe with the given number of simulations, our model, algorithm and simulator are consistent. !(sbc_intro_short_files/figure-html/unnamed-chunk-3-1.png)<!-- --> -- For a specific sense of consistent. Nothing more, nothing less.