Skip to content

Commit 44bb2b0

Browse files
committed
Deploying to gh-pages from @ 6b0c5bd 🚀
1 parent 71e3afb commit 44bb2b0

14 files changed

Lines changed: 116 additions & 71 deletions
122 Bytes
Loading
0 Bytes
Loading

articles/Chapter08.html

Lines changed: 88 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

articles/Chapter08.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,28 @@ regression effects will result in an improper posterior distribution.
324324
Hence, a proper prior is required to avoid improper posteriors in case
325325
of separation.
326326

327-
In the examples above we used a very flat but proper prior With a more
328-
informative prior, the autocorrelations of the draws are lower. This can
329-
be seen in the next figure, where the simulated data under
330-
quasi-separation are re-analyzed with a Normal prior that is tighter
331-
around zero.
327+
We now analyse the data under the more informative prior,
328+
\$\Normal(\mathbf{0}, \mathbf{I}}\$. With this prior we assume that both
329+
$P(y = 1)$ and $P(y = 0)$ have a prior probability of $\approx 0.95$ to
330+
be in the interval $\lbrack 0.023,0.977\rbrack$.
332331

333332
``` r
333+
set.seed(1234)
334334
betas.sep1 <- probit(y, X.sep, b0 = 0, B0 = 1)
335335

336+
res_betas.sep1 <-t(apply(betas.sep1, 2, res.mcmc))
337+
knitr::kable(round(res_betas.sep1, 3))
338+
```
339+
340+
| | 2.5% | Posterior mean | 97.5% |
341+
|:------|-------:|---------------:|-------:|
342+
| | -2.853 | -2.352 | -1.921 |
343+
| x.sep | 4.211 | 4.883 | 5.622 |
344+
345+
In this case the autocorrelations are much lower and the effective
346+
sample sizes are roughly 700.
347+
348+
``` r
336349
par(mfrow = c(2, 2), mar = c(2.5, 1.5, 1.5, .1), mgp = c(1.5, .5, 0), lwd = 1.5)
337350

338351
plot(betas.sep1[, 1], type = "l", main = "", xlab = "", ylab = "")
@@ -342,7 +355,7 @@ plot(betas.sep1[, 2], type = "l", main = "", xlab = "", ylab = "")
342355
acf(betas.sep1[, 2])
343356
```
344357

345-
![](Chapter08_files/figure-html/unnamed-chunk-18-1.png)
358+
![](Chapter08_files/figure-html/unnamed-chunk-19-1.png)
346359

347360
``` r
348361

@@ -864,7 +877,7 @@ qqplot(res1$alpha.post, res2$alpha.post, xlab = "Full Gibbs",
864877
abline(a = 0, b = 1)
865878
```
866879

867-
![](Chapter08_files/figure-html/unnamed-chunk-36-1.png)
880+
![](Chapter08_files/figure-html/unnamed-chunk-37-1.png)
868881

869882
## Section 8.3: Beyond i.i.d. Gaussian error distributions
870883

@@ -882,7 +895,7 @@ plot(starsCYG, pch = 19, xlim = c(3, 5), ylim = c(3, 7),
882895
xlab = "log temperature", ylab = "log light intensity")
883896
```
884897

885-
![](Chapter08_files/figure-html/unnamed-chunk-37-1.png)
898+
![](Chapter08_files/figure-html/unnamed-chunk-38-1.png)
886899

887900
The four giant stars which can also be identified in the scatter plot
888901
have the following indices in the data set:
@@ -934,7 +947,7 @@ lines(xnew, preds_subset[, "lwr"], lty = 2)
934947
lines(xnew, preds_subset[, "upr"], lty = 2)
935948
```
936949

937-
![](Chapter08_files/figure-html/unnamed-chunk-40-1.png)
950+
![](Chapter08_files/figure-html/unnamed-chunk-41-1.png)
938951

939952
### Example 8.11: Star cluster data - heteroskedastic regression analysis with known outliers
940953

@@ -1027,7 +1040,7 @@ lines(xnew, apply(pred_hetero, 1, quantile, 0.025), lty = 2)
10271040
lines(xnew, apply(pred_hetero, 1, quantile, 0.975), lty = 2)
10281041
```
10291042

1030-
![](Chapter08_files/figure-html/unnamed-chunk-45-1.png)
1043+
![](Chapter08_files/figure-html/unnamed-chunk-46-1.png)
10311044

10321045
### Example 8.14: Star cluster data - regression analysis with Gaussian two-component mixture errors
10331046

@@ -1107,7 +1120,7 @@ lines(xnew, apply(preds_mix_1, 1, quantile, 0.025), lty = 2)
11071120
lines(xnew, apply(preds_mix_1, 1, quantile, 0.975), lty = 2)
11081121
```
11091122

1110-
![](Chapter08_files/figure-html/unnamed-chunk-50-1.png)
1123+
![](Chapter08_files/figure-html/unnamed-chunk-51-1.png)
11111124

11121125
We now assume that the indices of the giant stars are not known. We only
11131126
assume that a two-component mixture is used as weight distribution where
@@ -1186,7 +1199,7 @@ lines(xnew, apply(preds_mix_2, 1, quantile, 0.025), lty = 2)
11861199
lines(xnew, apply(preds_mix_2, 1, quantile, 0.975), lty = 2)
11871200
```
11881201

1189-
![](Chapter08_files/figure-html/unnamed-chunk-53-1.png)
1202+
![](Chapter08_files/figure-html/unnamed-chunk-54-1.png)
11901203

11911204
Finally, we visualize again the mean and the 95%-HPD region together
11921205
with the data points for the three modeling approaches: (1) a
@@ -1212,7 +1225,7 @@ lines(xnew, apply(preds_mix_2, 1, quantile, 0.025), lty = 2)
12121225
lines(xnew, apply(preds_mix_2, 1, quantile, 0.975), lty = 2)
12131226
```
12141227

1215-
![](Chapter08_files/figure-html/unnamed-chunk-54-1.png)
1228+
![](Chapter08_files/figure-html/unnamed-chunk-55-1.png)
12161229

12171230
The plot indicates that all three modeling approaches result in a fit
12181231
that is robust to the outlying observations.
88.9 KB
Loading
31.7 KB
Loading
30.9 KB
Loading
68.2 KB
Loading
50.3 KB
Loading
51 KB
Loading

0 commit comments

Comments
 (0)