forked from saundersg/Statistics-Notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNumericalSummaries.html
executable file
·1872 lines (1779 loc) · 104 KB
/
NumericalSummaries.html
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>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<title>Numerical Summaries</title>
<script src="site_libs/header-attrs-2.7/header-attrs.js"></script>
<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/cerulean.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<style>h1 {font-size: 34px;}
h1.title {font-size: 38px;}
h2 {font-size: 30px;}
h3 {font-size: 24px;}
h4 {font-size: 18px;}
h5 {font-size: 16px;}
h6 {font-size: 12px;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<style type="text/css">
code {
white-space: pre;
}
.sourceCode {
overflow: visible;
}
</style>
<style type="text/css" data-origin="pandoc">
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;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ background-color: #f8f8f8; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ef2929; } /* Alert */
code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #c4a000; } /* Attribute */
code span.bn { color: #0000cf; } /* BaseN */
code span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4e9a06; } /* Char */
code span.cn { color: #000000; } /* Constant */
code span.co { color: #8f5902; font-style: italic; } /* Comment */
code span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */
code span.dt { color: #204a87; } /* DataType */
code span.dv { color: #0000cf; } /* DecVal */
code span.er { color: #a40000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #0000cf; } /* Float */
code span.fu { color: #000000; } /* Function */
code span.im { } /* Import */
code span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #204a87; font-weight: bold; } /* Keyword */
code span.op { color: #ce5c00; font-weight: bold; } /* Operator */
code span.ot { color: #8f5902; } /* Other */
code span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */
code span.sc { color: #000000; } /* SpecialChar */
code span.ss { color: #4e9a06; } /* SpecialString */
code span.st { color: #4e9a06; } /* String */
code span.va { color: #000000; } /* Variable */
code span.vs { color: #4e9a06; } /* VerbatimString */
code span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */
</style>
<script>
// apply pandoc div.sourceCode style to pre.sourceCode instead
(function() {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
try { var rules = sheets[i].cssRules; } catch (e) { continue; }
for (var j = 0; j < rules.length; j++) {
var rule = rules[j];
// check if there is a div.sourceCode rule
if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue;
var style = rule.style.cssText;
// check if color or background-color is set
if (rule.style.color === '' && rule.style.backgroundColor === '') continue;
// replace div.sourceCode by a pre.sourceCode rule
sheets[i].deleteRule(j);
sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
}
}
})();
</script>
<link rel="stylesheet" href="styles.css" type="text/css" />
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
img {
max-width:100%;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
pre code {
padding: 0;
}
</style>
<style type="text/css">
.dropdown-submenu {
position: relative;
}
.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #cccccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #adb5bd;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
border-radius: 6px 0 6px 6px;
}
</style>
<script type="text/javascript">
// manage active state of menu based on current page
$(document).ready(function () {
// active menu anchor
href = window.location.pathname
href = href.substr(href.lastIndexOf('/') + 1)
if (href === "")
href = "index.html";
var menuAnchor = $('a[href="' + href + '"]');
// mark it active
menuAnchor.tab('show');
// if it's got a parent navbar menu mark it active as well
menuAnchor.closest('li.dropdown').addClass('active');
// Navbar adjustments
var navHeight = $(".navbar").first().height() + 15;
var style = document.createElement('style');
var pt = "padding-top: " + navHeight + "px; ";
var mt = "margin-top: -" + navHeight + "px; ";
var css = "";
// offset scroll position for anchor links (for fixed navbar)
for (var i = 1; i <= 6; i++) {
css += ".section h" + i + "{ " + pt + mt + "}\n";
}
style.innerHTML = "body {" + pt + "padding-bottom: 40px; }\n" + css;
document.head.appendChild(style);
});
</script>
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
border: 1px solid #ddd;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "";
border: none;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs > li.active {
display: block;
}
.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
border: none;
display: inline-block;
border-radius: 4px;
background-color: transparent;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<!-- code folding -->
<style type="text/css">
#TOC {
margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
position: relative;
width: 100%;
}
}
@media print {
.toc-content {
/* see https://github.com/w3c/csswg-drafts/issues/4434 */
float: right;
}
}
.toc-content {
padding-left: 30px;
padding-right: 40px;
}
div.main-container {
max-width: 1200px;
}
div.tocify {
width: 20%;
max-width: 260px;
max-height: 85%;
}
@media (min-width: 768px) and (max-width: 991px) {
div.tocify {
width: 25%;
}
}
@media (max-width: 767px) {
div.tocify {
width: 100%;
max-width: none;
}
}
.tocify ul, .tocify li {
line-height: 20px;
}
.tocify-subheader .tocify-item {
font-size: 0.90em;
}
.tocify .list-group-item {
border-radius: 0px;
}
</style>
</head>
<body>
<div class="container-fluid main-container">
<!-- setup 3col/9col grid for toc_float and main content -->
<div class="row">
<div class="col-sm-12 col-md-4 col-lg-3">
<div id="TOC" class="tocify">
</div>
</div>
<div class="toc-content col-sm-12 col-md-8 col-lg-9">
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Statistics Notebook</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
R Help
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="RCommands.html">R Commands</a>
</li>
<li>
<a href="RMarkdownHints.html">R Markdown Hints</a>
</li>
<li>
<a href="RCheatSheetsAndNotes.html">R Cheatsheets & Notes</a>
</li>
<li>
<a href="DataSources.html">Data Sources</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Describing Data
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="GraphicalSummaries.html">Graphical Summaries</a>
</li>
<li>
<a href="NumericalSummaries.html">Numerical Summaries</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Making Inference
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="MakingInference.html">Making Inference</a>
</li>
<li>
<a href="tTests.html">t Tests</a>
</li>
<li>
<a href="WilcoxonTests.html">Wilcoxon Tests</a>
</li>
<li>
<a href="ANOVA.html">ANOVA</a>
</li>
<li>
<a href="Kruskal.html">Kruskal-Wallis</a>
</li>
<li>
<a href="LinearRegression.html">Linear Regression</a>
</li>
<li>
<a href="LogisticRegression.html">Logistic Regression</a>
</li>
<li>
<a href="ChiSquaredTests.html">Chi Squared Tests</a>
</li>
<li>
<a href="PermutationTests.html">Randomization Testing</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Analyses
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="./Analyses/AnalysisRubric.html">Analysis Rubric</a>
</li>
<li>
<a href="./Analyses/StudentHousing.html">Good Example Analysis</a>
</li>
<li>
<a href="./Analyses/StudentHousingPOOR.html">Poor Example Analysis</a>
</li>
<li>
<a href="./Analyses/Rent.html">Rent</a>
</li>
<li>
<a href="./Analyses/Stephanie.html">Stephanie</a>
</li>
<li>
<a href="./Analyses/t Tests/HighSchoolSeniors.html">High School Seniors</a>
</li>
<li>
<a href="./Analyses/Wilcoxon Tests/RecallingWords.html">Recalling Words</a>
</li>
<li>
<a href="./Analyses/ANOVA/DayCare.html">Day Care</a>
</li>
<li>
<a href="./Analyses/Kruskal-Wallis/Food.html">Food</a>
</li>
<li>
<a href="./Analyses/Linear Regression/MySimpleLinearRegression.html">My Simple Linear Regression</a>
</li>
<li>
<a href="./Analyses/Linear Regression/CarPrices.html">Car Prices</a>
</li>
<li>
<a href="./Analyses/Logistic Regression/MyLogisticRegression.html">My Logistic Regression</a>
</li>
<li>
<a href="./Analyses/Chi Squared Tests/MyChiSquaredTest.html">My Chi-sqaured Test</a>
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
<div id="header">
<h1 class="title toc-ignore">Numerical Summaries</h1>
</div>
<script type="text/javascript">
function showhide(id) {
var e = document.getElementById(id);
e.style.display = (e.style.display == 'block') ? 'none' : 'block';
}
</script>
<hr />
<p>There are many ways to numerically summarize data. The fundamental idea is to describe the center, or most <em>probable</em> values of the data, as well as the spread, or the <em>possible</em> values of the data.</p>
<hr />
<div id="mean" class="section level3 tabset tabset-fade tabset-pills">
<h3 class="tabset tabset-fade tabset-pills">Mean</h3>
<div style="float:left;width:150px;">
<p><span class="math display">\[
\bar{x} = \frac{\sum_{i=1}^n x_i}{n}
\]</span></p>
</div>
<p><strong>Measure of Center | 1 Quantitative Variable</strong></p>
<div id="overview" class="section level4">
<h4>Overview</h4>
<div style="padding-left:150px;">
<p>The “balance point” or “center of mass” of quantitative data. It is calculated by taking the numerical sum of the values divided by the number of values. Typically used in tandem with the standard deviation. Most appropriate for describing the most typical values for relatively normally distributed data. Influenced by outliers, so it is not appropriate for describing strongly skewed data.</p>
</div>
<hr />
</div>
<div id="r-instructions" class="section level4">
<h4>R Instructions</h4>
<div style="padding-left:150px;">
<p>To calculate a mean in R use the code:</p>
<p><code>mean(object)</code></p>
<ul>
<li><code>object</code> must be a quantitative variable, what R calls a “numeric vector.” Usually this is a column from a data set.</li>
<li>Use <code>na.rm=TRUE</code> if there are missing values in <code>object</code> so that the code reads <code>mean(object, na.rm=TRUE)</code>.</li>
</ul>
<p><br></p>
<p><strong>Example Code</strong></p>
<p>Hover your mouse over the example codes to learn more.</p>
<a href="javascript:showhide('mean1')">
<div class="hoverchunk">
<p><span class="tooltipr"> mean <span class="tooltiprtext">“mean” is an R function used to calculate the mean of data.</span> </span><span class="tooltipr"> ( <span class="tooltiprtext">Parenthesis to begin the function. Must touch the last letter of the function.</span> </span><span class="tooltipr"> airquality <span class="tooltiprtext">“airquality” is a dataset. Type “View(airquality)” in R to see it.</span> </span><span class="tooltipr"> $ <span class="tooltiprtext">The $ allows us to access any variable from the airquality dataset.</span> </span><span class="tooltipr"> Temp <span class="tooltiprtext">“Temp” is a quantitative variable (numeric vector) from the “airquality” dataset.</span> </span><span class="tooltipr"> )<br />
<span class="tooltiprtext">Closing parenthsis for the mean function.</span> </span><span class="tooltipr"> <br />
<span class="tooltiprtext">Press Enter to run the code if you have typed it in yourself. You can also click here to view the output.</span> </span><span class="tooltipr" style="float:right;"> … <span class="tooltiprtext">Click to View Output.</span> </span></p>
</div>
</a>
<div id="mean1" style="display:none;">
<pre><code>## [1] 77.88235</code></pre>
<p>Note that the single number showing above is the average <code>Temp</code> from the <code>airquality</code> dataset.</p>
</div>
<a href="javascript:showhide('mean3')">
<div class="hoverchunk">
<p><span class="tooltipr"> library(tidyverse) <span class="tooltiprtext">tidyverse is an R Package that is very useful for working with data.</span> </span><br><span class="tooltipr"> airquality <span class="tooltipRtext"><code>airquality</code> is a dataset in R.</span> </span><span class="tooltipr"> %>% <span class="tooltipRtext">The pipe operator that will send the <code>airquality</code> dataset down inside of the code on the following line.</span> </span><br/><span class="tooltipr"> group_by( <span class="tooltipRtext">“group_by” is a function from library(tidyverse) that allows us to split the airquality dataset into “little” datasets, one dataset for each value in the “Month” column.</span> </span><span class="tooltipr"> Month <span class="tooltiprtext">“Month” is a column from the airquality dataset that can be treated as qualitative.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> %>% <span class="tooltipRtext">The pipe operator that will send the grouped version of the <code>airquality</code> dataset down inside of the code on the following line.</span> </span><br/><span class="tooltipr"> summarise( <span class="tooltipRtext">“summarise” is a function from library(tidyverse) that allows us to compute numerical summaries on data.</span> </span><span class="tooltipr"> aveTemp = <span class="tooltiprtext">“AveTemp” is just a name we made up. It will contain the results of the mean(…) function.</span> </span><span class="tooltipr"> mean( <span class="tooltiprtext">“mean” is an R function used to calculate the mean.</span> </span><span class="tooltipr"> Temp <span class="tooltiprtext">Temp is a quantitative variable (numeric vector) from the airquality dataset.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> <br />
<span class="tooltiprtext">Press Enter to run the code.</span> </span><span class="tooltipr" style="float:right;"> … <span class="tooltiprtext">Click to View Output.</span> </span></p>
</div>
</a>
<div id="mean3" style="display:none;">
<table style="width:25%;">
<colgroup>
<col width="11%" />
<col width="13%" />
</colgroup>
<thead>
<tr class="header">
<th align="center">Month</th>
<th align="center">aveTemp</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center">5</td>
<td align="center">65.55</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">79.1</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">83.9</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">83.97</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">76.9</td>
</tr>
</tbody>
</table>
<p>Note that R calculated the mean <code>Temp</code> for each month in <code>Month</code> from the <code>airquality</code> dataset.</p>
<p>May (5), June (6), July (7), August (8), and September (9), respectively.</p>
<p>Further, note that to get the “nicely formatted” table, you would have to use</p>
<pre><code>library(pander)
airquality %>%
group_by(Month) %>%
summarise(aveTemp = mean(Temp)) %>%
pander()</code></pre>
</div>
<p><br/></p>
<p>A note about missing values in data…</p>
<a href="javascript:showhide('mean1b')">
<div class="hoverchunk">
<p><span class="tooltipr"> mean <span class="tooltiprtext">“mean” is an R function used to calculate the mean of data.</span> </span><span class="tooltipr"> ( <span class="tooltiprtext">Parenthesis to begin the function. Must touch the last letter of the function.</span> </span><span class="tooltipr"> airquality <span class="tooltiprtext">“airquality” is a dataset. Type “View(airquality)” in R to see it.</span> </span><span class="tooltipr"> $ <span class="tooltiprtext">The $ allows us to access any variable from the airquality dataset.</span> </span><span class="tooltipr"> Ozone <span class="tooltiprtext">“Ozone” is a quantitative variable (numeric vector) from the “airquality” dataset.</span> </span><span class="tooltipr"> , <span class="tooltiprtext">The comma allows us to specify optional commands.</span> </span><span class="tooltipr"> na.rm=TRUE <span class="tooltiprtext">Missing values are called “NA” in R. If data contains missing values, <code>mean(...)</code> will give “NA” as the result unless we “remove” (rm) the “NA” (na) values.</span> </span><span class="tooltipr"> )<br />
<span class="tooltiprtext">Closing parenthsis for the mean function.</span> </span><span class="tooltipr"> <br />
<span class="tooltiprtext">Press Enter to run the code if you have typed it in yourself. You can also click here to view the output.</span> </span><span class="tooltipr" style="float:right;"> … <span class="tooltiprtext">Click to View Output.</span> </span></p>
</div>
</a>
<div id="mean1b" style="display:none;">
<pre><code>## [1] 42.12931</code></pre>
<p>Note that the single number showing above is the average <code>Ozone</code> from the <code>airquality</code> dataset. Because the <code>Ozone</code> column had missing values, we had to use the option <code>na.rm=TRUE</code> to get the mean to calculate. If we had left it off, we would have gotten an “NA” result:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">mean</span>(airquality<span class="sc">$</span>Ozone)</span></code></pre></div>
<pre><code>## [1] NA</code></pre>
</div>
</div>
<hr />
</div>
<div id="explanation" class="section level4">
<h4>Explanation</h4>
<div style="padding-left:150px;">
<p>The mathematical formula used to compute the mean of data is given by the formula to the left. Although the formula looks complicated, all it states is “add all the data values up and divide by the total number of values.” Read on to learn what all the symbols in the formula represent.</p>
<div id="symbols-in-the-formula" class="section level5">
<h5>Symbols in the Formula</h5>
<ul>
<li><p><span class="math inline">\(\bar{x}\)</span> is read “x-bar” and is the symbol typically used for the <strong>sample mean</strong>, the mean computed on a <em>sample</em> of data from a population.</p></li>
<li><p><span class="math inline">\(\Sigma\)</span>, the capital Greek letter “sigma,” is the symbol used to imply “add all of the data values up.”</p></li>
<li><p>The <span class="math inline">\(x_i\)</span>’s are the data values. The <span class="math inline">\(i\)</span> in the <span class="math inline">\(x_i\)</span> is stated to go from <span class="math inline">\(i=1\)</span> all the way up to <span class="math inline">\(n\)</span>. In other words, data value 1 is represented by <span class="math inline">\(x_1\)</span>, data value 2: <span class="math inline">\(x_2\)</span>, <span class="math inline">\(\ldots\)</span>, up through the last data value <span class="math inline">\(x_n\)</span>. In general, we just write <span class="math inline">\(x_i\)</span>.</p></li>
<li><p><span class="math inline">\(n\)</span> represents the sample size, or number of data values.</p></li>
</ul>
</div>
<div id="population-mean" class="section level5">
<h5>Population Mean</h5>
<p>When <strong>all</strong> of the data from a population is available, the <strong>population mean</strong> is calculated instead of the sample mean. The mathematical formula for the <strong>population mean</strong> is the same as the formula for the sample mean, but is written with slightly different notation. <span class="math display">\[
\mu = \frac{\sum_{i=1}^N x_i}{N}
\]</span> Notice that the symbol for the population mean is <span class="math inline">\(\mu\)</span>, pronounced “mew,” another Greek letter. (Review your <a href="https://en.wikipedia.org/wiki/Greek_alphabet#Letters">Greek alphabet</a>.) The only other difference between the two formulas is that the sample mean uses a sample of data, denoted by <span class="math inline">\(n\)</span>, while the population mean uses all the population data, denoted by <span class="math inline">\(N\)</span>.</p>
</div>
<div id="physicalinterpretation" class="section level5">
<h5>Physical Interpretation</h5>
<p>The mean is sometimes described as the “balance point” of the data. The following example will demonstrate.</p>
<p>Say there are <span class="math inline">\(n=5\)</span> data points with the following values.</p>
<ul>
<li><span class="math inline">\(x_1 = 2\)</span></li>
<li><span class="math inline">\(x_2 = 5\)</span></li>
<li><span class="math inline">\(x_3 = 6\)</span></li>
<li><span class="math inline">\(x_4 = 7\)</span></li>
<li><span class="math inline">\(x_5 = 10\)</span></li>
</ul>
<p>The sample mean is calculated as follows. <span class="math display">\[
\bar{x} = \frac{\sum_{i=1}^n x_i}{n} = \frac{2 + 5 + 6 + 7 + 10}{5} = 6
\]</span> If these values were plotted, and an “infinitely thin bar” connected the points, then the bar would “balance” at the mean (the triangle) as shown below.</p>
<p><img src="NumericalSummaries_files/figure-html/unnamed-chunk-6-1.png" width="672" /></p>
</div>
<div id="deviations" class="section level5">
<h5>Middle of the Deviations</h5>
<p>The above plot demonstrates that there are equal, but opposite, “sums of deviations” to either side of the mean. Note that a deviation is defined as the distance from the mean to a given point. Thus, <span class="math inline">\(x_1\)</span> has a deviation of -4 from the mean, <span class="math inline">\(x_2\)</span> a deviation of -1, <span class="math inline">\(x_3\)</span> a deviation of 0, <span class="math inline">\(x_4\)</span> a deviation of 1, and <span class="math inline">\(x_5\)</span> a deviation of 4. To the left there is a sum of deviations equal to -5 and on the right, a sum of deviations equal to 5. This can be verified to hold for any scenario.</p>
</div>
<div id="outliers" class="section level5">
<h5>Effect of Outliers</h5>
<p>The mean can be strongly influenced by <em>outliers</em>, points that deviate abnormally from the mean. This is shown below by changing <span class="math inline">\(x_5\)</span> to be 20. Note that the deviation of <span class="math inline">\(x_5\)</span> is 12, and the sum of deviations to the left of the mean (<span class="math inline">\(\bar{x}=8\)</span>) is <span class="math inline">\(-1 + -2 + -3 + -6 = -12\)</span>.</p>
<p>The mean of the altered data</p>
<ul>
<li><span class="math inline">\(x_1 = 2\)</span></li>
<li><span class="math inline">\(x_2 = 5\)</span></li>
<li><span class="math inline">\(x_3 = 6\)</span></li>
<li><span class="math inline">\(x_4 = 7\)</span></li>
<li><span class="math inline">\(x_5 = 20\)</span></li>
</ul>
<p>is now <span class="math inline">\(\bar{x} = \frac{\sum_{i=1}^n x_i}{n} = \frac{2 + 5 + 6 + 7 + 20}{5} = 8\)</span>.</p>
<p><img src="NumericalSummaries_files/figure-html/unnamed-chunk-7-1.png" width="672" /></p>
</div>
</div>
<hr />
</div>
</div>
<div id="median" class="section level3 tabset tabset-fade tabset-pills">
<h3 class="tabset tabset-fade tabset-pills">Median</h3>
<div style="float:left;width:150px;">
<span class="math display">\[
\frac{x_{(n/2)}+x_{(n/2+1)}}{2}
\]</span>
<center>
<span class="math inline">\(\uparrow\)</span> <strong>even</strong> <span class="math inline">\(n\)</span> <strong>odd</strong> <span class="math inline">\(\downarrow\)</span>
</center>
<p><span class="math display">\[
x_{((n+1)/2)}
\]</span></p>
</div>
<p><strong>Measure of Center | 1 Quantitative Variable</strong></p>
<div id="overview-1" class="section level4">
<h4>Overview</h4>
<div style="padding-left:150px;">
<p>The “middle data point,” i.e., the 50<span class="math inline">\(^{th}\)</span> percentile. Half of the data is below the median and half is above the median. Typically used in tandem with the five-number summary to describe skewed data because it is not heavily influenced by outliers, i.e., it is <em>robust</em>. Can also be used with normally distributed data, but the mean and standard deviation are more useful measures in such cases.</p>
</div>
<hr />
</div>
<div id="r-instructions-1" class="section level4">
<h4>R Instructions</h4>
<div style="padding-left:150px;">
<p>To calculate a median in R use the code:</p>
<p><code>median(object)</code></p>
<ul>
<li><code>object</code> must be a quantitative variable, what R calls a “numeric vector.”</li>
</ul>
<p><br></p>
<p><strong>Example Code</strong></p>
<a href="javascript:showhide('median1')">
<div class="hoverchunk">
<p><span class="tooltipr"> median <span class="tooltiprtext">“median” is an R function used to calculate the median of data.</span> </span><span class="tooltipr"> ( <span class="tooltiprtext">Parenthesis to begin the function. Must touch the last letter of the function.</span> </span><span class="tooltipr"> airquality <span class="tooltiprtext">“airquality” is a dataset. Type “View(airquality)” in R to see it.</span> </span><span class="tooltipr"> $ <span class="tooltiprtext">The $ allows us to access any variable from the airquality dataset.</span> </span><span class="tooltipr"> Temp <span class="tooltiprtext">“Temp” is a quantitative variable (numeric vector) from the “airquality” dataset.</span> </span><span class="tooltipr"> )<br />
<span class="tooltiprtext">Closing parenthsis for the median function.</span> </span><span class="tooltipr"> <br />
<span class="tooltiprtext">Press Enter to run the code if you have typed it in yourself. You can also click here to view the output.</span> </span><span class="tooltipr" style="float:right;"> … <span class="tooltiprtext">Click to View Output.</span> </span></p>
</div>
</a>
<div id="median1" style="display:none;">
<pre><code>## [1] 79</code></pre>
<p>Note that the single number showing above is the median <code>Temp</code> from the <code>airquality</code> dataset.</p>
</div>
<a href="javascript:showhide('median2')">
<div class="hoverchunk">
<p><span class="tooltipr"> library(tidyverse) <span class="tooltiprtext">tidyverse is an R Package that is very useful for working with data.</span> </span><br><span class="tooltipr"> airquality <span class="tooltipRtext"><code>airquality</code> is a dataset in R.</span> </span><span class="tooltipr"> %>% <span class="tooltipRtext">The pipe operator that will send the <code>airquality</code> dataset down inside of the code on the following line.</span> </span><br/><span class="tooltipr"> group_by( <span class="tooltipRtext">“group_by” is a function from library(tidyverse) that allows us to split the airquality dataset into “little” datasets, one dataset for each value in the “Month” column.</span> </span><span class="tooltipr"> Month <span class="tooltiprtext">“Month” is a column from the airquality dataset that can be treated as qualitative.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> %>% <span class="tooltipRtext">The pipe operator that will send the grouped version of the <code>airquality</code> dataset down inside of the code on the following line.</span> </span><br/><span class="tooltipr"> summarise( <span class="tooltipRtext">“summarise” is a function from library(tidyverse) that allows us to compute numerical summaries on data.</span> </span><span class="tooltipr"> medTemp = <span class="tooltiprtext">“medTemp” is just a name we made up. It will contain the results of the median(…) function.</span> </span><span class="tooltipr"> median( <span class="tooltiprtext">“median” is an R function used to calculate the median.</span> </span><span class="tooltipr"> Temp <span class="tooltiprtext">Temp is a quantitative variable (numeric vector) from the airquality dataset.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> <br />
<span class="tooltiprtext">Press Enter to run the code.</span> </span><span class="tooltipr" style="float:right;"> … <span class="tooltiprtext">Click to View Output.</span> </span></p>
</div>
</a>
<div id="median2" style="display:none;">
<table style="width:25%;">
<colgroup>
<col width="11%" />
<col width="13%" />
</colgroup>
<thead>
<tr class="header">
<th align="center">Month</th>
<th align="center">medTemp</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center">5</td>
<td align="center">66</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">78</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">84</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">82</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">76</td>
</tr>
</tbody>
</table>
<p>Note that R calculated the median <code>Temp</code> for each month in <code>Month</code> from the <code>airquality</code> dataset.</p>
<p>May (5), June (6), July (7), August (8), and September (9), respectively.</p>
<p>Further, to get the nicely formatted table you must use:</p>
<pre><code>library(pander)
airquality %>%
group_by(Month) %>%
summarise(medTemp = median(Temp)) %>%
pander()</code></pre>
</div>
</div>
<hr />
</div>
<div id="explanation-1" class="section level4">
<h4>Explanation</h4>
<div style="padding-left:150px;">
<p>The mathematical formula used to compute the median of data depends on whether <span class="math inline">\(n\)</span>, the number of data points in the sample, is even or odd.</p>
<p>If <span class="math inline">\(n\)</span> is even, then there is no “middle” data point, so the middle two values are averaged. <span class="math display">\[
\text{Median} = \frac{x_{(n/2)}+x_{(n/2+1)}}{2}
\]</span></p>
<p>If <span class="math inline">\(n\)</span> is odd, then the middle data point is the median. <span class="math display">\[
\text{Median} = x_{((n+1)/2)}
\]</span></p>
<div id="symbols-in-the-formula-1" class="section level5">
<h5>Symbols in the Formula</h5>
<p>There is no generally accepted symbol for the median. Sometimes a capital <span class="math inline">\(M\)</span> or even lower-case <span class="math inline">\(m\)</span> is used, but generally the word median is just written out.</p>
<ul>
<li><p><span class="math inline">\(x_{(n/2)}\)</span> represents the data value that is in the <span class="math inline">\((n/2)^{th}\)</span> position in the ordered list of values. It only exists when <span class="math inline">\(n\)</span> is even.</p></li>
<li><p><span class="math inline">\(x_{(n/2+1)}\)</span> represents the data value that immediately follows the <span class="math inline">\((n/2)^{th}\)</span> value in the ordered list of values. It only exists when <span class="math inline">\(n\)</span> is even.</p></li>
<li><p><span class="math inline">\(x_{((n+1)/2)}\)</span> represents the data value that is in the <span class="math inline">\(((n+1)/2)^{th}\)</span> position in the ordered list of values. It only exists when <span class="math inline">\(n\)</span> is odd.</p></li>
<li><p><span class="math inline">\(n\)</span> represents the sample size, or number of data values in the sample.</p></li>
</ul>
</div>
<div id="population-median" class="section level5">
<h5>Population Median</h5>
<p>When <strong>all</strong> of the data from a population is available, the <strong>population median</strong> is calculated by the above formulas with the slight change that <span class="math inline">\(N\)</span>, the total number of data values in the population, instead of <span class="math inline">\(n\)</span>, the number of values in the sample, is used.</p>
<p>If <span class="math inline">\(N\)</span> is even, then there is no “middle” data point, so the middle two values are averaged. <span class="math display">\[
\text{Median} = \frac{x_{(N/2)}+x_{(N/2+1)}}{2}
\]</span></p>
<p>If <span class="math inline">\(N\)</span> is odd, then the middle data point is the median. <span class="math display">\[
\text{Median} = x_{((N+1)/2)}
\]</span></p>
</div>
<div id="physical-interpretation" class="section level5">
<h5>Physical Interpretation</h5>
<p>The median is the <span class="math inline">\(50^{th}\)</span> percentile of the data.</p>
<p>Say there are <span class="math inline">\(n=5\)</span> data points in the sample with the following values.</p>
<ul>
<li><span class="math inline">\(x_1 = 2\)</span></li>
<li><span class="math inline">\(x_2 = 5\)</span></li>
<li><span class="math inline">\(x_3 = 6\)</span></li>
<li><span class="math inline">\(x_4 = 7\)</span></li>
<li><span class="math inline">\(x_5 = 10\)</span></li>
</ul>
<p>The sample median is calculated as follows. Note that <span class="math inline">\(n=5\)</span> is odd. <span class="math display">\[
\text{Median} = x_{((n+1)/2)} = x_{((5+1)/2)} = x_{(3)} = 6
\]</span> When these values are plotted it is clear that exactly 50% of the data (excluding the median) is to either side of the median.</p>
<p><img src="NumericalSummaries_files/figure-html/unnamed-chunk-10-1.png" width="672" /></p>
<div id="second-example" class="section level6">
<h6>Second Example</h6>
<p>Say there was a sixth value in the data set equal to 10, so that <span class="math inline">\(n=6\)</span> is even.</p>
<ul>
<li><span class="math inline">\(x_1 = 2\)</span></li>
<li><span class="math inline">\(x_2 = 5\)</span></li>
<li><span class="math inline">\(x_3 = 6\)</span></li>
<li><span class="math inline">\(x_4 = 7\)</span></li>
<li><span class="math inline">\(x_5 = 10\)</span></li>
<li><span class="math inline">\(x_6 = 10\)</span></li>
</ul>
<p><span class="math display">\[
\text{Median} = \frac{x_{(n/2)}+x_{(n/2+1)}}{2} = \frac{x_{(6/2)}+x_{(6/2+1)}}{2} = \frac{x_{(3)}+x_{(4)}}{2} = \frac{6+7}{2} = 6.5
\]</span></p>
<p><img src="NumericalSummaries_files/figure-html/unnamed-chunk-11-1.png" width="672" /></p>
</div>
</div>
<div id="effect-of-outliers" class="section level5">
<h5>Effect of Outliers</h5>
<p>The median is not greatly influenced by <em>outliers</em>. It is said to be <em>robust</em>. This is shown below by changing <span class="math inline">\(x_6\)</span> to be 20, which does not change the value of the median.</p>
<p><img src="NumericalSummaries_files/figure-html/unnamed-chunk-12-1.png" width="672" /></p>
</div>
</div>
<hr />
</div>
</div>
<div id="mode" class="section level3 tabset tabset-fade tabset-pills">
<h3 class="tabset tabset-fade tabset-pills">Mode</h3>
<div style="float:left;width:150px;">
<center>
<p><strong>Most</strong></p>
<p><strong>Frequent</strong></p>
<strong>Value</strong>
</center>
</div>
<p><strong>Measure of Center | 1 Quantitative or Qualitative Variable</strong></p>
<div id="overview-2" class="section level4">
<h4>Overview</h4>
<div style="padding-left:150px;">
<p>The most commonly occurring value. There may be more than one mode. Seldom used, but sometimes useful.</p>
</div>
<hr />
</div>
<div id="r-instructions-2" class="section level4">
<h4>R Instructions</h4>
<div style="padding-left:150px;">
<p>R will not calculate a mode directly. However, to tabulate the number of times each value occurs in a dataset, use the code:</p>
<p><code>table(object)</code></p>
<ul>
<li><code>object</code> can be quantitative or qualitative, but should contain at least one repeated value or <code>table()</code> is not useful.</li>
</ul>
<p><br></p>
<p><strong>Example Code</strong></p>
<p>Hover your mouse over the example codes to learn more.</p>
<a href="javascript:showhide('table1')">
<div class="hoverchunk">
<p><span class="tooltipr"> table <span class="tooltiprtext">“table” is an R function used to count how many times each observation occurs in a list of data.</span> </span><span class="tooltipr"> ( <span class="tooltiprtext">Parenthesis to begin the function. Must touch the last letter of the function.</span> </span><span class="tooltipr"> airquality <span class="tooltiprtext">“airquality” is a dataset. Type “View(airquality)” in R to see it.</span> </span><span class="tooltipr"> $ <span class="tooltiprtext">The $ allows us to access any variable from the airquality dataset.</span> </span><span class="tooltipr"> Month <span class="tooltiprtext">“Month” is a qualitative variable (technically a numeric vector) from the “airquality” dataset that contains repeated values.</span> </span><span class="tooltipr"> )<br />
<span class="tooltiprtext">Closing parenthsis for the function.</span> </span><span class="tooltipr"> <br />
<span class="tooltiprtext">Press Enter to run the code if you have typed it in yourself. You can also click here to view the output.</span> </span><span class="tooltipr" style="float:right;"> … <span class="tooltiprtext">Click to View Output.</span> </span></p>
</div>
</a>
<div id="table1" style="display:none;">
<pre><code>##
## 5 6 7 8 9
## 31 30 31 31 30</code></pre>
<p>Note that the modes would be 5, 7, and 8 because these months all have the most (31) days in them.</p>
</div>
<a href="javascript:showhide('mode2')">
<div class="hoverchunk">
<p><span class="tooltipr"> library(tidyverse) <span class="tooltiprtext">tidyverse is an R Package that is very useful for working with data.</span> </span><br><span class="tooltipr"> airquality <span class="tooltipRtext"><code>airquality</code> is a dataset in R.</span> </span><span class="tooltipr"> %>% <span class="tooltipRtext">The pipe operator that will send the <code>airquality</code> dataset down inside of the code on the following line.</span> </span><br/><span class="tooltipr"> group_by( <span class="tooltipRtext">“group_by” is a function from library(tidyverse) that allows us to split the airquality dataset into “little” datasets, one dataset for each value in the “Month” column.</span> </span><span class="tooltipr"> Month <span class="tooltiprtext">“Month” is a column from the airquality dataset that can be treated as qualitative.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> %>% <span class="tooltipRtext">The pipe operator that will send the grouped version of the <code>airquality</code> dataset down inside of the code on the following line.</span> </span><br/><span class="tooltipr"> summarise( <span class="tooltipRtext">“summarise” is a function from library(tidyverse) that allows us to compute numerical summaries on data.</span> </span><span class="tooltipr"> aveTemp = mean(Temp), <span class="tooltiprtext">Computes the mean of the Temp column.</span> </span><span class="tooltipr"> medTemp = median(Temp), <span class="tooltiprtext">Computes the median of the Temp column.</span> </span><span class="tooltipr"> sampleSize = n( ) <span class="tooltiprtext">Counts how many times each Month (the group_by statement) occurs in the dataset.</span> </span><span class="tooltipr"> ) <span class="tooltiprtext">Functions must always end with a closing parenthesis.</span> </span><span class="tooltipr"> <br />
<span class="tooltiprtext">Press Enter to run the code.</span> </span><span class="tooltipr" style="float:right;"> … <span class="tooltiprtext">Click to View Output.</span> </span></p>
</div>
</a>
<div id="mode2" style="display:none;">
<table style="width:56%;">
<colgroup>
<col width="11%" />
<col width="13%" />
<col width="13%" />
<col width="16%" />
</colgroup>
<thead>
<tr class="header">
<th align="center">Month</th>
<th align="center">aveTemp</th>
<th align="center">medTemp</th>
<th align="center">sampeSize</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center">5</td>
<td align="center">65.55</td>
<td align="center">66</td>
<td align="center">31</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">79.1</td>
<td align="center">78</td>
<td align="center">30</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">83.9</td>
<td align="center">84</td>
<td align="center">31</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">83.97</td>
<td align="center">82</td>
<td align="center">31</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">76.9</td>
<td align="center">76</td>
<td align="center">30</td>
</tr>
</tbody>
</table>
<p>Note that R calculated the median <code>Temp</code> for each month in <code>Month</code> from the <code>airquality</code> dataset.</p>
<p>May (5), June (6), July (7), August (8), and September (9), respectively.</p>
<p>Further, to get the nicely formatted table you must use:</p>
<pre><code>library(pander)
airquality %>%
group_by(Month) %>%
summarise(aveTemp = mean(Temp), medTemp = median(Temp), sampeSize = n()) %>%
pander()</code></pre>
</div>
</div>
<hr />
</div>
</div>
<div id="minimum" class="section level3 tabset tabset-fade tabset-pills">
<h3 class="tabset tabset-fade tabset-pills">Minimum</h3>
<div style="float:left;width:150px;">
<p><span class="math display">\[
x_{(1)}
\]</span></p>
</div>
<p><strong>Measure of Spread | 1 Quantitative Variable</strong></p>
<div id="overview-3" class="section level4">
<h4>Overview</h4>
<div style="padding-left:150px;">
<p>The smallest occurring data value. One of the numerical summaries in the five-number summary. Typically not useful on its own. Gives a good feel for the spread in the left tail of the distribution when used with the five-number summary.</p>
</div>
<hr />