@@ -6,7 +6,7 @@ date-format: "[Last modified on] MMMM DD, YYYY HH:mm:ss zzz"
6
6
format :
7
7
html : default
8
8
pdf : default
9
- editor : visual
9
+ editor : source
10
10
---
11
11
12
12
``` {r include = FALSE}
@@ -89,7 +89,7 @@ Create a visual model of these data (a graph) that will allow you to conduct an
89
89
:::
90
90
91
91
::: {.callout-important icon="false" collapse="false" title="Problem 2 Answers"}
92
- * Delete this and put your text answer here.
92
+ - Delete this and put your text answer here.
93
93
:::
94
94
95
95
::: {.callout-note icon="false" title="Problem 3"}
@@ -108,15 +108,15 @@ What does the intercept mean in this regression table?
108
108
:::
109
109
110
110
::: {.callout-important icon="false" collapse="false" title="Problem 4 Answers"}
111
- * Delete this and put your text answer here.
111
+ - Delete this and put your text answer here.
112
112
:::
113
113
114
114
::: {.callout-note icon="false" title="Problem 5"}
115
115
What does the model estimate as the number of hate crimes per 100,000 people in states with "low" Trump support?
116
116
:::
117
117
118
118
::: {.callout-important icon="false" collapse="false" title="Problem 5 Answers"}
119
- * Delete this and put your text answer here.
119
+ - Delete this and put your text answer here.
120
120
121
121
``` {r}
122
122
# Type your code and comments inside the code chunk
@@ -134,7 +134,7 @@ Does the model estimate that hate crimes are more frequent in states that show "
134
134
135
135
```
136
136
137
- * Delete this and put your text answer here.
137
+ - Delete this and put your text answer here.
138
138
:::
139
139
140
140
::: {.callout-note icon="false" title="Problem 7"}
@@ -147,7 +147,7 @@ How much greater were hate crimes in "medium" Trump-support states compared to "
147
147
148
148
```
149
149
150
- * Delete this and put your text answer here.
150
+ - Delete this and put your text answer here.
151
151
:::
152
152
153
153
::: {.callout-note icon="false" title="Problem 8"}
@@ -160,25 +160,25 @@ What are the three possible fitted values $\hat{y}$ for this model? Hint: use th
160
160
161
161
```
162
162
163
- * Delete this and put your text answer here.
163
+ - Delete this and put your text answer here.
164
164
165
- * Delete this and put your text answer here.
165
+ - Delete this and put your text answer here.
166
166
167
- * Delete this and put your text answer here.
167
+ - Delete this and put your text answer here.
168
168
:::
169
169
170
170
::: {.callout-note icon="false" title="Problem 9"}
171
171
Below we calculate the group means of hate crimes for the ` high ` , ` medium ` and ` low ` levels of Trump support. How do these numbers compare to the three possible fitted values $\widehat{y}$ for this model?
172
172
173
173
``` {r}
174
- hate_crimes %>%
175
- group_by(trump_support) %>%
174
+ hate_crimes |>
175
+ group_by(trump_support) |>
176
176
summarize(mean_hate_crimes = mean(hate_crimes, na.rm = TRUE))
177
177
```
178
178
:::
179
179
180
180
::: {.callout-important icon="false" collapse="false" title="Problem 9 Answers"}
181
- * Delete this and put your text answer here.
181
+ - Delete this and put your text answer here.
182
182
:::
183
183
184
184
## The Regression Equation
@@ -189,7 +189,6 @@ The regression equation for this model is the following (render the document and
189
189
hate_mod <- lm(hate_crimes ~ trump_support, data = hate_crimes)
190
190
```
191
191
192
-
193
192
$$
194
193
\widehat{\text{hate\_crimes}} = `r coef(hate_mod)[1]` + `r coef(hate_mod)[2]` \times 1_{\text{low support}}(x) + `r coef(hate_mod)[3]` \times 1_{\text{med support}}(x)
195
194
$$
@@ -233,14 +232,14 @@ Solve the regression equation for a state in which `trump_support` is "high".
233
232
:::
234
233
235
234
::: {.callout-important icon="false" collapse="false" title="Problem 10 Answers"}
236
- Your $LaTeX$ here
235
+ Your $LaTeX$ here
237
236
238
237
``` {r}
239
238
# Type your code and comments inside the code chunk
240
239
241
240
```
242
241
243
- * Delete this and put your text answer here.
242
+ - Delete this and put your text answer here.
244
243
:::
245
244
246
245
::: {.callout-note icon="false" title="Problem 11"}
@@ -255,7 +254,7 @@ Do these results surprise you? (There is no right answer to this question.)
255
254
256
255
```
257
256
258
- * Delete this and put your text answer here.
257
+ - Delete this and put your text answer here.
259
258
:::
260
259
261
260
# Hate Crimes and Unemployment
@@ -292,7 +291,6 @@ Write out the regression equation for `job_mod`.
292
291
:::
293
292
294
293
::: {.callout-important icon="false" collapse="false" title="Problem 14 Answers"}
295
-
296
294
Write your equation with $LaTeX$ here.
297
295
:::
298
296
@@ -301,12 +299,11 @@ Interpret the estimate of the intercept from the table below.
301
299
:::
302
300
303
301
::: {.callout-important icon="false" collapse="false" title="Problem 15 Answers"}
304
- * Delete this and put your text answer here.
302
+ - Delete this and put your text answer here.
305
303
:::
306
304
307
305
::: {.callout-note icon="false" title="Problem 16"}
308
306
What does the model estimate the number of hate crimes per 100,000 people to be in a state with "low" unemployment?
309
-
310
307
:::
311
308
312
309
::: {.callout-important icon="false" collapse="false" title="Problem 16 Answers"}
@@ -315,7 +312,7 @@ What does the model estimate the number of hate crimes per 100,000 people to be
315
312
316
313
```
317
314
318
- * Delete this and put your text answer here.
315
+ - Delete this and put your text answer here.
319
316
:::
320
317
321
318
::: {.callout-note icon="false" title="Problem 17"}
@@ -328,7 +325,7 @@ What are the two possible fitted values $\widehat{y}$ for this model? Why are th
328
325
329
326
```
330
327
331
- * Delete this and put your text answer here.
328
+ - Delete this and put your text answer here.
332
329
:::
333
330
334
331
::: {.callout-note icon="false" title="Problem 18"}
@@ -341,7 +338,7 @@ Use the `get_regression_points()` function to generate a table showing the fitte
341
338
342
339
```
343
340
344
- * Delete this and put your text answer here.
341
+ - Delete this and put your text answer here.
345
342
:::
346
343
347
344
# Hate Crimes and Household Income
@@ -362,7 +359,7 @@ Were there more hate crimes in areas with high or low median household incomes?
362
359
:::
363
360
364
361
::: {.callout-important icon="false" collapse="false" title="Problem 20 Answers"}
365
- * Delete this and put your text answer here.
362
+ - Delete this and put your text answer here.
366
363
:::
367
364
368
365
::: {.callout-note icon="false" title="Problem 21"}
@@ -386,7 +383,7 @@ Take a look at data for Maine (row 2 of `hate_crimes`). Did the model (`job_med_
386
383
387
384
```
388
385
389
- * Delete this and put your text answer here.
386
+ - Delete this and put your text answer here.
390
387
:::
391
388
392
389
# ** EXTRA**
@@ -398,7 +395,7 @@ Take a look at data for Maine (row 2 of `hate_crimes`). Did the model (`job_med_
398
395
#| fig-cap: "Hate crimes in relation to Trump support"
399
396
# Reordering trump_support
400
397
library(forcats)
401
- hate_crimes <- hate_crimes %>%
398
+ hate_crimes <- hate_crimes |>
402
399
mutate(trump_support = fct_relevel(trump_support,
403
400
"low", "medium", "high"))
404
401
ggplot(data = hate_crimes, aes(x = trump_support, y = hate_crimes)) +
0 commit comments