-
Notifications
You must be signed in to change notification settings - Fork 24
/
02-class.Rmd
269 lines (167 loc) Β· 4.81 KB
/
02-class.Rmd
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
---
title: "Class 2: Regression and inference"
author: "Andrew Heiss"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
lib_dir: "libs"
chakra: "libs/remark-latest.min.js"
css: ["default", "css/ath-slides.css", "css/ath-inferno-fonts.css", "css/animate.css"]
seal: false
anchor_sections: false
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
ratio: "16:9"
navigation:
scroll: false
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = FALSE, message = FALSE,
fig.retina = 3, fig.align = "center")
```
```{r packages-data, include=FALSE}
library(tidyverse)
library(broom)
library(patchwork)
```
```{r xaringanExtra, echo=FALSE}
xaringanExtra::use_xaringan_extra(c("tile_view"))
```
class: center middle main-title section-title-3
# In-person<br>session 2
.class-info[
**August 29, 2022**
.light[PMAP 8521: Program evaluation<br>
Andrew Young School of Policy Studies
]
]
---
name: outline
class: title title-inv-8
# Plan for today
--
.box-6.medium.sp-after-half[R FAQs]
--
.box-5.medium.sp-after-half[Regression FAQs]
--
.box-2.medium.sp-after-half[Transforming data with **dplyr**]
--
.box-1.medium[Regression with R]
---
layout: false
name: r-faqs
class: center middle section-title section-title-6 animated fadeIn
# R FAQs
---
layout: true
class: middle
---
.box-6.large[RStudio fun]
---
.box-6.large[Column types]
.box-inv-6[Numeric, continuous, count, ordinal, interval,<br>qualitative, categorical, a billion other inconsistent names]
---
.box-6.large[File paths, working directories,<br>and RStudio projects]
???
- <https://www.theverge.com/22684730/students-file-folder-directory-structure-education-gen-z>
- Working directories and RStudio projects
---
.box-6.large[The hyperliterality of computers]
---
.box-6.large[R Markdown fun]
???
- Markdown metadata and outputs, figure sizes
- Show final Rmd products. Explanatory, like blog post code through or a problem set vs. stand-alone research paper
---
.box-6.large[Fun with histograms]
---
.box-6.large[Logging]
???
<https://stats.stackexchange.com/a/18639/3025>
---
layout: false
name: regression-faqs
class: center middle section-title section-title-5 animated fadeIn
# Regression FAQs
---
layout: true
class: middle
---
.box-5.large[Regression equations]
.box-inv-5[And is the intercept ever useful,<br>or should we always ignore it?]
???
<https://evalf22.classes.andrewheiss.com/slides/02-slides.html#38>
<https://www.andrewheiss.com/blog/2022/05/20/marginalia/#regression-sliders-switches-and-mixing-boards>
---
.box-5.medium.sp-after[Why use two steps to create a regression in R?<br>(i.e. assigning it to an object with `<-`?)]
.box-5.medium[Why use `tidy()`<br>from the broom package?]
???
Show model with `lm()`; show t-test with `t.test()`; show both through `tidy()`
Use **marginaleffects**
---
.box-5.medium[How was the 0.05 significance<br>threshold determined?]
.box-5.medium[Could we say something is significant<br>if p > 0.05, but just note that it is at<br>a higher p-value?<br>Or does it have to fall under 0.05?]
---
.box-5.large[Why all this convoluted<br>logic of null worlds?]
---
layout: false
class: title title-5
# Different "dialects" of statistics
.pull-left[
.box-5.medium[Frequentist]
$$P(\text{data} \mid H_0)$$
.box-inv-5["Regular" statistics;<br>what you've learned<br><small>(and are learning here)</small>]
]
--
.pull-right[
.box-5.medium[Bayesian]
$$P(H \mid \text{data})$$
.box-inv-5[Requires lots of<br>computational power]
]
---
layout: true
class: middle
---
.box-5.medium[Do we care about the actual coefficients<br>or just whether or not they're significant?]
.box-5.medium[How does significance relate to causation?]
.box-5.medium[If we can't use statistics to assert causation<br>how are we going to use this information<br>in program evaluation?]
---
.box-5.large[What counts as a "good" RΒ²?]
---
.center[
<figure>
<img src="img/02-class/nice-plot-1.png" alt="Euler diagram" title="Euler diagram" width="45%">
</figure>
]
---
.center[
<figure>
<img src="img/02-class/plot-diagram-prediction-1.png" alt="R2 prediction" title="R2 prediction" width="75%">
</figure>
]
---
.center[
<figure>
<img src="img/02-class/plot-diagram-estimation-1.png" alt="R2 estimation" title="R2 estimation" width="75%">
</figure>
]
---
.center[
<figure>
<img src="img/02-class/prediction-vs-estimation.jpg" alt="R2 estimation vs prediction" title="R2 estimation vs prediction" width="100%">
</figure>
]
---
layout: false
name: dplyr
class: center middle section-title section-title-2 animated fadeIn
# Transforming<br>data with dplyr
---
layout: false
name: ggplot
class: center middle section-title section-title-1 animated fadeIn
# Regression with R