-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path08_NormalDistributions_Lab.html
More file actions
2250 lines (2180 loc) · 220 KB
/
Copy path08_NormalDistributions_Lab.html
File metadata and controls
2250 lines (2180 loc) · 220 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.5.43">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Topic 8: Normal Distribution Lab</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 { 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 { display: inline-block; 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="08_NormalDistributions_Lab_files/libs/clipboard/clipboard.min.js"></script>
<script src="08_NormalDistributions_Lab_files/libs/quarto-html/quarto.js"></script>
<script src="08_NormalDistributions_Lab_files/libs/quarto-html/popper.min.js"></script>
<script src="08_NormalDistributions_Lab_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="08_NormalDistributions_Lab_files/libs/quarto-html/anchor.min.js"></script>
<link href="08_NormalDistributions_Lab_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="08_NormalDistributions_Lab_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="08_NormalDistributions_Lab_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="08_NormalDistributions_Lab_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="08_NormalDistributions_Lab_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script src="08_NormalDistributions_Lab_files/libs/quarto-contrib/live-runtime/live-runtime.js" type="module"></script>
<link href="08_NormalDistributions_Lab_files/libs/quarto-contrib/live-runtime/live-runtime.css" rel="stylesheet">
<script type="module" src="08_NormalDistributions_Lab_files/libs/quarto-ojs/quarto-ojs-runtime.js"></script>
<link href="08_NormalDistributions_Lab_files/libs/quarto-ojs/quarto-ojs.css" rel="stylesheet">
<style>
.btn-exercise-solution { display: none !important; }
</style>
<script src="https://cdnjs.cloudflare.com/polyfill/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>
<script type="text/javascript">
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
window.Quarto = {
typesetMath
};
</script>
</head>
<body class="fullcontent">
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Topic 8: Normal Distribution Lab</h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<div class="cell" data-edit="false">
<div>
<div id="webr-1" class="exercise-cell">
</div>
<script type="webr-1-contents">
eyJjb2RlIjoid2Vicjo6aW5zdGFsbChcImdyYWRldGhpc1wiLCBxdWlldCA9IFRSVUUpXG5saWJyYXJ5KGdyYWRldGhpcylcbm9wdGlvbnMod2Vici5leGVyY2lzZS5jaGVja2VyID0gZnVuY3Rpb24oXG4gIGxhYmVsLCB1c2VyX2NvZGUsIHNvbHV0aW9uX2NvZGUsIGNoZWNrX2NvZGUsIGVudmlyX3Jlc3VsdCwgZXZhbHVhdGVfcmVzdWx0LFxuICBlbnZpcl9wcmVwLCBsYXN0X3ZhbHVlLCBlbmdpbmUsIHN0YWdlLCAuLi5cbikge1xuICBpZiAoaXMubnVsbChjaGVja19jb2RlKSkge1xuICAgICMgTm8gZ3JhZGluZyBjb2RlLCBzbyBqdXN0IHNraXAgZ3JhZGluZ1xuICAgIGludmlzaWJsZShOVUxMKVxuICB9IGVsc2UgaWYgKGlzLm51bGwobGFiZWwpKSB7XG4gICAgbGlzdChcbiAgICAgIGNvcnJlY3QgPSBGQUxTRSxcbiAgICAgIHR5cGUgPSBcIndhcm5pbmdcIixcbiAgICAgIG1lc3NhZ2UgPSBcIkFsbCBleGVyY2lzZXMgbXVzdCBoYXZlIGEgbGFiZWwuXCJcbiAgICApXG4gIH0gZWxzZSBpZiAoaXMubnVsbChzb2x1dGlvbl9jb2RlKSkge1xuICAgIGxpc3QoXG4gICAgICBjb3JyZWN0ID0gRkFMU0UsXG4gICAgICB0eXBlID0gXCJ3YXJuaW5nXCIsXG4gICAgICBtZXNzYWdlID0gaHRtbHRvb2xzOjp0YWdzJGRpdihcbiAgICAgICAgaHRtbHRvb2xzOjp0YWdzJHAoXCJBIHByb2JsZW0gb2NjdXJyZWQgZ3JhZGluZyB0aGlzIGV4ZXJjaXNlLlwiKSxcbiAgICAgICAgaHRtbHRvb2xzOjp0YWdzJHAoXG4gICAgICAgICAgXCJObyBzb2x1dGlvbiBjb2RlIHdhcyBmb3VuZC4gTm90ZSB0aGF0IGdyYWRpbmcgZXhlcmNpc2VzIHVzaW5nIHRoZSBcIixcbiAgICAgICAgICBodG1sdG9vbHM6OnRhZ3MkY29kZShcImdyYWRldGhpc1wiKSxcbiAgICAgICAgICBcInBhY2thZ2UgcmVxdWlyZXMgYSBtb2RlbCBzb2x1dGlvbiB0byBiZSBpbmNsdWRlZCBpbiB0aGUgZG9jdW1lbnQuXCJcbiAgICAgICAgKVxuICAgICAgKVxuICAgIClcbiAgfSBlbHNlIHtcbiAgICBncmFkZXRoaXM6OmdyYWRldGhpc19leGVyY2lzZV9jaGVja2VyKFxuICAgICAgbGFiZWwgPSBsYWJlbCwgc29sdXRpb25fY29kZSA9IHNvbHV0aW9uX2NvZGUsIHVzZXJfY29kZSA9IHVzZXJfY29kZSxcbiAgICAgIGNoZWNrX2NvZGUgPSBjaGVja19jb2RlLCBlbnZpcl9yZXN1bHQgPSBlbnZpcl9yZXN1bHQsXG4gICAgICBldmFsdWF0ZV9yZXN1bHQgPSBldmFsdWF0ZV9yZXN1bHQsIGVudmlyX3ByZXAgPSBlbnZpcl9wcmVwLFxuICAgICAgbGFzdF92YWx1ZSA9IGxhc3RfdmFsdWUsIHN0YWdlID0gc3RhZ2UsIGVuZ2luZSA9IGVuZ2luZSlcbiAgfVxufSkiLCJhdHRyIjp7Im91dHB1dCI6ZmFsc2UsInBlcnNpc3QiOnRydWUsImV2YWwiOnRydWUsImVkaXQiOmZhbHNlfX0=
</script>
</div>
</div>
<div class="cell" data-edit="false" data-define="ok_response">
<div>
<div id="webr-2" class="exercise-cell">
</div>
<script type="webr-2-contents">
eyJjb2RlIjoiXG5saWJyYXJ5KGh0bWx0b29scylcbm9rX3Jlc3BvbnNlIDwtIGZ1bmN0aW9uKHJlc3BvbnNlLCBuKSB7XG4gIGlmIChpcy5uYShyZXNwb25zZSkpIGRpdihIVE1MKFwiWW91IGhhdmVuJ3QgYW5zd2VyZWQgeWV0LlwiKSwgc3R5bGUgPSBcImNvbG9yOiBwdXJwbGVcIilcbiAgZWxzZSBpZiAocmVzcG9uc2UgPT0gbikgZGl2KEhUTUwoXCJDb3JyZWN0IOKck1wiKSwgc3R5bGUgPSBcImNvbG9yOiBncmVlblwiKVxuICBlbHNlIGRpdihIVE1MKFwiSW5jb3JyZWN0IOKcl1wiKSwgc3R5bGUgPSBcImNvbG9yOiByZWRcIilcbn0iLCJhdHRyIjp7ImVkaXQiOmZhbHNlLCJvdXRwdXQiOmZhbHNlLCJwZXJzaXN0Ijp0cnVlLCJldmFsIjp0cnVlLCJkZWZpbmUiOlsib2tfcmVzcG9uc2UiXX19
</script>
</div>
</div>
<div class="cell" data-context="setup" data-define="["fhgtmean","fhgtsd","fwgtmean","fwgtsd"]">
<div>
<div id="webr-3" class="exercise-cell">
</div>
<script type="webr-3-contents">
eyJjb2RlIjoiXG5saWJyYXJ5KGRwbHlyKVxubGlicmFyeShnZ3Bsb3QyKVxubGlicmFyeShvcGVuaW50cm8pXG5saWJyYXJ5KGpzb25saXRlKVxubGlicmFyeShiYXNlNjRlbmMpXG5cbmRhdGEoYmRpbXMpXG5cbm1kaW1zIDwtIGJkaW1zIHw+IGZpbHRlcihzZXggPT0gMSlcbmZkaW1zIDwtIGJkaW1zIHw+IGZpbHRlcihzZXggPT0gMClcblxuZmhndG1lYW4gPC0gbWVhbihmZGltcyRoZ3QpXG5maGd0c2QgICA8LSBzZChmZGltcyRoZ3QpXG5md2d0bWVhbiA8LSBtZWFuKGZkaW1zJHdndClcbmZ3Z3RzZCAgIDwtIHNkKGZkaW1zJHdndClcblxudGhlbWVfc2V0KHRoZW1lX2J3KGJhc2Vfc2l6ZSA9IDEyKSlcblxuZXhlcmNpc2VfcmVzdWx0cyA8LSBsaXN0KFxuICBub3RlYm9vayAgICAgICAgID0gXCJUb3BpYyA4OiBOb3JtYWwgRGlzdHJpYnV0aW9uIExhYlwiLFxuICBoZWFkX2RhdGEgICAgICAgID0gXCJ1bmF0dGVtcHRlZFwiLFxuICBzdWJzZXRfbWYgICAgICAgID0gXCJ1bmF0dGVtcHRlZFwiLFxuICBzaW1fbm9ybV9xcV9wbG90ID0gXCJ1bmF0dGVtcHRlZFwiLFxuICBwcm9iX2hlaWdodF9ub3JtID0gXCJ1bmF0dGVtcHRlZFwiLFxuICB3Z3Rfbm9ybV9wcm9iICAgID0gXCJ1bmF0dGVtcHRlZFwiXG4pIiwiYXR0ciI6eyJlY2hvIjpmYWxzZSwiZWRpdCI6ZmFsc2UsImNvbnRleHQiOiJzZXR1cCIsIm91dHB1dCI6ZmFsc2UsInBlcnNpc3QiOnRydWUsImV2YWwiOnRydWUsImRlZmluZSI6WyJmaGd0bWVhbiIsImZoZ3RzZCIsImZ3Z3RtZWFuIiwiZndndHNkIl19fQ==
</script>
</div>
</div>
<div class="callout callout-style-default callout-note 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">
About
</div>
</div>
<div class="callout-body-container callout-body">
<p>In this lab, we examine height and weight data. We explore what is meant by the <em>near-normality</em> assumption, we work towards assessing normality via a variety of informal methods, and we also investigate what the consequences can be when this assumption is violated.</p>
<div class="cell">
<div class="sourceCode cell-code hidden" id="cb1" data-startfrom="104" data-source-offset="0"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 103;"><span id="cb1-104"><a href="#cb1-104" aria-hidden="true" tabindex="-1"></a>{</span>
<span id="cb1-105"><a href="#cb1-105" aria-hidden="true" tabindex="-1"></a> <span class="kw">const</span> btn <span class="op">=</span> <span class="fu">html</span><span class="vs">`<button style="</span></span>
<span id="cb1-106"><a href="#cb1-106" aria-hidden="true" tabindex="-1"></a><span class="vs"> background: #436b95;</span></span>
<span id="cb1-107"><a href="#cb1-107" aria-hidden="true" tabindex="-1"></a><span class="vs"> color: white;</span></span>
<span id="cb1-108"><a href="#cb1-108" aria-hidden="true" tabindex="-1"></a><span class="vs"> border: none;</span></span>
<span id="cb1-109"><a href="#cb1-109" aria-hidden="true" tabindex="-1"></a><span class="vs"> padding: 8px 16px;</span></span>
<span id="cb1-110"><a href="#cb1-110" aria-hidden="true" tabindex="-1"></a><span class="vs"> border-radius: 4px;</span></span>
<span id="cb1-111"><a href="#cb1-111" aria-hidden="true" tabindex="-1"></a><span class="vs"> cursor: pointer;</span></span>
<span id="cb1-112"><a href="#cb1-112" aria-hidden="true" tabindex="-1"></a><span class="vs"> font-size: 0.9em;</span></span>
<span id="cb1-113"><a href="#cb1-113" aria-hidden="true" tabindex="-1"></a><span class="vs"> ">🔄 Reset My Responses</button>`</span><span class="op">;</span></span>
<span id="cb1-114"><a href="#cb1-114" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-115"><a href="#cb1-115" aria-hidden="true" tabindex="-1"></a> btn<span class="op">.</span><span class="at">onclick</span> <span class="op">=</span> () <span class="kw">=></span> {</span>
<span id="cb1-116"><a href="#cb1-116" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">confirm</span>(<span class="st">'Reset all responses for this activity? This cannot be undone.'</span>)) {</span>
<span id="cb1-117"><a href="#cb1-117" aria-hidden="true" tabindex="-1"></a> <span class="bu">Object</span><span class="op">.</span><span class="fu">keys</span>(localStorage)</span>
<span id="cb1-118"><a href="#cb1-118" aria-hidden="true" tabindex="-1"></a> <span class="op">.</span><span class="fu">filter</span>(k <span class="kw">=></span> k<span class="op">.</span><span class="fu">endsWith</span>(<span class="st">'_selected_t8'</span>) <span class="op">||</span> k<span class="op">.</span><span class="fu">endsWith</span>(<span class="st">'_correct_t8'</span>) <span class="op">||</span> k<span class="op">.</span><span class="fu">endsWith</span>(<span class="st">'_result_t8'</span>))</span>
<span id="cb1-119"><a href="#cb1-119" aria-hidden="true" tabindex="-1"></a> <span class="op">.</span><span class="fu">forEach</span>(k <span class="kw">=></span> localStorage<span class="op">.</span><span class="fu">removeItem</span>(k))<span class="op">;</span></span>
<span id="cb1-120"><a href="#cb1-120" aria-hidden="true" tabindex="-1"></a> location<span class="op">.</span><span class="fu">reload</span>()<span class="op">;</span></span>
<span id="cb1-121"><a href="#cb1-121" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb1-122"><a href="#cb1-122" aria-hidden="true" tabindex="-1"></a> }<span class="op">;</span></span>
<span id="cb1-123"><a href="#cb1-123" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-124"><a href="#cb1-124" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> btn<span class="op">;</span></span>
<span id="cb1-125"><a href="#cb1-125" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">
<div id="ojs-cell-1" data-nodetype="expression">
</div>
</div>
</div>
<p><em>Note.</em> The button above resets multiple choice and checkbox questions. Currently, resetting code cells must be done manually via hitting the <em>Start Over</em> button on each individual interactive cell.</p>
</div>
</div>
<div class="callout callout-style-default callout-note 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">
License
</div>
</div>
<div class="callout-body-container callout-body">
<p>This is a derivative of a product of OpenIntro that is released under a <a href="http://creativecommons.org/licenses/by-sa/3.0">Creative Commons Attribution-ShareAlike 3.0 Unported</a> license. This lab was adapted for OpenIntro by Andrew Bray and Mine Çetinkaya-Rundel from a lab written by Mark Hansen of UCLA Statistics.</p>
</div>
</div>
<section id="assessing-and-exploring-the-normality-assumption" class="level2">
<h2 class="anchored" data-anchor-id="assessing-and-exploring-the-normality-assumption">Assessing and Exploring the Normality Assumption</h2>
<p>In this activity we’ll continue our investigation into the probability distribution that is most central to statistics: the <em>normal</em> distribution. Here we’ll use the graphical tools of R to assess the normality of our data and also learn how to generate pseudo-random numbers from a normal distribution. In addition, we’ll uncover the importance of <em>the normality assumption</em>. We will engage with a scenario in which the approximate normality assumption is satisfied and another where it is not.</p>
</section>
<section id="the-data" class="level2">
<h2 class="anchored" data-anchor-id="the-data">The Data</h2>
<p>Through this activity we’ll be working with measurements of body dimensions. The data is stored in a data frame called <code>bdims</code> for you to utilize. The <code>bdims</code> data set contains measurements from 247 men and 260 women, most of whom were considered healthy young adults. Please note that this dataset records biological sex as a binary variable — male or female — and does not represent the full spectrum of human body diversity.</p>
<p>Use the <code>head()</code> function to take a quick peek at the first few rows of the data.</p>
<div class="cell" data-exercise="head-data">
<div>
<div id="webr-4" class="exercise-cell">
</div>
<script type="webr-4-contents">
eyJjb2RlIjoiX19fX19fIiwiYXR0ciI6eyJlZGl0Ijp0cnVlLCJwZXJzaXN0Ijp0cnVlLCJldmFsIjp0cnVlLCJleGVyY2lzZSI6ImhlYWQtZGF0YSJ9fQ==
</script>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="head-data">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-3-contents" aria-controls="callout-3" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 1
</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-3" class="callout-3-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>You can pipe the name of the data frame into the <code>head()</code> function.</p>
<div class="cell">
<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>bdims <span class="sc">|></span> </span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">head</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="cell" data-exercise="head-data" data-solution="true">
<div class="webr-ojs-exercise exercise-solution d-none" data-exercise="head-data">
<code id="interpolate-6" class="solution-code d-none">
bdims |>
head()</code>
<div class="sourceCode cell-code" id="interpolate-7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="interpolate-7-1"><a href="#interpolate-7-1" aria-hidden="true" tabindex="-1"></a></span>
<span id="interpolate-7-2"><a href="#interpolate-7-2" aria-hidden="true" tabindex="-1"></a>bdims <span class="sc">|></span> </span>
<span id="interpolate-7-3"><a href="#interpolate-7-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">head</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
<div class="cell" data-exercise="head-data" data-check="true">
<script type="exercise-check-head-data-contents">
eyJjb2RlIjoiXG5leGVyY2lzZV9yZXN1bHRzJGhlYWRfZGF0YSA8PC0gXCJmYWlsXCJcbmdyYWRldGhpczo6Z3JhZGVfdGhpcyh7XG4gIGZlZWRiYWNrIDwtIGdyYWRldGhpczo6Y29kZV9mZWVkYmFjaygpXG4gIGlmIChpcy5udWxsKGZlZWRiYWNrKSkge1xuICAgIGV4ZXJjaXNlX3Jlc3VsdHMkaGVhZF9kYXRhIDw8LSBcInBhc3NcIlxuICAgIHBhc3MocmFuZG9tX3ByYWlzZSgpKVxuICB9XG4gIGZhaWwocmFuZG9tX2VuY291cmFnZW1lbnQoKSlcbn0pIiwiYXR0ciI6eyJlZGl0Ijp0cnVlLCJjaGVjayI6dHJ1ZSwicGVyc2lzdCI6dHJ1ZSwiZXZhbCI6dHJ1ZSwiZXhlcmNpc2UiOiJoZWFkLWRhdGEifX0=
</script>
</div>
<p>You’ll see that for every observation we have 25 measurements, many of which are either diameters or girths. A complete <em>data dictionary</em> (a general description along with definitions of each of the columns/variables) can be found <a href="https://www.openintro.org/book/statdata/?data=bdims" target="_blank">here at OpenIntro</a>, but we’ll be focusing on just three columns in this activity: weight in kg (<code>wgt</code>), height in cm (<code>hgt</code>), and <code>sex</code> (<code>1</code> indicates male, <code>0</code> indicates female).</p>
<p>Since males and females tend to have different body dimensions, it will be useful to create two additional data sets: one with only men and another with only women. Again, in the <code>bdims</code> dataset females are denoted by a 0 in the <code>sex</code> column while males are denoted by a 1.</p>
<div class="callout callout-style-default callout-note 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">
Binary Encodings and Order
</div>
</div>
<div class="callout-body-container callout-body">
<p>The choice to encode females by 0 and males by 1 is made because <em>f</em>emale comes before <em>m</em>ale, alphabetically. Generally, in the case of binary variables, the first category in alphabetical order is encoded by 0 and the second is encoded by 1. Note, however, that this choice can be (and often is) overridden.</p>
</div>
</div>
<p>The code block below is set up to create a dataset <code>mdims</code> consisting of only males. Add the code necessary to create a dataset of only females called <code>fdims</code>.</p>
<div class="cell" data-exercise="subset-mf">
<div>
<div id="webr-9" class="exercise-cell">
</div>
<script type="webr-9-contents">
eyJjb2RlIjoibWRpbXMgPC0gYmRpbXMgfD4gXG4gIGZpbHRlcihzZXggPT0gMSkiLCJhdHRyIjp7ImVkaXQiOnRydWUsInBlcnNpc3QiOnRydWUsImV2YWwiOnRydWUsImV4ZXJjaXNlIjoic3Vic2V0LW1mIn19
</script>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="subset-mf">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 1
</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">
<p>Use the assignment operator for the new object.</p>
<div class="cell">
<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>mdims <span class="ot"><-</span> bdims <span class="sc">|></span> </span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(sex <span class="sc">==</span> <span class="dv">1</span>)</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>fdims <span class="ot"><-</span> ___</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="subset-mf">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-6-contents" aria-controls="callout-6" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 2
</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-6" class="callout-6-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>How should you change the <code>filter()</code> condition to select only females?</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>mdims <span class="ot"><-</span> bdims <span class="sc">|></span> </span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(sex <span class="sc">==</span> <span class="dv">1</span>)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>fdims <span class="ot"><-</span> bdims <span class="sc">|></span> </span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(sex <span class="sc">==</span> ___)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="subset-mf">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 3 (Solved)
</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">
<p>Females are encoded in this data set by the value 0 under the <code>sex</code> column.</p>
<div class="cell">
<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>mdims <span class="ot"><-</span> bdims <span class="sc">|></span> </span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(sex <span class="sc">==</span> <span class="dv">1</span>)</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>fdims <span class="ot"><-</span> bdims <span class="sc">|></span> </span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(sex <span class="sc">==</span> <span class="dv">0</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="cell" data-exercise="subset-mf" data-solution="true">
<div class="webr-ojs-exercise exercise-solution d-none" data-exercise="subset-mf">
<code id="interpolate-11" class="solution-code d-none">
mdims <- bdims |> filter(sex == 1)
fdims <- bdims |> filter(sex == 0)</code>
<div class="sourceCode cell-code" id="interpolate-12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="interpolate-12-1"><a href="#interpolate-12-1" aria-hidden="true" tabindex="-1"></a></span>
<span id="interpolate-12-2"><a href="#interpolate-12-2" aria-hidden="true" tabindex="-1"></a>mdims <span class="ot"><-</span> bdims <span class="sc">|></span> <span class="fu">filter</span>(sex <span class="sc">==</span> <span class="dv">1</span>)</span>
<span id="interpolate-12-3"><a href="#interpolate-12-3" aria-hidden="true" tabindex="-1"></a>fdims <span class="ot"><-</span> bdims <span class="sc">|></span> <span class="fu">filter</span>(sex <span class="sc">==</span> <span class="dv">0</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
<div class="cell" data-exercise="subset-mf" data-check="true">
<script type="exercise-check-subset-mf-contents">
eyJjb2RlIjoiXG5leGVyY2lzZV9yZXN1bHRzJHN1YnNldF9tZiA8PC0gXCJmYWlsXCJcbmdyYWRldGhpczo6Z3JhZGVfdGhpcyh7XG4gIGZlZWRiYWNrIDwtIGdyYWRldGhpczo6Y29kZV9mZWVkYmFjaygpXG4gIGlmIChpcy5udWxsKGZlZWRiYWNrKSkge1xuICAgIGV4ZXJjaXNlX3Jlc3VsdHMkc3Vic2V0X21mIDw8LSBcInBhc3NcIlxuICAgIHBhc3MocmFuZG9tX3ByYWlzZSgpKVxuICB9XG4gIGZhaWwocmFuZG9tX2VuY291cmFnZW1lbnQoKSlcbn0pIiwiYXR0ciI6eyJlZGl0Ijp0cnVlLCJjaGVjayI6dHJ1ZSwicGVyc2lzdCI6dHJ1ZSwiZXZhbCI6dHJ1ZSwiZXhlcmNpc2UiOiJzdWJzZXQtbWYifX0=
</script>
</div>
<p>Use the code block below to make a histogram of men’s heights and a histogram of women’s heights. How would you compare the various aspects of the two distributions?</p>
<div class="cell" data-exercise="plot-hgt-hists" data-caption="Ungraded, Exploratory Only">
<div>
<div id="webr-14" class="exercise-cell">
</div>
<script type="webr-14-contents">
eyJjb2RlIjoiX19fX19fIiwiYXR0ciI6eyJlZGl0Ijp0cnVlLCJleGVyY2lzZSI6InBsb3QtaGd0LWhpc3RzIiwiY2FwdGlvbiI6IlVuZ3JhZGVkLCBFeHBsb3JhdG9yeSBPbmx5IiwiZXZhbCI6dHJ1ZSwicGVyc2lzdCI6dHJ1ZX19
</script>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-8-contents" aria-controls="callout-8" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 1
</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-8" class="callout-8-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>Pipe your data into <code>ggplot()</code>.</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 2
</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">
<p>What type of geometry layer do we need to add?</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> ___</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-10-contents" aria-controls="callout-10" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 3
</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-10" class="callout-10-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>We’ll use <code>geom_histogram()</code>. Since the heights of the bars are determined by the counts in each range, we only need an <code>x</code> aesthetic. What column of the data frame should be mapped to <code>x</code>?</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> ___))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 4
</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">
<p>Since we want a histogram of heights, we’ll map the height variable (<code>hgt</code>) to the <code>x</code> aesthetic.</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-12-contents" aria-controls="callout-12" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 5
</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-12" class="callout-12-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>Now create a second copy of this plot for the female heights. I’ve just created a copy of our first histogram. What needs to be changed? (<em>Note.</em> Especially while you are just getting started, a great way to produce plots is to copy an old plot and just make changes to it – the more similar the copied plot to your intended one, the less you’ll need to change!)</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Male Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a>mdims <span class="sc">|></span></span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Male Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 5
</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">
<p>We’ll need to change the data set we’re plotting with, and that title just won’t fit either.</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Male Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a>___ <span class="sc">|></span></span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"___"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-14-contents" aria-controls="callout-14" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 6 (Solved)
</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-14" class="callout-14-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>We stored the female body dimensions data in the <code>fdims</code> data frame. We’ll also change the plot title to <code>"Female Heights"</code>, reflecting the observations being plotted.</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Male Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a>fdims <span class="sc">|></span></span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Female Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Another Option!
</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">
<p>Here’s perhaps a better option that makes your comparison job a bit easier. We’ll create the plot from the full <code>bdims</code> data frame, fill the bars with different colors according to the <code>sex</code> category, and <em>facet</em> the plots by the <code>sex</code> category, positioning one plot over the other for easy comparison. The legend here is redundant, so we can suppress it.</p>
<div class="cell">
<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>bdims <span class="sc">|></span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">sex =</span> <span class="fu">ifelse</span>(sex <span class="sc">==</span> <span class="dv">0</span>, <span class="st">"Female"</span>, <span class="st">"Male"</span>)) <span class="sc">|></span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt, <span class="at">fill =</span> sex), <span class="at">color =</span> <span class="st">"black"</span>) <span class="sc">+</span></span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Distribution of Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>) <span class="sc">+</span> </span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_wrap</span>(<span class="sc">~</span>sex, <span class="at">nrow =</span> <span class="dv">2</span>) <span class="sc">+</span> </span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(<span class="at">legend.position =</span> <span class="st">"None"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>Click <em>Next Hint</em> to get back to the intended solution.</p>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="plot-hgt-hists">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-16-contents" aria-controls="callout-16" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 6 (Solved)
</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-16" class="callout-16-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>We stored the female body dimensions data in the <code>fdims</code> data frame. We’ll also change the plot title to <code>"Female Heights"</code>, reflecting the observations being plotted.</p>
<div class="cell">
<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>mdims <span class="sc">|></span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Male Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a>fdims <span class="sc">|></span></span>
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="fu">aes</span>(<span class="at">x =</span> hgt)) <span class="sc">+</span></span>
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Female Heights"</span>, <span class="at">x =</span> <span class="st">"Height (cm)"</span>, <span class="at">y =</span> <span class="st">"Count"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-caution 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">
Check Your Understanding: Comparing Height Distributions I
</div>
</div>
<div class="callout-body-container callout-body">
<p>Which group is taller on average?</p>
<div class="cell">
<div class="sourceCode cell-code hidden" id="cb15" data-startfrom="500" data-source-offset="-1"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 499;"><span id="cb15-500"><a href="#cb15-500" aria-hidden="true" tabindex="-1"></a>mutable ok_response <span class="op">=</span> (response<span class="op">,</span> n) <span class="kw">=></span> { <span class="cf">return</span> <span class="fu">html</span><span class="vs">`Loading...`</span> }<span class="op">;</span></span>
<span id="cb15-501"><a href="#cb15-501" aria-hidden="true" tabindex="-1"></a>viewof q1 <span class="op">=</span> Inputs<span class="op">.</span><span class="fu">radio</span>(</span>
<span id="cb15-502"><a href="#cb15-502" aria-hidden="true" tabindex="-1"></a> <span class="kw">new</span> <span class="bu">Map</span>([</span>
<span id="cb15-503"><a href="#cb15-503" aria-hidden="true" tabindex="-1"></a> [<span class="st">"Males"</span><span class="op">,</span> <span class="dv">1</span>]<span class="op">,</span></span>
<span id="cb15-504"><a href="#cb15-504" aria-hidden="true" tabindex="-1"></a> [<span class="st">"Females"</span><span class="op">,</span> <span class="dv">2</span>]<span class="op">,</span></span>
<span id="cb15-505"><a href="#cb15-505" aria-hidden="true" tabindex="-1"></a> [<span class="st">"It is impossible to tell"</span><span class="op">,</span> <span class="dv">3</span>]</span>
<span id="cb15-506"><a href="#cb15-506" aria-hidden="true" tabindex="-1"></a> ])<span class="op">,</span></span>
<span id="cb15-507"><a href="#cb15-507" aria-hidden="true" tabindex="-1"></a> {<span class="dt">value</span><span class="op">:</span> <span class="bu">JSON</span><span class="op">.</span><span class="fu">parse</span>(localStorage<span class="op">.</span><span class="fu">getItem</span>(<span class="st">"q1_selected_t8"</span>) <span class="op">??</span> <span class="st">"null"</span>)}</span>
<span id="cb15-508"><a href="#cb15-508" aria-hidden="true" tabindex="-1"></a>)<span class="op">;</span></span>
<span id="cb15-509"><a href="#cb15-509" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-510"><a href="#cb15-510" aria-hidden="true" tabindex="-1"></a>{</span>
<span id="cb15-511"><a href="#cb15-511" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q1_selected_t8"</span><span class="op">,</span> <span class="bu">JSON</span><span class="op">.</span><span class="fu">stringify</span>(q1))<span class="op">;</span></span>
<span id="cb15-512"><a href="#cb15-512" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q1_correct_t8"</span><span class="op">,</span> <span class="st">"1"</span>)<span class="op">;</span></span>
<span id="cb15-513"><a href="#cb15-513" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q1_result_t8"</span><span class="op">,</span> q1 <span class="op">===</span> <span class="kw">null</span> <span class="op">?</span> <span class="st">"unattempted"</span> <span class="op">:</span> (q1 <span class="op">==</span> <span class="dv">1</span> <span class="op">?</span> <span class="st">"correct"</span> <span class="op">:</span> <span class="st">"incorrect"</span>))<span class="op">;</span></span>
<span id="cb15-514"><a href="#cb15-514" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-2-1" data-nodetype="declaration">
</div>
</div>
</div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-2-2" data-nodetype="declaration">
</div>
</div>
</div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-2-3" data-nodetype="expression">
</div>
</div>
</div>
<div class="sourceCode cell-code hidden" id="cb16" data-startfrom="515" data-source-offset="-482"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 514;"><span id="cb16-515"><a href="#cb16-515" aria-hidden="true" tabindex="-1"></a><span class="fu">ok_response</span>(q1<span class="op">,</span> <span class="st">"1"</span>)<span class="op">;</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-display">
<div>
<div id="ojs-cell-2-4" data-nodetype="expression">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-caution 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">
Check Your Understanding: Comparing Height Distributions II
</div>
</div>
<div class="callout-body-container callout-body">
<p>Would it be fair to say that the distribution of male heights is approximately normal?</p>
<div class="cell">
<div class="sourceCode cell-code hidden" id="cb17" data-startfrom="528" data-source-offset="-1"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 527;"><span id="cb17-528"><a href="#cb17-528" aria-hidden="true" tabindex="-1"></a>viewof q2 <span class="op">=</span> Inputs<span class="op">.</span><span class="fu">radio</span>(</span>
<span id="cb17-529"><a href="#cb17-529" aria-hidden="true" tabindex="-1"></a> <span class="kw">new</span> <span class="bu">Map</span>([</span>
<span id="cb17-530"><a href="#cb17-530" aria-hidden="true" tabindex="-1"></a> [<span class="st">"Yes. The distribution of male heights follows an approximate bell curve."</span><span class="op">,</span> <span class="dv">1</span>]<span class="op">,</span></span>
<span id="cb17-531"><a href="#cb17-531" aria-hidden="true" tabindex="-1"></a> [<span class="st">"No. The distribution is skewed left."</span><span class="op">,</span> <span class="dv">2</span>]<span class="op">,</span></span>
<span id="cb17-532"><a href="#cb17-532" aria-hidden="true" tabindex="-1"></a> [<span class="st">"No. The distribution is skewed right."</span><span class="op">,</span> <span class="dv">3</span>]<span class="op">,</span></span>
<span id="cb17-533"><a href="#cb17-533" aria-hidden="true" tabindex="-1"></a> [<span class="st">"No. The distribution is symmetric but is multimodal."</span><span class="op">,</span> <span class="dv">4</span>]</span>
<span id="cb17-534"><a href="#cb17-534" aria-hidden="true" tabindex="-1"></a> ])<span class="op">,</span></span>
<span id="cb17-535"><a href="#cb17-535" aria-hidden="true" tabindex="-1"></a> {<span class="dt">value</span><span class="op">:</span> <span class="bu">JSON</span><span class="op">.</span><span class="fu">parse</span>(localStorage<span class="op">.</span><span class="fu">getItem</span>(<span class="st">"q2_selected_t8"</span>) <span class="op">??</span> <span class="st">"null"</span>)}</span>
<span id="cb17-536"><a href="#cb17-536" aria-hidden="true" tabindex="-1"></a>)<span class="op">;</span></span>
<span id="cb17-537"><a href="#cb17-537" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-538"><a href="#cb17-538" aria-hidden="true" tabindex="-1"></a>{</span>
<span id="cb17-539"><a href="#cb17-539" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q2_selected_t8"</span><span class="op">,</span> <span class="bu">JSON</span><span class="op">.</span><span class="fu">stringify</span>(q2))<span class="op">;</span></span>
<span id="cb17-540"><a href="#cb17-540" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q2_correct_t8"</span><span class="op">,</span> <span class="st">"1"</span>)<span class="op">;</span></span>
<span id="cb17-541"><a href="#cb17-541" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q2_result_t8"</span><span class="op">,</span> q2 <span class="op">===</span> <span class="kw">null</span> <span class="op">?</span> <span class="st">"unattempted"</span> <span class="op">:</span> (q2 <span class="op">==</span> <span class="dv">1</span> <span class="op">?</span> <span class="st">"correct"</span> <span class="op">:</span> <span class="st">"incorrect"</span>))<span class="op">;</span></span>
<span id="cb17-542"><a href="#cb17-542" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-3-1" data-nodetype="declaration">
</div>
</div>
</div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-3-2" data-nodetype="expression">
</div>
</div>
</div>
<div class="sourceCode cell-code hidden" id="cb18" data-startfrom="543" data-source-offset="-588"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 542;"><span id="cb18-543"><a href="#cb18-543" aria-hidden="true" tabindex="-1"></a><span class="fu">ok_response</span>(q2<span class="op">,</span> <span class="st">"1"</span>)<span class="op">;</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-display">
<div>
<div id="ojs-cell-3-3" data-nodetype="expression">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="callout callout-style-default callout-caution 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">
Check Your Understanding: Comparing Height Distributions III
</div>
</div>
<div class="callout-body-container callout-body">
<p>Would it be fair to say that the distribution of female heights is approximately normal?</p>
<div class="cell">
<div class="sourceCode cell-code hidden" id="cb19" data-startfrom="556" data-source-offset="-1"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 555;"><span id="cb19-556"><a href="#cb19-556" aria-hidden="true" tabindex="-1"></a>viewof q3 <span class="op">=</span> Inputs<span class="op">.</span><span class="fu">radio</span>(</span>
<span id="cb19-557"><a href="#cb19-557" aria-hidden="true" tabindex="-1"></a> <span class="kw">new</span> <span class="bu">Map</span>([</span>
<span id="cb19-558"><a href="#cb19-558" aria-hidden="true" tabindex="-1"></a> [<span class="st">"Yes. The distribution of female heights follows an approximate bell curve."</span><span class="op">,</span> <span class="dv">1</span>]<span class="op">,</span></span>
<span id="cb19-559"><a href="#cb19-559" aria-hidden="true" tabindex="-1"></a> [<span class="st">"No. The distribution is skewed left."</span><span class="op">,</span> <span class="dv">2</span>]<span class="op">,</span></span>
<span id="cb19-560"><a href="#cb19-560" aria-hidden="true" tabindex="-1"></a> [<span class="st">"No. The distribution is skewed right."</span><span class="op">,</span> <span class="dv">3</span>]<span class="op">,</span></span>
<span id="cb19-561"><a href="#cb19-561" aria-hidden="true" tabindex="-1"></a> [<span class="st">"No. The distribution is symmetric but is multimodal."</span><span class="op">,</span> <span class="dv">4</span>]</span>
<span id="cb19-562"><a href="#cb19-562" aria-hidden="true" tabindex="-1"></a> ])<span class="op">,</span></span>
<span id="cb19-563"><a href="#cb19-563" aria-hidden="true" tabindex="-1"></a> {<span class="dt">value</span><span class="op">:</span> <span class="bu">JSON</span><span class="op">.</span><span class="fu">parse</span>(localStorage<span class="op">.</span><span class="fu">getItem</span>(<span class="st">"q3_selected_t8"</span>) <span class="op">??</span> <span class="st">"null"</span>)}</span>
<span id="cb19-564"><a href="#cb19-564" aria-hidden="true" tabindex="-1"></a>)<span class="op">;</span></span>
<span id="cb19-565"><a href="#cb19-565" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-566"><a href="#cb19-566" aria-hidden="true" tabindex="-1"></a>{</span>
<span id="cb19-567"><a href="#cb19-567" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q3_selected_t8"</span><span class="op">,</span> <span class="bu">JSON</span><span class="op">.</span><span class="fu">stringify</span>(q3))<span class="op">;</span></span>
<span id="cb19-568"><a href="#cb19-568" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q3_correct_t8"</span><span class="op">,</span> <span class="st">"1"</span>)<span class="op">;</span></span>
<span id="cb19-569"><a href="#cb19-569" aria-hidden="true" tabindex="-1"></a> localStorage<span class="op">.</span><span class="fu">setItem</span>(<span class="st">"q3_result_t8"</span><span class="op">,</span> q3 <span class="op">===</span> <span class="kw">null</span> <span class="op">?</span> <span class="st">"unattempted"</span> <span class="op">:</span> (q3 <span class="op">==</span> <span class="dv">1</span> <span class="op">?</span> <span class="st">"correct"</span> <span class="op">:</span> <span class="st">"incorrect"</span>))<span class="op">;</span></span>
<span id="cb19-570"><a href="#cb19-570" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-4-1" data-nodetype="declaration">
</div>
</div>
</div>
<div class="cell-output cell-output-display">
<div>
<div id="ojs-cell-4-2" data-nodetype="expression">
</div>
</div>
</div>
<div class="sourceCode cell-code hidden" id="cb20" data-startfrom="571" data-source-offset="-590"><pre class="sourceCode js code-with-copy"><code class="sourceCode javascript" style="counter-reset: source-line 570;"><span id="cb20-571"><a href="#cb20-571" aria-hidden="true" tabindex="-1"></a><span class="fu">ok_response</span>(q3<span class="op">,</span> <span class="st">"1"</span>)<span class="op">;</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-display">
<div>
<div id="ojs-cell-4-3" data-nodetype="expression">
</div>
</div>
</div>
</div>
</div>
</div>
<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">
A Note on Normality
</div>
</div>
<div class="callout-body-container callout-body">
<p>No real-world data is exactly normally distributed, but if the data is <em>close enough</em>, using the normal model is permissible. The questions above are asking whether each distribution is approximately — not exactly — normal.</p>
<p>We’ll see some additional informal methods for assessing normality throughout this lab activity. Formal methods for assessing normality do exist, but they’re left outside the scope of this introductory course.</p>
</div>
</div>
<p>You may have been surprised or frustrated that the activity suggests that the heights are approximately normally distributed. It is very difficult to assess normality directly from a histogram. Let’s dig a bit deeper.</p>
</section>
<section id="using-the-normal-model" class="level2">
<h2 class="anchored" data-anchor-id="using-the-normal-model">Using the Normal Model</h2>
<p>In your description of the distributions, did you use words like <em>bell-shaped</em> or <em>normal</em>? It’s tempting to say so when faced with a unimodal, symmetric distribution. Below we will explore two additional methods for assessing how closely our data follows a normal distribution.</p>
<p>To see how accurate that “<em>approximately normal</em>” description is, we can plot a normal distribution curve on top of a histogram to see how closely the data follow a normal distribution. The normal curve we use should have the same mean and standard deviation as the data. The code block that follows is pre-set to do this for the distribution of male heights. The required steps are:</p>
<ol type="i">
<li>Compute the mean and standard deviation for male heights.</li>
<li>Plot the <em>relative</em> frequency histogram of male heights (this is what <code>after_stat(density)</code> does).</li>
<li>Plot a normal distribution with the same mean and standard deviation as the male heights (this is what <code>geom_line()</code> is doing).</li>
<li>Add a title and descriptive axis labels to the plot.</li>
</ol>
<p>Run the code below to see the normal curve laid on top of the male heights. Once you’ve done that, adapt the code to plot the distribution of female heights as well as the corresponding normal curve. Don’t forget to update the plot title!</p>
<div class="cell" data-exercise="hist-hgt-plus-normal" data-caption="Ungraded, Exploratory Only">
<div>
<div id="webr-15" class="exercise-cell">
</div>
<script type="webr-15-contents">
eyJjb2RlIjoibWhndG1lYW4gPC0gbWRpbXMgfD5cbiAgc3VtbWFyaXplKGF2Z19oZWlnaHQgPSBtZWFuKGhndCkpIHw+XG4gIHB1bGwoYXZnX2hlaWdodClcblxubWhndHNkIDwtIG1kaW1zIHw+XG4gIHN1bW1hcml6ZShzZF9oZWlnaHQgPSBzZChoZ3QpKSB8PlxuICBwdWxsKHNkX2hlaWdodClcblxuZ2dwbG90KCkgKyBcbiAgZ2VvbV9oaXN0b2dyYW0oZGF0YSA9IG1kaW1zLFxuICAgICAgICAgICAgICAgICBhZXMoeCA9IGhndCwgeSA9IGFmdGVyX3N0YXQoZGVuc2l0eSkpKSArIFxuICBnZW9tX2xpbmUoYWVzKHggPSBzZXEoMTQwLCAyMDAsIGxlbmd0aC5vdXQgPSAyMDApLCBcbiAgICAgICAgICAgICAgICB5ID0gZG5vcm0oc2VxKDE0MCwgMjAwLCBsZW5ndGgub3V0ID0gMjAwKSwgXG4gICAgICAgICAgICAgICAgICAgICAgICAgIG1lYW4gPSBtaGd0bWVhbiwgc2QgPSBtaGd0c2QpKSxcbiAgICAgICAgICAgIGNvbG9yID0gXCJibHVlXCIsIGx3ZCA9IDEuMjUpICtcbiAgbGFicyh0aXRsZSA9IFwiRGlzdHJpYnV0aW9uIG9mIE1hbGUgSGVpZ2h0c1wiLCBcbiAgICAgICB4ID0gXCJIZWlnaHQgKGNtKVwiLCBcbiAgICAgICB5ID0gXCJQcm9wb3J0aW9uXCIpIiwiYXR0ciI6eyJlZGl0Ijp0cnVlLCJleGVyY2lzZSI6Imhpc3QtaGd0LXBsdXMtbm9ybWFsIiwiY2FwdGlvbiI6IlVuZ3JhZGVkLCBFeHBsb3JhdG9yeSBPbmx5IiwiZXZhbCI6dHJ1ZSwicGVyc2lzdCI6dHJ1ZX19
</script>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="hist-hgt-plus-normal">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 1
</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">
<p>Change the code to compute the average and standard deviation of heights for women instead of men.</p>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="hist-hgt-plus-normal">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-22-contents" aria-controls="callout-22" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 2
</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-22" class="callout-22-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>Change the code to compute the average and standard deviation of heights for women instead of men.</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a>fhgtmean <span class="ot"><-</span> fdims <span class="sc">|></span></span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="at">avg_height =</span> <span class="fu">mean</span>(hgt)) <span class="sc">|></span></span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(avg_height)</span>
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a>fhgtsd <span class="ot"><-</span> fdims <span class="sc">|></span></span>
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="at">sd_height =</span> <span class="fu">sd</span>(hgt)) <span class="sc">|></span></span>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(sd_height)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="hist-hgt-plus-normal">
<div class="callout callout-style-default callout-note callout-titled">
<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"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 3
</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">
<p>Now update the <code>ggplot()</code> to use data from <code>fdims</code> and the female summary statistics. Update the plot title too.</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a>fhgtmean <span class="ot"><-</span> fdims <span class="sc">|></span></span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="at">avg_height =</span> <span class="fu">mean</span>(hgt)) <span class="sc">|></span></span>
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(avg_height)</span>
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-5"><a href="#cb22-5" aria-hidden="true" tabindex="-1"></a>fhgtsd <span class="ot"><-</span> fdims <span class="sc">|></span></span>
<span id="cb22-6"><a href="#cb22-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="at">sd_height =</span> <span class="fu">sd</span>(hgt)) <span class="sc">|></span></span>
<span id="cb22-7"><a href="#cb22-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(sd_height)</span>
<span id="cb22-8"><a href="#cb22-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-9"><a href="#cb22-9" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb22-10"><a href="#cb22-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="at">data =</span> ___,</span>
<span id="cb22-11"><a href="#cb22-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">x =</span> hgt, <span class="at">y =</span> <span class="fu">after_stat</span>(density))) <span class="sc">+</span> </span>
<span id="cb22-12"><a href="#cb22-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">x =</span> <span class="fu">seq</span>(<span class="dv">140</span>, <span class="dv">200</span>, <span class="at">length.out =</span> <span class="dv">200</span>), </span>
<span id="cb22-13"><a href="#cb22-13" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="fu">dnorm</span>(<span class="fu">seq</span>(<span class="dv">140</span>, <span class="dv">200</span>, <span class="at">length.out =</span> <span class="dv">200</span>), </span>
<span id="cb22-14"><a href="#cb22-14" aria-hidden="true" tabindex="-1"></a> <span class="at">mean =</span> ___, <span class="at">sd =</span> ___)),</span>
<span id="cb22-15"><a href="#cb22-15" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">"blue"</span>, <span class="at">lwd =</span> <span class="fl">1.25</span>) <span class="sc">+</span></span>
<span id="cb22-16"><a href="#cb22-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Distribution of ___ Heights"</span>, </span>
<span id="cb22-17"><a href="#cb22-17" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"Height (cm)"</span>, </span>
<span id="cb22-18"><a href="#cb22-18" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="st">"Proportion"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="hint webr-ojs-exercise exercise-hint d-none" data-exercise="hist-hgt-plus-normal">
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center" data-bs-toggle="collapse" data-bs-target=".callout-24-contents" aria-controls="callout-24" aria-expanded="true" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hint 4 (Solved)
</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-24" class="callout-24-contents callout-collapse collapse show">
<div class="callout-body-container callout-body">
<p>Now update the <code>ggplot()</code> to use data from <code>fdims</code> and the female summary statistics. Update the plot title too.</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>fhgtmean <span class="ot"><-</span> fdims <span class="sc">|></span></span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="at">avg_height =</span> <span class="fu">mean</span>(hgt)) <span class="sc">|></span></span>
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(avg_height)</span>
<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb23-5"><a href="#cb23-5" aria-hidden="true" tabindex="-1"></a>fhgtsd <span class="ot"><-</span> fdims <span class="sc">|></span></span>
<span id="cb23-6"><a href="#cb23-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="at">sd_height =</span> <span class="fu">sd</span>(hgt)) <span class="sc">|></span></span>
<span id="cb23-7"><a href="#cb23-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(sd_height)</span>
<span id="cb23-8"><a href="#cb23-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb23-9"><a href="#cb23-9" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb23-10"><a href="#cb23-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="at">data =</span> fdims,</span>
<span id="cb23-11"><a href="#cb23-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">x =</span> hgt, <span class="at">y =</span> <span class="fu">after_stat</span>(density))) <span class="sc">+</span> </span>
<span id="cb23-12"><a href="#cb23-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">x =</span> <span class="fu">seq</span>(<span class="dv">140</span>, <span class="dv">200</span>, <span class="at">length.out =</span> <span class="dv">200</span>), </span>
<span id="cb23-13"><a href="#cb23-13" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="fu">dnorm</span>(<span class="fu">seq</span>(<span class="dv">140</span>, <span class="dv">200</span>, <span class="at">length.out =</span> <span class="dv">200</span>), </span>
<span id="cb23-14"><a href="#cb23-14" aria-hidden="true" tabindex="-1"></a> <span class="at">mean =</span> fhgtmean, <span class="at">sd =</span> fhgtsd)),</span>
<span id="cb23-15"><a href="#cb23-15" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">"blue"</span>, <span class="at">lwd =</span> <span class="fl">1.25</span>) <span class="sc">+</span></span>
<span id="cb23-16"><a href="#cb23-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Distribution of Female Heights"</span>, </span>
<span id="cb23-17"><a href="#cb23-17" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"Height (cm)"</span>, </span>
<span id="cb23-18"><a href="#cb23-18" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="st">"Proportion"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</div>
</div>
</div>
<p>Notice how convenient <code>ggplot</code>’s layered plotting syntax makes it to add multiple objects (the histogram and density curve) to the same plot.</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">
Position of the <code>data</code> Argument
</div>
</div>
<div class="callout-body-container callout-body">
<p>We’ve generally seen our data frames being piped into <code>ggplot()</code>. This works great when every plot layer utilizes the same data. In cases where plot layers use different data, it is necessary to pass the <code>data</code> argument directly to the plot layer in the way we did above. This allows greater flexibility in your plots.</p>
</div>
</div>
<p><strong>Question:</strong> Based on the plots you built, are you more (or less) comfortable with the assumption that the heights data follow a nearly normal distribution?</p>
<p>Eyeballing the shape of the histogram with the overlayed density is one way to determine if the data appear to be nearly normally distributed, but it can still be frustrating to decide just how close the histogram is to the assumed normal curve. An alternative approach involves constructing a <strong>normal probability plot</strong>, also called a <strong>normal Q-Q plot</strong> (Q-Q stands for “<em>quantile-quantile</em>”). Execute the code block below to produce a Q-Q plot for female heights.</p>
<div class="cell" data-exercise="qq" data-caption="Ungraded, Exploratory Only">
<div>
<div id="webr-16" class="exercise-cell">
</div>
<script type="webr-16-contents">
eyJjb2RlIjoicXFub3JtKGZkaW1zIHw+IHB1bGwoaGd0KSlcbnFxbGluZShmZGltcyB8PiBwdWxsKGhndCkpIiwiYXR0ciI6eyJlZGl0Ijp0cnVlLCJleGVyY2lzZSI6InFxIiwiY2FwdGlvbiI6IlVuZ3JhZGVkLCBFeHBsb3JhdG9yeSBPbmx5IiwiZXZhbCI6dHJ1ZSwicGVyc2lzdCI6dHJ1ZX19
</script>
</div>
</div>
<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">
Reading a Q-Q Plot
</div>
</div>
<div class="callout-body-container callout-body">
<p>A data set that is nearly normal will result in a normal probability plot where the points closely follow the line. Any deviations from normality lead to deviations of these points from the line.</p>
</div>
</div>
<p>The plot for female heights shows points that tend to follow the line but with some errant points towards the tails. We’re left with the same problem that we encountered with the histogram above: how close is close enough?</p>
<p>A useful way to address the questions of “<em>How close is close enough?</em>” is to consider: “what do normal probability plots look like for data that I <em>know</em> came from a normal distribution?” We can answer this by simulating data from a normal distribution using <code>rnorm()</code>. Execute the code below to draw a random sample of 260 random heights from the assumed normal distribution of female heights. We’ll start by just plotting a histogram of the simulated heights for convenience — feel free to run the code block multiple times to see what happens.</p>
<div class="cell" data-exercise="sim-norm" data-caption="Ungraded, Exploratory Only" data-input="["fhgtmean","fhgtsd"]">
<div>
<div id="webr-17" class="exercise-cell">
</div>