|
1 | | ---- |
| 1 | +'--- |
2 | 2 | title: "Chapter 5: Learning More About Bayesian Learning" |
3 | 3 | output: rmarkdown::html_vignette |
4 | 4 | vignette: > |
@@ -28,7 +28,7 @@ par(mgp = c(1.6, .6, 0), mar = c(2.6, 2.6, 2.6, .4), lwd = 1) |
28 | 28 | ## Example 5.3 / Figure 5.1: The adaptive nature of Bayesian learning |
29 | 29 |
|
30 | 30 | We illustrate the adaptive nature of Bayesian learning (also referred to |
31 | | -as *sequential updating* or *on-line learning*) via the beta-Bernoulli model |
| 31 | +as *sequential updating* or *on-line learning*) via the Beta-Bernoulli model |
32 | 32 | from earlier. |
33 | 33 |
|
34 | 34 | ```{r, echo=-(1:2)} |
@@ -56,7 +56,7 @@ for (i in seq_along(thetatrue)) { |
56 | 56 | lines(theta, dbeta(theta, a0 + succ, b0 + fail), col = rgb(0, 0, 0, .2 + .4*j/N)) |
57 | 57 | } |
58 | 58 | |
59 | | - legend('topright', paste("N =", c(0, 20, 40, 60, 80, 100)), lty = 1, |
| 59 | + legend("topright", paste("N =", c(0, 20, 40, 60, 80, 100)), lty = 1, |
60 | 60 | col = rgb(0, 0, 0, .2 + .4*c(0, 20, 40, 60, 80, 100)/N)) |
61 | 61 | } |
62 | 62 | ``` |
@@ -264,7 +264,7 @@ abline(h = e, lty = 2) |
264 | 264 | ## Figure 5.4: Bayesian asymptotics 1 |
265 | 265 |
|
266 | 266 | To reproduce this figure, we again re-use the theory from Chapter 3 (the |
267 | | -beta-Bernoulli model). |
| 267 | +Beta-Bernoulli model). |
268 | 268 |
|
269 | 269 | ```{r, echo=-(1:2)} |
270 | 270 | if (pdfplots) { |
@@ -376,7 +376,7 @@ We now compute various point estimates under several settings. Note that we |
376 | 376 | use the same number of 1s ($S_N$) as before. |
377 | 377 |
|
378 | 378 | ```{r} |
379 | | -options(knitr.kable.NA = '') |
| 379 | +options(knitr.kable.NA = "") |
380 | 380 | a0 <- c(1, 2) |
381 | 381 | b0 <- c(1, 4) |
382 | 382 | set <- expand.grid(N = N, thetatrue = thetatrue, a0 = a0) |
@@ -427,7 +427,7 @@ res <- cbind(res[,1:3], leftconf, rightconf, leftHPD, rightHPD) |
427 | 427 | knitr::kable(round(res, 3)) |
428 | 428 | ``` |
429 | 429 |
|
430 | | -## Example 5.10 / Table 5.3: Coverage probabilities under the beta-Bernoulli model |
| 430 | +## Example 5.10 / Table 5.3: Coverage probabilities under the Beta-Bernoulli model |
431 | 431 | For a (frequentist) estimate of the coverage probabilities, we simulate |
432 | 432 | many data sets for each of the parameter configurations and check how often |
433 | 433 | the intervals contain the true parameter. |
@@ -486,7 +486,7 @@ res <- cbind(res[,1:2], |
486 | 486 | knitr::kable(round(res, 2)) |
487 | 487 | ``` |
488 | 488 |
|
489 | | -## Example 5.11: Coverage probabilities under the Poisson-gamma model |
| 489 | +## Example 5.11: Coverage probabilities under the Poisson-Gamma model |
490 | 490 |
|
491 | 491 | As above, but for data from a $\mathcal{P}(5)$-distribution. We |
492 | 492 | estimate the mean from $N = 24$ data points and construct CIs. |
@@ -517,7 +517,7 @@ rightconf2 <- means + qnorm(1 - alpha / 2) * sqrt(vars / N) |
517 | 517 | inconf2 <- leftconf2 <= mutrue & mutrue <= rightconf2 |
518 | 518 | ``` |
519 | 519 |
|
520 | | -For the Baysian variants, we look compute the equal-tailed and the HPD intervals. |
| 520 | +For the Bayesian variants, we compute the equal-tailed and the HPD intervals. |
521 | 521 |
|
522 | 522 | ```{r} |
523 | 523 | leftequal <- qgamma(alpha / 2, N * means + 1, N) |
|
0 commit comments