-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.qmd
505 lines (386 loc) · 24.2 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
---
filters:
- quarto
- nameref
nameref:
section-number: true
---
# Preface {.unnumbered}
::: {.callout-note style="color: blue;"}
This is work in progress: At the moment I am working on the practice section of chapter 4, e.g., I have finished $\approx 20\%$ of the book content.
:::
## Content and Goals of this Book {.unnumbered}
This book collects personal notes during reading of Statistical
Rethinking by Richard McElreath. I am using the [second
edition](https://www.routledge.com/Statistical-Rethinking-A-Bayesian-Course-with-Examples-in-R-and-STAN/McElreath/p/book/9780367139919)
published 2020 by [CRC Press](https://en.wikipedia.org/wiki/CRC_Press)
an imprint of Routledge of the Taylor & Francis Group. Additionally I am
using [Statistical Rethinking
2023](https://www.youtube.com/playlist?list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus),
the most recent set of free YouTube video lectures.
You can find links to other material on McElreath's [website about the
book](https://xcelab.net/rm/statistical-rethinking/). Of special
interest for me are the
[brms+tidyverse](https://bookdown.org/content/4857/) and the
[Stan+tidyverse](https://vincentarelbundock.github.io/rethinking2/)
conversion of his code. As I am not very experienced with R and
completely new to Bayesian statistics and their tools this additional
material is for me also very challenging. I am planning to read them
simultaneously (section by section) and will dedicate parallel sections
for their approaches. This has the advantage that the section numbers of
the files conform to the section numbers of the [second edition of the
printed
book](https://www.routledge.com/Statistical-Rethinking-A-Bayesian-Course-with-Examples-in-R-and-STAN/McElreath/p/book/9780367139919).
::: my-watch-out
::: my-watch-out-header
WATCH OUT: This is my personal learning material and is therefore not an
authoritative textbook!
:::
::: my-watch-out-container
I wrote this book as a text for others to read because that forces me to
be become explicit and explain all my learning outcomes more carefully.
Please keep in mind that this text is not written by an expert but by a
learner. In spite of replicating most of the content it may contain many
mistakes. All these misapprehensions and errors are my responsibility.
:::
:::
## Text Passages {.unnumbered}
My text consists mostly of quotes from the first edition of Harris’
book. I converted my kindle book into a PDF file which I copied via the
annotation system in [Zotero](https://www.zotero.org/) into my Quarto
files.
::: my-example
::: my-example-header
::: {#exm-preface-quote}
: Quote
:::
:::
::: my-example-container
> “Bayesian inference is really just counting and comparing of possibilities.” ([McElreath, 2020, p. 20](zotero://select/groups/5243560/items/NFUEVASQ)) ([pdf](zotero://open-pdf/groups/5243560/items/CPFRPHX8?page=39&annotation=JYNC25AE))
:::
:::
\@exm-preface-quote has links to my PDF and also to my annotation of
the PDF. These links are a practical way for me to get the context of
the quote. But as the linked PDF is saved locally at my hard disk these
links do not work for you! (There is an option about [Zotero
groups](https://www.zotero.org/groups) to share files, but the PDF is
not free to use and so I can't offer this possibility.)
Often I made minor editing (e.g., shorting the text) or put the content
in my own wording. In this case I couldn't quote the text as it does not
represent a specific annotation in my Zotero file. In this case I ended
the paraphrase with `(McElreath ibid.)`.
In any case most of the text in this Quarto book is not mine but coming
from different resources (McElreath’ book or video lectures, [Kurz’ website](https://bookdown.org/content/4857/), R help files, packages vignettes, …). Most of
the time I have put my own personal notes into a notes box as shown in
@exm-preface-note.
::: my-example
::: my-example-header
::: {#exm-preface-note}
: Personal note
:::
:::
::: my-example-container
::: my-note
::: my-note-header
::: {#cor-preface-note-example}
: This is a personal note
:::
:::
::: my-note-container
In this kind of box I will write my personal thoughts and reflections.
Usually this box will appear stand-alone (without the wrapping example
box).
:::
:::
:::
:::
In any case I am the only responsible person for this text, especially
if I have used code from the resources wrongly or misunderstood a quoted
text passage.
Sections with the
- header "Original" refers to the original book
- header "Tidyverse" refers to the {**tidyverse**} / {**brms**}
conversion
- header "Stan" refers to the {**rstan**} conversion
- header "Reconsideration" refers to sections with my personal
comments.
## Code Chunks {.unnumbered}
Packages {**rethinking**} and {**brms**} have similar tasks. Therefore
they share a lot of identical function name. Kurz has unloaded the
{**rethinking**} package when it came to explain {**brms**} function and
to prevent name conflicts. But this approach is not efficient for the
structure of my documents where I have constantly changed between these
two packages. So I have used the advice "Qualifying namespace" from the [Google’s R Style Guide](https://google.github.io/styleguide/Rguide.html).
Whenever I used a function I called the function with the package name in front with the syntax `<package name>::<function name>()`. Besides preventing conflicts with functions of identical names
from different packages it helps to learn (or remember) which function
belongs to which package. I think this justifies the small overhead and
helps to make R code chunks self-sufficient. (No previous package
loading, or library calls in the setup chunk.) To foster learning the
relation between function and package I embrace the package name with
curly brakes and format it in bold.
To prevent conflicts in chunk names, objects and variables I added the
following suffix to the end of the name:
- suffix `a` for the original book version
- suffix `b` for the {**tidyverse**} / {**brms**} version
To distinguish the models I used
- m<chapter-number>.<running.number>a for the original book version
- m<chapter-number>.<running.number>b for the {**tidyverse**} / {**brms**}
:::::{.my-example}
:::{.my-example-header}
:::::: {#exm-preface-model-name}
: Name of models
::::::
:::
::::{.my-example-container}
- The model name `m4.3a` refers to the third {**rethinking**} model in the fourth chapter.
- The model name `m2.1b` refers to the first {**tidyberse**}/{**brms**} model in the second chapter.
- To refer to graphics, code snippets etc. I have the dot replaced by a dash, for instance `#| label: chap04-precis2-m4-1a` is the chunk label in the fourth chapter using the second version of the `precis` summary for model `m4.1a`.
::::
:::::
I am not using the exact code snippets for my replications because I am
not only replicating the code to see how it works but also to change the
values of parameters to observe their influences.
My focus is on learning Bayesian statistics. Therefore I have not replicated all code snippets from Kurz’ version in case they have no relation to Bayesian statistics but are just graphics explaining general procedures.
This is my first book using [Quarto](https://quarto.org/) instead of
[bookdown](https://bookdown.org/yihui/bookdown/) I am using these notes
therefore also to learn Quarto. As a result you will find sometimes
remarks or call-out blocks to my Quarto experiences.
## Get Code Examples {.unnumbered}
Go to the [book website](https://xcelab.net/rm/statistical-rethinking/)
and download the [R code
examples](http://xcelab.net/rmpubs/sr2/code.txt) for the book.
***
```{r}
#| label: preface-download-code-examples
#| eval: false
#| attr-source: '#lst-preface-download-code-examples lst-cap="Download R code for book examples (not evaluated here)"'
dir.create("R")
download.file("http://xcelab.net/rmpubs/sr2/code.txt", "R/code.R")
```
***
The style of the code snippets is not the [tidyverse
style](https://style.tidyverse.org/index.html). For instance: The equal
sign `=` is not embedded between spaces or a list of variables,
separated by comas has in front and before the coma a space.
I have converted the original code style with the RStudio addin
{**styler**} package to tidyverse style: Assuming that the default value
of the style transformer is `styler::tidyverse_style()` I selected the
code snippet I wanted to convert and called the addin which ran
`styler:::style_selection()`. See @exm-preface-tab-example
To facilitate the comparison of {**rethinking**} and {**tidyberse**}/{**brms**} code I have used tabs. This has the disadvantage that one cannot jump directly to links under the tabs. In this case I have linked to the wrapping example and indicated the specific tab where the R code can be found. With graphic it is easier, because if you hover over the links you see the original graphic in a smaller overlay. This is very convenient for comparison of two different graphics (for instance the same graphic with {**rethinking**} versus {**tidyverse**} coding). Try it out and hover over @fig-preview-code-style-tidyverse.
:::::{.my-example}
:::{.my-example-header}
:::::: {#exm-preface-tab-example}
: Comparison of code snippets in {**rethinking**} and {**tidyverse**} style
::::::
:::
::::{.my-example-container}
::: {.panel-tabset}
###### Original
:::::{.my-r-code}
:::{.my-r-code-header}
:::::: {#cnj-code-name-a}
a: Code snippet 2.7 (rethinking style)
::::::
:::
::::{.my-r-code-container}
```{r}
#| label: fig-preview-code-style-original
#| fig-cap: "Globe tossing data with n = 9 tosses and w = 6 waters. (Produced with rethinking code style)"
## R code 2.7 ###############
# analytical calculation
W <- 6
L <- 3
curve( dbeta( x , W+1 , L+1 ) , from=0 , to=1 )
# quadratic approximation
curve( dnorm( x , 0.67 , 0.16 ) , lty=2 , add=TRUE )
```
::::
:::::
###### Tidyverse
:::::{.my-r-code}
:::{.my-r-code-header}
:::::: {#cnj-code-name-b}
b: Code snippet 2.7 (tidyverse style)
::::::
:::
::::{.my-r-code-container}
```{r}
#| label: fig-preview-code-style-tidyverse
#| fig-cap: "Globe tossing data with n = 9 tosses and w = 6 waters. (Produced with tidyverse code style)"
## R code 2.7 ###############
# analytical calculation
W <- 6
L <- 3
curve(dbeta(x, W + 1, L + 1), from = 0, to = 1)
# quadratic approximation
curve(dnorm(x, 0.67, 0.16), lty = 2, add = TRUE)
```
::::
:::::
:::
::::
:::::
To give a better orientation inside RStudio I have R code snippets segmented as in the example above ("## R code 2.7 ##################"). In RStudio one can detect these lines easy as they are displayed as bold headers. This is very helpful for the navigation inside the Quarto file.
As copy & paste from the slides does not work I downloaded the PDF of
the Speaker deck slides. But still, it didn't work always. In that case
I used [TextSniper](https://textsniper.app/ "App for text recognition")
and formatted manually. But these copy & paste problems only arise when
using new code, prepared for the 3rd edition. With the book (2nd ed.) I
do not have problems to copy the code snippets via [calibre](https://calibre-ebook.com/) with the ePUB eBook version.
## Package Installation {.unnumbered}
In contrast to the sparse and partly outdated remarks in the book use
the installation section from the `rethinking` [package at
GitHub](https://github.com/rmcelreath/rethinking#installation "Installation of 'rethinking' package").
### Step 1 {.unnumbered}
From the three steps I had already successfully installed the first one
(`rstan` and the `C++` toolchain), so I had no need to follow the
detailed instructions of the `rstan` installation at
<https://mc-stan.org/users/interfaces/rstan.html>.
### Step 2 {.unnumbered}
To install the `cmdstanr` package I visited
<https://mc-stan.org/cmdstanr/>. This is an addition to my previous
installation with the older version (2nd ed., 2022). As I installed the
latest beta version of `cmdstanr` the first time I also needed to
compile the libraries with `cmdstanr::install_cmdstan()`.
To check the result of my installation I ran
`check_cmdstan_toolchain()`.
***
```{r}
#| label: preview-install-cmdstanr
#| eval: false
#| attr-source: '#lst-preview-install-cmdstanr lst-cap="Install the `cmdstanr` package (not evaluated here)"'
install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
cmdstanr::install_cmdstan()
cmdstanr::check_cmdstan_toolchain()
```
***
The command for downloaded `cmdstanr` did not install the vignettes,
which take a long time to build, but they are always available online at
<https://mc-stan.org/cmdstanr/articles/>.
The vignette [Getting started with
CmdStanR](https://mc-stan.org/cmdstanr/articles/cmdstanr.html) also
recommend to load the `bayesplot` and `posterior` packages, which are
used later in the `CmdStanR`-examples. But I believe these two packages
are not necessary if you just plan to stick with the book.
### Step 3 {.unnumbered}
Once the infrastructure is installed one can install the packages used
by the book. With the exception of rethinking --- the companion package
of the book -- they can all be downloaded from CRAN.
I had already devtools installed, therefore I deleted it from the list
of installed packages.
***
```{r}
#| label: preview-install-packages
#| eval: false
#| attr-source: '#lst-preview-install-packages lst-cap="Install packages (not evaluated here)"'
install.packages(c("coda","mvtnorm", "loo","dagitty","shape"))
devtools::install_github("rmcelreath/rethinking")
```
***
## Solutions
There are several websites with book solutions. They have different quality and not always exhaustive. For the purpose of comparison I have consulted mostly the following two collection of solutions:
- [Statistical Rethinking: Slution (2nd edition)](https://sr2-solutions.wjakethompson.com/) by [Jake
Thompson](https://github.com/wjakethompson). It seems to me that he is a very experienced data scientist and he also using the {**tidyverse**} style and the {**brms**} package.
- [Statistical Rethinking](https://www.erikkusch.com/courses/rethinking/) by [Erik Kusch](https://www.erikkusch.com/).
- [A Short Guide to Statistical Rethinking²](https://rgoswami.me/posts/some-sol-sr2/) by [Rohit Goswami](https://rgoswami.me/about/).
-
I have also found two GitHub repos with solutions. The result of these solutions are not accessible online. One has to fork these repos and compile them to see the results.
- [GitHub solutions by *Taras
Svirskyi*](https://github.com/jffist/statistical-rethinking-solutions)
*(jffist)*
- [GitHub solutions by William
Wolf](https://github.com/cavaunpeu/statistical-rethinking)
*(cavaunpeu)*
:::::{.my-watch-out}
:::{.my-watch-out-header}
WATCH OUT! Solutions are not authorized by the book author
:::
::::{.my-watch-out-container}
These solutions are written by members of the #RStats community and are
not authorized by Richard McElreath, the author of Statistical
Rethinking.
::::
:::::
:::::{.my-important}
:::{.my-important-header}
Help appreciated!
:::
::::{.my-important-container}
If you find errors in this Quarto book or want to add some comment please do not hesitate to write issues or PRs on my
[GitHub site](https://github.com/petzi53/statistical-rethinking-2-2023).
I really appreciate it to learn from more experienced R users! It
shortens the learning paths of self-directed learners.
::::
:::::
## Course Schedule
The following tables matches the lectures ([videos
2023](https://www.youtube.com/playlist?list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus)
and [slides 2023](https://speakerdeck.com/rmcelreath)) with the book
chapters of the [second edition
(2020)](https://www.amazon.de/Statistical-Rethinking-Bayesian-Examples-Chapman/dp/036713991X/ref=pd_ci_mcx_mh_mcx_views_0?pd_rd_w=0hXcF&content-id=amzn1.sym.0cbf7d14-5630-4ffd-8c03-015d34863840&pf_rd_p=0cbf7d14-5630-4ffd-8c03-015d34863840&pf_rd_r=K9KW83V635VKRVDS2J6S&pd_rd_wg=cRN8V&pd_rd_r=d2928c40-3fdf-4b68-a23b-6d7484f0e11c&pd_rd_i=036713991X).
It was generated by a screenshot from **Statistical Rethinking 2023 -
01 - The Golem of Prague
(**[50:09](https://www.youtube.com/watch?v=FdnMWdICdRs&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=1&t=50m9s)),
but can also be found [as a
slide](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-01?slide=63)
in **Statistical Rethinking 2023 - Lecture 01**.

A better overview with links to videos and slides provides the following
HTML table, taken from the [README.md file for the 2023
lectures](https://github.com/rmcelreath/stat_rethinking_2023/blob/main/README.md#calendar--topical-outline).
:::::{.my-resource}
:::{.my-resource-header}
Links to videos and slides
:::
::::{.my-resource-container}
| Week \## | Meeting date | Reading | Lectures |
|----------------|----------------|----------------|--------------------------|
| Week 01 | 06 January | Chapters 1, 2 and 3 | \[1\] \<[Golem of Prague](https://www.youtube.com/watch?v=FdnMWdICdRs&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=1)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-01)\> <br> \[2\] \<[Garden of Forking Data](https://www.youtube.com/watch?v=R1vcdhPBlXA&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=2)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-02)\> |
| Week 02 | 13 January | Chapter 4 | \[3\] \<[Geocentric Models](https://www.youtube.com/watch?v=tNOu-SEacNU&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=3)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-03)\> <br> \[4\] \<[Categories and Curves](https://www.youtube.com/watch?v=F0N4b7K_iYQ&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=4)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-04)\> |
| Week 03 | 20 January | Chapters 5 and 6 | \[5\] \<[Elemental Confounds](https://www.youtube.com/watch?v=mBEA7PKDmiY&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=5)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-05)\> <br> \[6\] \<[Good and Bad Controls](https://www.youtube.com/watch?v=uanZZLlzKHw&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=6)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-06)\> |
| Week 04 | 27 January | Chapters 7,8,9 | \[7\] \<[Overfitting](https://www.youtube.com/watch?v=1VgYIsANQck&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=7)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-07)\> <br> \[8\] \<[MCMC](https://www.youtube.com/watch?v=rZk2FqX2XnY&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=8)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-08)\> |
| Week 05 | 03 February | Chapters 10 and 11 | \[9\] \<[Modeling Events](https://www.youtube.com/watch?v=Zi6N3GLUJmw&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=9)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-09)\> <br> \[10\] \<[Counts and Confounds](https://www.youtube.com/watch?v=jokxu18egu0&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=10)\> \<[Slides](https://speakerdeck.com/rmcelreath/statistical-rethinking-2023-lecture-10)\> |
| Week 06 | 10 February | Chapters 11 and 12 | \[11\] \<[Ordered Categories](https://www.youtube.com/watch?v=VVQaIkom5D0&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=11)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_11-ord_logit.pdf)\> <br> \[12\] \<[Multilevel Models](https://www.youtube.com/watch?v=iwVqiiXYeC4&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=12)\> \<[Slides](https://raw.githubusercontent.com/rmcelreath/stat_rethinking_2023/main/slides/Lecture_12-GLMM1.pdf)\> |
| Week 07 | 17 February | Chapter 13 | \[13\] \<[Multilevel Adventures](https://www.youtube.com/watch?v=sgqMkZeslxA&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=13)\> \<[Slides](https://raw.githubusercontent.com/rmcelreath/stat_rethinking_2023/main/slides/Lecture_13-GLMM2.pdf)\> <br> \[14\] \<[Correlated Features](https://www.youtube.com/watch?v=Es44-Bp1aKo&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=14)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_14-GLMM3.pdf)\> |
| Week 08 | 24 February | Chapter 14 | \[15\] \<[Social Networks](https://www.youtube.com/watch?v=hnYhJzYAQ60&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=15)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_15-social_networks.pdf)\> <br> \[16\] \<[Gaussian Processes](https://www.youtube.com/watch?v=Y2ZLt4iOrXU&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=16)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_16-gaussian_processes.pdf)\> |
| Week 09 | 03 March | Chapter 15 | \[17\] \<[Measurement](https://www.youtube.com/watch?v=mt9WKbQJrI4&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=17)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_17-measurement.pdf)\> <br> \[18\] \<[Missing Data](https://www.youtube.com/watch?v=Oeq6GChHOzc&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=18)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_18-missing_data.pdf)\> |
| Week 10 | 10 March | Chapters 16 and 17 | \[19\] \<[Generalized Linear Madness](https://www.youtube.com/watch?v=zffwg0xDOgE&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=19)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_19-GenLinearMadness.pdf)\> <br> \[20\] \<[Horoscopes](https://www.youtube.com/watch?v=qwF-st2NGTU&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus&index=20&pp=sAQB)\> \<[Slides](https://github.com/rmcelreath/stat_rethinking_2023/raw/main/slides/Lecture_20-horoscopes.pdf)\> |
::::
:::::
## Some Additional Links
:::::{.my-resource}
:::{.my-resource-header}
Additional material
:::
::::{.my-resource-container}
- You can purchase *Statistical Rethinking: A Bayesian Course in R and
Stan* from [CRC
Press](https://www.routledge.com/Statistical-Rethinking-A-Bayesian-Course-with-Examples-in-R-and-STAN/McElreath/p/book/9780367139919?utm_source=crcpress.com&utm_medium=referral).
- **The `rethinking` package**: Statistical Rethinking course and book
package: <https://github.com/rmcelreath/rethinking>. I am using
version 2.31.
- **Statistical rethinking 2023**: Course material for January -
March 2023. <https://github.com/rmcelreath/stat_rethinking_2023>. It
contains a link to the new [Video playlist
2023](https://www.youtube.com/watch?v=FdnMWdICdRs&list=PLDcUM9US4XdPz-KxHM4XHt7uUVGWWVSus),
and to the [slide deck
collection](https://speakerdeck.com/rmcelreath/). Furthermore it
displays a table with the readings per week including the links to
the appropriate video and slides. The repo also inlcudes [PDFs for
the
homework](https://github.com/petzi53/stat_rethinking_2023/tree/main/homework)
and the [scripts for the lecture
animations](https://github.com/petzi53/stat_rethinking_2023/tree/main/homework).
--- I could not find the new R scripts associated with the (new)
book text. They need to be collected from the slide lectures.
- **Statistical rethinking with brms, ggplot2, and the tidyverse**:
[brms/tidyverse-Conversion](https://bookdown.org/content/4857/) of
Statistical Rethinking using bookdown by *A Solomon Kurz*
(2023-01-26)
- **Functions for Learning Bayesian Inference**: Maybe I should also
check this resource: It is an [R package to learn bayesian
inference](https://cran.r-project.org/package=LearnBayes) with
vignettes as short guides.
::::
:::::