-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPS06_source.html
More file actions
1271 lines (1240 loc) · 64.4 KB
/
PS06_source.html
File metadata and controls
1271 lines (1240 loc) · 64.4 KB
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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.3.433">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Your Name">
<title>Problem Set 06</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="PS06_source_files/libs/clipboard/clipboard.min.js"></script>
<script src="PS06_source_files/libs/quarto-html/quarto.js"></script>
<script src="PS06_source_files/libs/quarto-html/popper.min.js"></script>
<script src="PS06_source_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="PS06_source_files/libs/quarto-html/anchor.min.js"></script>
<link href="PS06_source_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="PS06_source_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="PS06_source_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="PS06_source_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="PS06_source_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
</head>
<body>
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<div class="quarto-alternate-formats"><h2>Other Formats</h2><ul><li><a href="PS06_source.pdf"><i class="bi bi-file-pdf"></i>PDF</a></li></ul></div></div>
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Problem Set 06</h1>
</div>
<div class="quarto-title-meta">
<div>
<div class="quarto-title-meta-heading">Author</div>
<div class="quarto-title-meta-contents">
<p>Your Name </p>
</div>
</div>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">Last modified on January 19, 2025 12:15:41 Eastern Standard Time</p>
</div>
</div>
</div>
</header>
<section id="background" class="level1">
<h1>Background</h1>
<p>We will again use the hate crimes data we used in Problem Set 05. The FiveThirtyEight article about those data are in the Jan 23, 2017 <a href="https://fivethirtyeight.com/features/higher-rates-of-hate-crimes-are-tied-to-income-inequality/">“Higher Rates Of Hate Crimes Are Tied To Income Inequality.”</a> This week, we will use these data to run regression models with a single categorical predictor (explanatory) variable <strong>and</strong> a single numeric predictor (explanatory) variable.</p>
<section id="setup" class="level2">
<h2 class="anchored" data-anchor-id="setup">Setup</h2>
<p>First load the necessary packages:</p>
<div class="callout callout-style-default callout-caution no-icon callout-titled" title="R Code">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
R Code
</div>
</div>
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ggplot2)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(dplyr)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(moderndive)</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(readr)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
<p>The following code uses the function <code>read_csv()</code> to read in the data and store the information in an object named <code>hate_crimes</code>.</p>
<div class="callout callout-style-default callout-caution no-icon callout-titled" title="R Code">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
R Code
</div>
</div>
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>url <span class="ot"><-</span> <span class="st">"http://bit.ly/2ItxYg3"</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span>(<span class="sc">!</span><span class="fu">dir.exists</span>(<span class="st">"./data/"</span>)){</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">dir.create</span>(<span class="st">"./data/"</span>)</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span>(<span class="sc">!</span><span class="fu">file.exists</span>(<span class="st">"./data/hate_crimes.csv"</span>)){</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">download.file</span>(url, <span class="at">destfile =</span> <span class="st">"./data/hate_crimes.csv"</span>)</span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a>hate_crimes <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"./data/hate_crimes.csv"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
<p>Next, let’s explore the <code>hate_crimes</code> data set using the <code>glimpse()</code> function from the <code>dplyr</code> package:</p>
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">glimpse</span>(hate_crimes)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>Rows: 51
Columns: 9
$ state <chr> "New Mexico", "Maine", "New York", "Illinois", "Delaw…
$ median_house_inc <chr> "low", "low", "low", "low", "high", "high", "high", "…
$ share_pop_metro <dbl> 0.69, 0.54, 0.94, 0.90, 0.90, 1.00, 0.87, 0.86, 0.97,…
$ hs <dbl> 83, 90, 85, 86, 87, 85, 89, 90, 81, 91, 89, 89, 87, 8…
$ hate_crimes <dbl> 0.295, 0.616, 0.351, 0.195, 0.323, 0.095, 0.833, 0.67…
$ trump_support <chr> "low", "low", "low", "low", "low", "low", "low", "low…
$ unemployment <chr> "high", "low", "low", "high", "low", "high", "high", …
$ urbanization <chr> "low", "low", "high", "high", "high", "high", "high",…
$ income <dbl> 46686, 51710, 54310, 54916, 57522, 58633, 58875, 5906…</code></pre>
</div>
</div>
<p>You should also examine the data in the <strong>data viewer</strong>.</p>
<p>Each case/row in these data is a state in the US. This week we will consider the response variable <code>income</code>, which is the numeric variable of median income of households in each state.</p>
<p>We will use</p>
<ul>
<li>A categorical explanatory variable <code>urbanization</code>: level of urbanization in a region</li>
<li>A numerical explanatory variable <code>share_pop_hs</code>: the percentage of adults 25 and older with a high school degree</li>
</ul>
</section>
<section id="income-education-and-urbanization" class="level2">
<h2 class="anchored" data-anchor-id="income-education-and-urbanization">Income, Education and Urbanization</h2>
<p>We will start by modeling the relationship between:</p>
<ul>
<li><span class="math inline">\(y\)</span>: Median household income in 2016</li>
<li><span class="math inline">\(x_1\)</span>: numerical variable percent of adults 25 and older with a high-school degree, contained in the <code>hs</code> variable<br>
</li>
<li><span class="math inline">\(x_2\)</span>: categorical variable level of urbanization in a state: <code>low</code>, or <code>high</code>, as contained in the variable <code>urbanization</code></li>
</ul>
</section>
</section>
<section id="exploratory-data-analysis" class="level1">
<h1>Exploratory Data Analysis</h1>
<p>We will start by creating a scatterplot showing:</p>
<ul>
<li>Median household <code>income</code> on the <span class="math inline">\(y\)</span> axis</li>
<li>Percent of adults 25 or older with a high school degree on the <span class="math inline">\(x\)</span> axis</li>
<li>The points colored by the variable <code>urbanization</code></li>
<li>A line of best fit (regression line) for each level of the variable <code>urbanization</code> (one for “low”, one for “high”)</li>
</ul>
<div class="callout callout-style-default callout-caution no-icon callout-titled" title="R Code">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
R Code
</div>
</div>
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(<span class="at">data =</span> hate_crimes, </span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">y =</span> income, <span class="at">x =</span> hs, <span class="at">color =</span> urbanization)) <span class="sc">+</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>()<span class="sc">+</span> </span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_smooth</span>(<span class="at">method =</span> <span class="st">"lm"</span>, <span class="at">se =</span> <span class="cn">FALSE</span>) <span class="sc">+</span> </span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"Percent of adults with high-school degree"</span>, </span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="st">"Median household income in USD $"</span>, </span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Income versus education in states with </span></span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a><span class="st"> differing levels of urbanization"</span>) <span class="sc">+</span> </span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_bw</span>() <span class="sc">+</span> </span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(<span class="at">plot.title =</span> <span class="fu">element_text</span>(<span class="at">hjust =</span> <span class="fl">0.5</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div id="fig-urb" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="PS06_source_files/figure-html/fig-urb-1.png" class="img-fluid figure-img" width="768"></p>
<figcaption class="figure-caption">Figure 1: Median household income versus percent of adults with high-school degree in states with differing levels of urbanization</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 1">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 1
</div>
</div>
<div class="callout-body-container callout-body">
<p>Do you think the relationship between <code>hs</code> and <code>income</code> is strong or weak, linear or non-linear in <a href="#fig-urb">Figure 1</a>?</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 1 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-5-contents" aria-controls="callout-5" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 1 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-5" class="callout-5-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 2">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 2
</div>
</div>
<div class="callout-body-container callout-body">
<p>Which regression line (high <code>urbanization</code> or low <code>urbanization</code>) in <a href="#fig-urb">Figure 1</a> has the larger intercept? Answer the question using the actual intercepts from the statistical model. Store the results of the <code>lm()</code> function in <code>mod_full</code> using the appropriate predictors to obtain the regression models depicted in <a href="#fig-urb">Figure 1</a>. Use either <code>kable()</code> from the <code>knitr</code> package or <code>get_regression_table()</code> from the <code>moderndive</code> package on <code>mod_full</code>. Make sure to format the intercepts in your answer using appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 2 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-7-contents" aria-controls="callout-7" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 2 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-7" class="callout-7-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 3">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 3
</div>
</div>
<div class="callout-body-container callout-body">
<p>Does the slope look fairly similar (parallel) for the two levels of urbanization?</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 3 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-9-contents" aria-controls="callout-9" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 3 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-9" class="callout-9-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 4">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 4
</div>
</div>
<div class="callout-body-container callout-body">
<p>Based on the data visualization in <a href="#fig-urb">Figure 1</a>, and your answer to 3, do you think it would be best to run a “parallel slopes” model (i.e. a model that estimates one shared slope for the two levels of urbanization), or a more complex “interaction model” (i.e. a model that estimates a separate slope for the two levels of urbanization)?</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 4 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-11-contents" aria-controls="callout-11" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 4 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-11" class="callout-11-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 5">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 5
</div>
</div>
<div class="callout-body-container callout-body">
<p>Create a data visualization comparing median household income at “low” and “high” levels of urbanization (you do not need to include the <code>hs</code> variable in this plot). Please include axis labels and and title.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 5 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-13-contents" aria-controls="callout-13" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 5 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-13" class="callout-13-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 6">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 6
</div>
</div>
<div class="callout-body-container callout-body">
<p>Run a linear regression model that examines the relationship between household <code>income</code> (as response variable), and high-school education (<code>hs</code>), and <code>urbanization</code> as explanatory variables. Store the results of your model in an object named <code>med_income_model</code>. Generate the regression table using the <code>get_regression_table()</code> function from the <code>moderndive</code> package. Create a graph of the equations stored in <code>med_income_model</code>. Use appropriate labels for the <span class="math inline">\(x-\)</span> and <span class="math inline">\(y-\)</span> axes as well as a title in your graph.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 6 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-15-contents" aria-controls="callout-15" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 6 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-15" class="callout-15-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(scales) <span class="co"># Used to format numbers and for dollars</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments here</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 7">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 7
</div>
</div>
<div class="callout-body-container callout-body">
<p>Is the intercept the same for the states with a “low” and “high” level of urbanization? Is the slope the same? (look at the data visualization created in Problem 6 to help with this!)</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 7 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-17-contents" aria-controls="callout-17" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 7 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-17" class="callout-17-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 8">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 8
</div>
</div>
<div class="callout-body-container callout-body">
<p>What is the slope for the regression line of the states with a “high” level of urbanization? What is the intercept? Be sure to format your answers with appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 8 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-19-contents" aria-controls="callout-19" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 8 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-19" class="callout-19-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li><p>Delete this and put your text answer here.</p></li>
<li><p>Delete this and put your text answer here.</p></li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 9">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 9
</div>
</div>
<div class="callout-body-container callout-body">
<p>What is the slope for the regression line of the states with a “low” level of urbanization? What is the intercept? Be sure to format your answers with appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 9 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-21-contents" aria-controls="callout-21" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 9 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-21" class="callout-21-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li><p>Delete this and put your text answer here.</p></li>
<li><p>Delete this and put your text answer here.</p></li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 10">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 10
</div>
</div>
<div class="callout-body-container callout-body">
<p>Based on your regression table output (and the data visualizations), is median household income greater in states that have lower or higher levels of urbanization? By how much? Be sure to format your answer with appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 10 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-23-contents" aria-controls="callout-23" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 10 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-23" class="callout-23-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 11">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 11
</div>
</div>
<div class="callout-body-container callout-body">
<p>For every increase in 1 percentage point of high-school educated adults, what is the associated increase in the median household income of a state? Be sure to format your answer with appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 11 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-25-contents" aria-controls="callout-25" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 11 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-25" class="callout-25-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 12">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 12
</div>
</div>
<div class="callout-body-container callout-body">
<p>The regression equation for <code>med_income_model</code> is given below. Write the regression equation for a US state in which <code>urbanization</code> is “high”.</p>
<p><span class="math display">\[\widehat{\text{income}} = -113,725 + 1986.79 \times \text{hs} -7333.33 \times 1_{\text{low urbanization}}(\text{x})\]</span></p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 12 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-27-contents" aria-controls="callout-27" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 12 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-27" class="callout-27-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Your <span class="math inline">\(LaTeX\)</span> answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 13">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 13
</div>
</div>
<div class="callout-body-container callout-body">
<p>What would you predict as the median household income for a state with a <strong>high</strong> level of urbanization, in which 85% of the share of adults have a high school degree? Be sure to format your answer with appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 13 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-29-contents" aria-controls="callout-29" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 13 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-29" class="callout-29-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 14">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 14
</div>
</div>
<div class="callout-body-container callout-body">
<p>What would you predict as the median household income for a state with a <strong>low</strong> level of urbanization, in which 85% of the share of adults have a high school degree? Be sure to format your answer with appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 14 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-31-contents" aria-controls="callout-31" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 14 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-31" class="callout-31-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 15">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 15
</div>
</div>
<div class="callout-body-container callout-body">
<p>What would you predict as the median household income for a state with a <strong>low</strong> level of urbanization, in which 30% of adults have a high school degree?</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 15 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-33-contents" aria-controls="callout-33" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 15 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-33" class="callout-33-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 16">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 16
</div>
</div>
<div class="callout-body-container callout-body">
<p>What was the observed <code>income</code> value for Maine (row 2)? What was the prediction for Maine according to our model (<code>med_income_model</code>)? What is the residual? Did our model over or underestimate the median income for this state? Be sure to format your answers with appropriate units.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 16 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-35-contents" aria-controls="callout-35" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 16 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-35" class="callout-35-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li><p>Delete this and put your text answer here.</p></li>
<li><p>Delete this and put your text answer here.</p></li>
<li><p>Delete this and put your text answer here.</p></li>
<li><p>Delete this and put your text answer here.</p></li>
</ul>
</div>
</div>
</div>
</section>
<section id="independent-analysis" class="level1">
<h1>Independent Analysis</h1>
<div class="cell" data-layout-align="center">
<div class="cell-output-display">
<div id="fig-VOLE" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="https://ptes.org/wp-content/uploads/2017/11/water-vole-credit-Iain-Green-www.wildwonder.co_.uk-2_cropped.jpg" class="img-fluid figure-img" width="600"></p>
<figcaption class="figure-caption">Figure 2: Vole in the wild</figcaption>
</figure>
</div>
</div>
</div>
<p>You will now use the tools you have learned, and a new data set to solve a conservation problem.</p>
<p>Wildlife biologists are interested in managing/protecting habitats for a declining species of vole, but are not sure about what habitats it prefers. Two things that biologists can easily control with management is percent cover of vegetation, and where habitat improvements occur (i.e. is it important to create/protect habitat in moist or dry sites, etc). To help inform habitat management of this vole species, the researchers in this study counted the number of <code>voles</code> at 56 random study sites. At each site, they measured percent cover of <code>veg</code>etation, and recorded whether a site had moist or dry <code>soil</code>.</p>
<p>The data are read into the object <code>vole_trapping</code> using the <code>read_csv()</code> function below.</p>
<div class="callout callout-style-default callout-caution no-icon callout-titled" title="R Code">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
R Code
</div>
</div>
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>url <span class="ot"><-</span> <span class="st">"http://bit.ly/2IgDF0E"</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span>(<span class="sc">!</span><span class="fu">dir.exists</span>(<span class="st">"./data/"</span>)){</span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">dir.create</span>(<span class="st">"./data/"</span>)</span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span>(<span class="sc">!</span><span class="fu">file.exists</span>(<span class="st">"./data/vole_trapping.csv"</span>)){</span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">download.file</span>(url, <span class="at">destfile =</span> <span class="st">"./data/vole_trapping.csv"</span>)</span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a>vole_trapping <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"./data/vole_trapping.csv"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
<p>The data contains the variables:</p>
<ul>
<li><code>site</code> for the id of each random study site (each case or row is a survey/trapping site)</li>
<li><code>voles</code> for the vole count at each site</li>
<li><code>veg</code> for the percent cover of vegetation at each site</li>
<li><code>soil</code> identifying a site as “moist” or “dry”</li>
</ul>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 17">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 17
</div>
</div>
<div class="callout-body-container callout-body">
<p>Generate a regression model with <code>voles</code> as the response variable <code>y</code> and <code>veg</code> and <code>soil</code> as explanatory variables. Store the model in an object named <code>voles_mod</code>. Use the results of the model to answer the following questions <strong>based on the available data</strong>. Create a data visualization (parallel slopes) to help answer the questions.</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 17 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-38-contents" aria-controls="callout-38" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 17 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-38" class="callout-38-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 18">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 18
</div>
</div>
<div class="callout-body-container callout-body">
<p>Would you recommend to a manager that they try to protect sites with high or low vegetation cover? Why?</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 18 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-40-contents" aria-controls="callout-40" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 18 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-40" class="callout-40-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 19">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 19
</div>
</div>
<div class="callout-body-container callout-body">
<p>Dry sites are typically a lot less money to purchase and maintain for conservation organizations. Thus, if a conservation organization decides to purchase a few dry sites, roughly what percent cover of vegetation do they need to maintain on these sites (at a minimum) to support a population of about 30 voles at the site?</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 19 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-42-contents" aria-controls="callout-42" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 19 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-42" class="callout-42-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note no-icon callout-titled" title="Problem 20">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 20
</div>
</div>
<div class="callout-body-container callout-body">
<p>The Nature Conservancy is looking at purchasing a site for this species (in the same study area) that has moist soil and 40% vegetation cover. <strong>Using the regression equation</strong> what would you predict as the possible vole population the site might be able to support?</p>
</div>
</div>
<div class="callout callout-style-default callout-important no-icon callout-titled" title="Problem 20 Answers">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-44-contents" aria-controls="callout-44" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Problem 20 Answers
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-44" class="callout-44-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Type your code and comments inside the code chunk</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li>Delete this and put your text answer here.</li>
</ul>
</div>
</div>
</div>
</section>
<section id="turning-in-your-work" class="level1">
<h1>Turning in Your Work</h1>
<p>You will need to make sure you commit and push all of your changes to the github education repository where you obtained the lab.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Tip
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Make sure you <strong>render a final copy with all your changes</strong> and work.</li>
<li>Look at your final html file to make sure it contains the work you expect and is formatted properly.</li>
</ul>
</div>
</div>
</section>
<section id="logging-out-of-the-server" class="level1">
<h1>Logging out of the Server</h1>
<p>There are many statistics classes and students using the Server. To keep the server running as fast as possible, it is best to sign out when you are done. To do so, follow all the same steps for closing Quarto document:</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Tip
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Save all your work.</li>
<li>Click on the orange button in the far right corner of the screen to quit <code>R</code></li>
<li>Choose <strong>don’t save</strong> for the <strong>Workspace image</strong></li>
<li>When the browser refreshes, you can click on the sign out next to your name in the top right.</li>
<li>You are signed out.</li>
</ul>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sessionInfo</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>R version 4.4.2 (2024-10-31)
Platform: x86_64-redhat-linux-gnu
Running under: Red Hat Enterprise Linux 9.5 (Plow)
Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLAS-OPENMP; LAPACK version 3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/New_York
tzcode source: system (glibc)