class: center, middle, title-slide .title[ # Practical 4 ] .author[ ### Olivier Gimenez ] .date[ ### last updated: 2024-10-17 ] --- ## Prior predictive checks * Make sure you can reproduce the figures of the corresponding lecture slides * Consider a linear regression with unreasonable and reasonable priors * Consider a logistic regression with unreasonable and reasonable priors --- ## Solutions --- ## Linear regression * Unreasonable prior `\(\beta \sim N(0, 1000^2)\)` .center[ ``` r plot(density(rnorm(1000, 0, 1000)), main="", xlab="Height (m)") ``` ![](practical4_files/figure-html/unnamed-chunk-1-1.svg)<!-- --> ] --- ## Linear regression * Reasonable prior `\(\beta \sim N(2, 0.5^2)\)` .center[ ``` r plot(density(rnorm(1000, 2, 0.5)), main="", xlab="Height (m)") ``` ![](practical4_files/figure-html/unnamed-chunk-2-1.svg)<!-- --> ] --- ## Logistic regression * Unreasonable prior `\(\text{logit}(\phi) = \beta \sim N(0, 10^2)\)` .center[ ``` r plot(density(plogis(rnorm(1000,0,10)), from = 0, to = 1), main = '', xlab = 'survival') ``` ![](practical4_files/figure-html/unnamed-chunk-3-1.svg)<!-- --> ] --- ## Logistic regression * Reasonable prior `\(\text{logit}(\phi) = \beta \sim N(0, 1.5^2)\)` .center[ ``` r plot(density(plogis(rnorm(1000,0,1.5)), from = 0, to = 1), main = '', xlab = 'survival') ``` ![](practical4_files/figure-html/unnamed-chunk-4-1.svg)<!-- --> ]