Skip to content

Commit 02aa781

Browse files
Solomon KurzSolomon Kurz
authored andcommitted
punctuation and plot code
1 parent 5c75ad2 commit 02aa781

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

11.Rmd

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ ggplot(data = tibble(x = seq(from = 0, to = 1, by = .01)),
10281028
theme(plot.background = element_rect(fill = "grey92"))
10291029
```
10301030

1031-
McElreath encouraged us to "explore different values for `pbar` and `theta`" (p. 348). Here's a grid of plots with `pbar = c(.25, .5, .75)` and `theta = c(5, 10, 15)`
1031+
McElreath encouraged us to "explore different values for `pbar` and `theta`" (p. 348). Here's a grid of plots with `pbar = c(.25, .5, .75)` and `theta = c(5, 10, 15)`.
10321032

10331033
```{r, fig.width = 5, fig.height = 5}
10341034
# data
@@ -1056,12 +1056,14 @@ If you'd like to see how to make a similar plot in terms of $\alpha$ and $\beta$
10561056

10571057
But remember, we're not fitting a beta model. We're using the beta-binomial. "We're going to bind our linear model to $\bar p$, so that changes in predictor variables change the central tendency of the distribution" (p. 348). The statistical model we'll be fitting follows the form
10581058

1059+
$$
10591060
\begin{align*}
1060-
\text{admit}_i & \sim \operatorname{BetaBinomial} (n_i, \overline p_i, \theta)\\
1061-
\text{logit} (\overline p_i) & = \alpha \\
1061+
\text{admit}_i & \sim \operatorname{BetaBinomial} (n_i, \bar p_i, \theta)\\
1062+
\text{logit} (\bar p_i) & = \alpha \\
10621063
\alpha & \sim \operatorname{Normal} (0, 2) \\
10631064
\theta & \sim \operatorname{Exponential} (1).
10641065
\end{align*}
1066+
$$
10651067

10661068
Here the size $n = \text{applications}$. In case you're confused, yes, our statistical model is not the one McElreath presented at the top of page 348 in the text. If you look closely, the statistical formula he presented does not match up with the one implied by his R code 11.26. Our statistical formula and the `brm()` model we'll be fitting, below, correspond to his R code 11.26.
10671069

@@ -1274,8 +1276,8 @@ ggplot(data = tibble(x = seq(from = 0, to = 12, by = .01)),
12741276
color = canva_pal("Green fields")(4)[3]) +
12751277
scale_x_continuous(NULL, breaks = c(0, mu, 10)) +
12761278
scale_y_continuous(NULL, breaks = NULL) +
1277-
coord_cartesian(xlim = 0:10) +
12781279
ggtitle(expression(paste("Our sweet ", gamma, "(3, 1)"))) +
1280+
coord_cartesian(xlim = 0:10) +
12791281
theme_hc() +
12801282
theme(plot.background = element_rect(fill = "grey92"))
12811283
```

0 commit comments

Comments
 (0)