-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathBootstrap-in-R.html
More file actions
1871 lines (1687 loc) · 231 KB
/
Copy pathBootstrap-in-R.html
File metadata and controls
1871 lines (1687 loc) · 231 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 lang="en">
<head>
<title>Bootstrap in R: The boot Package, Step by Step</title>
<meta charset="utf-8">
<meta name="Description" content="Bootstrap in R with the boot package: confidence intervals and hypothesis tests without distributional assumptions. Runnable BCa, percentile, basic examples.">
<meta name="Keywords" content="bootstrap in R, boot package R, bootstrap confidence interval, BCa interval, percentile bootstrap, bootstrap hypothesis test, nonparametric inference, resampling R">
<meta name="Distribution" content="Global">
<meta name="Author" content="Selva Prabhakaran">
<meta name="Robots" content="index, follow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="strict-origin-when-cross-origin">
<link rel="icon" href="/screenshots/iconb-64.png?v=2" type="image/x-icon" />
<link rel="canonical" href="https://r-statistics.co/Bootstrap-in-R.html">
<link rel="alternate" type="application/atom+xml" title="r-statistics.co" href="https://r-statistics.co/feed.xml">
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<!-- Roadmap-jel type system (matches /roadmap/): Inter + Inter Tight + JetBrains Mono -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter+Tight:wght@500;600;700&family=Inter:wght@400;450;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<!-- Preload the primary body font so first paint has IBM Plex Sans ready -->
<link rel="preload" href="/www/fonts/ibm-plex/ibm-plex-sans-latin.woff2" as="font" type="font/woff2" crossorigin>
<!-- Preload heading font (IBM Plex Serif 700) to prevent H1 font swap -->
<link rel="preload" href="/www/fonts/ibm-plex/ibm-plex-serif-700.woff2" as="font" type="font/woff2" crossorigin>
<!-- Critical CSS inlined for fast first paint -->
<style>
@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:400;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-sans-latin.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:500;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-sans-latin.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:600;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-sans-latin.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:700;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-sans-latin.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Serif';font-style:normal;font-weight:600;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-serif-600.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Serif';font-style:normal;font-weight:700;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-serif-700.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Mono';font-style:normal;font-weight:400;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-mono-400.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Mono';font-style:normal;font-weight:500;font-display:optional;src:url('/www/fonts/ibm-plex/ibm-plex-mono-500.woff2') format('woff2')}
*,*::before,*::after{box-sizing:border-box}
html{font-family:sans-serif;-webkit-text-size-adjust:100%}
body{margin:0;font-family:'IBM Plex Sans',-apple-system,BlinkMacSystemFont,sans-serif;font-size:18px;line-height:1.7;color:#0d1117;background:#fafbfc}
html body{font-size:18px;line-height:1.7}
p{margin:0 0 15px}
.container{max-width:1170px;margin:0 auto;padding:0 15px}
@media(min-width:1200px){.container{width:1170px}}
.row{margin-left:-15px;margin-right:-15px}.row::after{content:"";display:table;clear:both}
.col-xs-12,.col-sm-2,.col-sm-3,.col-sm-7{position:relative;min-height:1px;padding-left:15px;padding-right:15px;float:left}
.col-xs-12{width:100%}
@media(min-width:768px){.col-sm-2{width:16.667%}.col-sm-3{width:25%}.col-sm-7{width:58.333%}.hidden-xs{display:block!important}}
.hidden-xs{display:none}
.table{width:100%;border-collapse:collapse}.table>thead>tr>th,.table>tbody>tr>td{padding:8px;border-top:1px solid #ddd}
.table-striped>tbody>tr:nth-of-type(odd){background:#f9f9f9}
.btn{display:inline-block;padding:6px 12px;font-size:14px;border-radius:4px;cursor:pointer;border:1px solid transparent}
.btn-primary{color:#fff;background:#1d3158;border-color:#1d3158}.btn-primary:hover{background:#2c4574}
.btn-default{color:#333;background:#fff;border-color:#ccc}
.btn-sm{padding:3px 10px;font-size:12px}
.form-control{display:block;padding:6px 12px;font-size:14px;border:1px solid #ccc;border-radius:4px}
.list-unstyled{list-style:none;padding-left:0}
.img-responsive{max-width:100%;height:auto}
.pull-right{float:right}
a{color:#1d3158;text-decoration:none}a:hover{text-decoration:underline}
/* overflow-x:clip (not hidden) so html/body don't become a
scrolling container, which would break position:sticky on the
right TOC rail under layout-v2. */
html,body{overflow-x:clip;max-width:100vw}
#sidebar-nav{position:sticky;top:20px;max-height:calc(100vh - 40px);overflow-y:auto;padding:8px 0}
.breadcrumb-nav{font-size:13.5px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#6c757d;margin-bottom:2px;padding:0}
.breadcrumb-nav a{color:#6c757d;text-decoration:none}
.bc-sep,.breadcrumb-sep{margin:0 5px;color:#757575}
.bc-current,.breadcrumb-current{color:#495057;font-weight:500}
#content h1,#content h2,#content h3,#content h4{font-family:'IBM Plex Serif',Georgia,'Times New Roman',serif}
#content h1{font-weight:700;font-size:2.1em;line-height:1.2;margin:0 0 0.4em 0;letter-spacing:-0.01em;color:#0d1117}
#content h2{font-weight:600;font-size:1.65em;line-height:1.25;margin:2.5em 0 0.6em 0;color:#0d1117;padding-top:0.8em;padding-bottom:6px;border-top:1px solid #d8dce2}
#content h2:first-of-type{border-top:none;margin-top:1.5em}
#content p{line-height:1.75;margin-bottom:1.15em;color:#0d1117}
p.lead{font-size:1.1em;line-height:1.75;color:#4a5160;font-weight:400;border-left:3px solid #1d3158;padding-left:1em;margin:-4px 0 1.15em 0}
/* ---- Sidebar collapse rail (posts pages) ----
body.tools-rail (shared key with the Tools pages rail, localStorage
rsc-tools-rail) folds the tutorials sidebar to a slim rail that keeps
ONLY the progress bullets (the green ticks) + section numbers. The
.rail-fold button in #sidebar-nav toggles it; init script after <body>
restores the saved state before first paint. Desktop only. */
@media(min-width:768px){
/* Legacy float layout */
body.tools-rail #nav{width:64px;min-width:64px;padding-right:0}
body.tools-rail #content{width:calc(100% - 64px - 16.667%)}
/* layout-v2 (the live default) lays the row out as a GRID with
!important columns - the rail must re-template the grid itself. */
body.layout-v2.tools-rail .row{grid-template-columns:64px minmax(0,1fr)!important}
body.layout-v2.tools-rail #nav{width:auto;min-width:0;padding:12px 4px 0 0}
body.tools-rail #sidebar-nav .sidebar-tabs,
body.tools-rail #sidebar-nav .continue-chip,
body.tools-rail #sidebar-nav .sidebar-subscribe,
body.tools-rail #sidebar-nav .sidebar-divider,
body.tools-rail #sidebar-nav .section-meta,
body.tools-rail #sidebar-nav .sec-title-t,
body.tools-rail #sidebar-nav .sidebar-chevron,
body.tools-rail #sidebar-nav .sidebar-panel[data-panel="tools"]{display:none!important}
body.tools-rail #sidebar-nav .sidebar-panel[data-panel="posts"]{display:block!important;padding-top:2px}
body.tools-rail #sidebar-nav .sidebar-section-header{padding:6px 0 2px;text-align:center;font-size:11.5px;color:#868b94}
body.tools-rail #sidebar-nav .sec-num{margin:0}
body.tools-rail #sidebar-nav .sidebar-section-items{display:block!important;margin:0;padding:0}
body.tools-rail #sidebar-nav .sidebar-section-items>li{margin:0;padding:0;list-style:none}
body.tools-rail #sidebar-nav .sidebar-section-items>li>a{display:flex;align-items:center;justify-content:center;padding:4px 0;font-size:0;line-height:0;border-left:none;background:none}
body.tools-rail #sidebar-nav .sidebar-section-items>li>a .progress-dot{margin:0;visibility:visible!important}
body.tools-rail #sidebar-nav .sidebar-section-items li a[href$="-quiz.html"]::before{margin-right:0}
body.tools-rail #sidebar-nav .rail-fold .rf-a{display:none}
body.tools-rail #sidebar-nav .rail-fold .rf-b{display:inline}
body.tools-rail #sidebar-nav .rail-fold{justify-content:center;padding:2px 0 10px}
}
.rail-fold{display:flex;align-items:center;justify-content:flex-end;width:100%;background:none;border:none;cursor:pointer;color:#757a87;font:600 12px Inter,'IBM Plex Sans',sans-serif;padding:0 12px 8px;gap:4px}
.rail-fold:hover{color:#0d1117}
.rail-fold .rf-b{display:none;font-size:15px}
@media(max-width:767px){.rail-fold{display:none}}
html.dark .rail-fold{color:#8a90a0}
html.dark .rail-fold:hover{color:#e8eaee}
/* Markup caret next to "Exercises" (glyph is in the markup, not a CSS
content escape). practice-nav.js rotates it on open / hides <980px. */
.ex-caret{display:inline-block;margin-left:4px;font-size:.62em;line-height:1;opacity:.6;transition:transform .2s}
.nav-dropdown{position:relative;display:inline-block}
.nav-dropdown-trigger{cursor:pointer}
.nav-dropdown-trigger::after{content:' \25BE';font-size:10px;color:#8a8f99}
.nav-dropdown-panel{display:none;position:absolute;top:calc(100% + 6px);left:0;background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:14px 0;box-shadow:0 8px 24px rgba(13,17,23,0.10);min-width:260px;z-index:40;flex-direction:column}
.nav-dropdown-panel::before{content:"";position:absolute;top:-6px;left:0;right:0;height:6px}
.nav-dropdown:hover .nav-dropdown-panel,.nav-dropdown.open .nav-dropdown-panel{display:flex}
.nav-cat{position:relative;display:flex;align-items:center;justify-content:space-between;padding:7px 18px;font-family:'IBM Plex Sans',sans-serif;font-size:13px;font-weight:500;color:#3a3f4a;cursor:pointer;transition:background 0.1s}
.nav-cat:hover{background:#f1f3f6;color:#0d1117}
.nav-cat::after{content:' \25B8';font-size:10px;color:#8a8f99;margin-left:8px}
.nav-sub{display:none;position:absolute;top:0;left:100%;background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:14px 18px;box-shadow:0 8px 24px rgba(13,17,23,0.10);min-width:230px;z-index:50}
.nav-sub::before{content:"";position:absolute;top:0;left:-8px;bottom:0;width:8px}
.nav-cat:hover .nav-sub{display:block}
.nav-sub a{display:block;padding:5px 0;font-size:13px;color:#3a3f4a;text-decoration:none;font-weight:400;line-height:1.4}
.nav-sub a:hover{color:#1d3158;text-decoration:underline}
.nav-sub h6{margin:10px 0 4px;font-family:'IBM Plex Sans',sans-serif;font-size:10px;font-weight:600;color:#8a8f99;text-transform:uppercase;letter-spacing:0.06em}
.nav-sub h6:first-child{margin-top:0}
html.dark .nav-dropdown-panel,html.dark .nav-sub{background:#161a1f;border-color:#2a2e35;box-shadow:0 8px 24px rgba(0,0,0,0.45)}
html.dark .nav-cat{color:#c5cad3}
html.dark .nav-cat:hover{background:#1a1d22;color:#fff}
html.dark .nav-sub a{color:#c5cad3}
html.dark .nav-sub a:hover{color:#fff}
html.dark .nav-sub h6{color:#7a808c}
@media (max-width: 768px){.nav-dropdown-panel{min-width:220px;left:auto;right:0}.nav-sub{position:static;border:none;box-shadow:none;padding:6px 0 6px 16px}.nav-cat::after{content:''}}
hr{height:0;box-sizing:content-box;border:0;border-top:1px solid #eee}
.img-zoomable{cursor:zoom-in;transition:opacity .15s}
.img-lightbox{display:none;position:fixed;top:0;left:0;right:0;bottom:0;z-index:10001;background:rgba(0,0,0,.85);cursor:zoom-out;align-items:center;justify-content:center}
.img-lightbox.open{display:flex}
.img-lightbox img{max-width:95vw;max-height:95vh;border-radius:4px;box-shadow:0 4px 24px rgba(0,0,0,.4)}
/* CLS prevention: sidebar component styles (match main.css final state) */
.sidebar-menu{margin:0;padding:0}
.sidebar-tabs{display:flex;gap:0;margin:4px 0 0;border-bottom:1px solid #d8dce2}
.sidebar-tab{flex:1;padding:9px 12px 8px;border:none;background:transparent;font:600 13px 'IBM Plex Sans',sans-serif;color:#757a87;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;transition:color 0.15s,border-color 0.15s}
.sidebar-tab.active{color:#1d3158;border-bottom-color:#1d3158}
.sidebar-panel{display:none;padding-top:10px}
.sidebar-panel.active{display:block}
.sidebar-tools-list{margin:0;padding:0;list-style:none}
.sidebar-tools-list li a{display:block;padding:5px 10px 5px 24px;font-size:14px;color:#495057;text-decoration:none;border-left:2px solid transparent;border-radius:0 4px 4px 0}
.sidebar-section-header{padding:7px 12px;font-size:15px;font-weight:700;color:#212529;cursor:pointer;border-radius:4px}
.sidebar-chevron{display:inline-block;font-size:10px;margin-right:4px;color:#757575}
.sidebar-section-items{display:none;padding-left:0;margin:2px 0 6px}
.sidebar-section.expanded .sidebar-section-items{display:block}
.sidebar-section-items li{line-height:1.5}
.sidebar-section-items li a{display:block;padding:4px 10px 4px 32px;font-size:14px;color:#495057;text-decoration:none;border-left:2px solid transparent;border-radius:0 4px 4px 0}
.sidebar-divider{margin:12px 0 2px;padding:0 12px 4px 24px;font-size:11px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:#9ca3af;border-bottom:1px solid #f0f2f5;list-style:none}
.sidebar-divider:first-child{margin-top:4px}
.progress-dot{display:inline-block;width:10px;height:10px;border-radius:50%;border:1.5px solid #d1d5db;margin-right:7px;vertical-align:middle;flex-shrink:0;position:relative}
/* Empty progress-dot (no status class) reads as an unchecked todo /
disabled radio next to every sidebar item — visual noise that doesn't
belong in a nav. Reserve the layout slot but hide the circle until
the item actually has progress. visibility:hidden (not display:none)
keeps the width stable when state flips. */
.progress-dot:not(.started):not(.visited):not(.completed){visibility:hidden}
/* CLS prevention: TOC sidebar matches main.css final state */
#toc-wrapper{position:sticky;top:20px;max-height:calc(100vh - 40px);overflow-y:auto;padding-left:14px;border-left:1px solid #e9ecef}
.toc-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.8px;color:#6c757d;margin-bottom:10px;padding-bottom:0}
#toc{margin:0;padding:0}
#toc li{line-height:1.45;margin-bottom:1px}
#toc li a{font-size:13.5px;color:#6c757d;text-decoration:none;display:block;padding:3px 0;border-left:2px solid transparent;padding-left:8px;margin-left:-15px}
#toc li a.toc-active{color:#1d3158;font-weight:600;border-left-color:#1d3158}
/* CLS prevention: engagement strip layout (matches engagement.css) */
.engagement-header{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px;color:#64748b;letter-spacing:0.01em;margin:0.4em 0 1em;min-height:22px}
.engagement-header:empty{display:none}
/* CLS prevention: progress bar space (matches engagement.css) */
.engagement-progress{min-height:32px;margin:1.2em 0 1.6em}
/* CLS prevention: WebR editor min-height so the static→textarea swap doesn't shift layout */
.webr-editor{min-height:60px}
/* CLS prevention: images in content always reserve aspect ratio */
#content img{max-width:100%;height:auto}
/* =====================================================
LAYOUT V2 (opt-in via body.layout-v2). Retry 2026-05-29.
Differences from the first attempt:
1. Sidebar columns use clamp(180px, 16vw, 260px) so they
SHRINK on narrow viewports (first attempt used minmax
which pinned both sides at 260px, squeezing content on
typical laptops to ~460px).
2. Sidebar links get overflow-wrap so long tutorial titles
don't escape the narrower column.
3. min-width:0 on every grid child so they can shrink.
4. Right TOC breakpoint raised from 1100px -> 1280px so it
only shows when the viewport can actually afford it.
5. The inline-code background restyle is dropped - kept
current syntax-highlighter behavior.
All rules scoped under body.layout-v2 so pages without it
render identically.
===================================================== */
body.layout-v2{
--lv2-bg:#f8f9fb;--lv2-card:#fff;--lv2-ink:#0d1117;
--lv2-mut:#4b5260;--lv2-faint:#5b6573;
--lv2-navy:#1c2c4f;--lv2-navy-h:#2d4173;--lv2-navy-soft:#eef1f7;
--lv2-accent:#2056d2;--lv2-accent-soft:#e9efff;
--lv2-line:#e4e7ee;--lv2-border:#d4d9e3;
--lv2-green:#15803d;
background:var(--lv2-bg);color:var(--lv2-ink);
}
html.dark body.layout-v2{
--lv2-bg:#0a0f1c;--lv2-card:#0f1525;--lv2-ink:#eef2fa;
--lv2-mut:#a5afc4;--lv2-faint:#9aa6c0;
--lv2-navy:#5170b3;--lv2-navy-h:#6587c4;--lv2-navy-soft:#192240;
--lv2-accent:#7faaff;--lv2-accent-soft:#1a2748;
--lv2-line:#1f2a48;--lv2-border:#2c3a62;
}
/* Wider container; clamp-based grid that scales with viewport.
width:auto is REQUIRED because the base critical CSS has
@media(min-width:1200px){.container{width:1170px}} which would
otherwise pin width to 1170 and ignore max-width:1340. */
body.layout-v2 .container{max-width:1340px;width:auto;padding:0 22px}
body.layout-v2 .row{
display:grid;
grid-template-columns:
clamp(180px, 16vw, 260px)
minmax(0, 1fr)
clamp(180px, 16vw, 260px);
gap:0;margin-left:0;margin-right:0;
}
/* Bootstrap inserts .row::before AND .row::after pseudo-elements
(content:" "; display:table) as a clearfix. Under display:grid
these pseudos count as grid items. ::before grabs col 1, pushing
every real child one column to the right and wrapping the last
child to a new row. The 2026-05-29 first attempt only disabled
::after, resulting in nav in col 2, content in col 3, and toc
wrapping to a new row at col 1 (the bug the user reported as
"sidebar wide, content narrow"). BOTH pseudos must be killed. */
body.layout-v2 .row::before,
body.layout-v2 .row::after{display:none;content:none}
/* min-width:0 lets grid children shrink below their content's
intrinsic min-width; without this, long unbreakable text in any
child forces the column wider than the grid template intended. */
/* Drop Bootstrap's float and width on the legacy .col-sm-* hooks
so the parent .row's CSS grid owns sizing. DO NOT zero horizontal
padding here — per-column padding lives in the dedicated rules
below (sidebar, #content, #toc-sidebar) and gives the article
the 44px breathing room the mock has. */
body.layout-v2 #nav.col-sm-3,
body.layout-v2 #content.col-sm-7,
body.layout-v2 #toc-sidebar.col-sm-2{
width:auto!important;float:none!important;
min-width:0;min-height:0;
}
body.layout-v2 #nav.col-sm-3{
padding:14px 10px 40px;border-right:1px solid var(--lv2-line);
position:sticky;top:60px;height:calc(100vh - 60px);overflow-y:auto;
}
/* Inner #sidebar-nav had its own sticky + overflow from the legacy critical
CSS; under layout-v2 the outer #nav owns scrolling, so flatten the inner
one to avoid a double scrollbar. */
body.layout-v2 #sidebar-nav{
position:static;max-height:none;overflow:visible;padding:0;
}
/* Wrap long tutorial titles in the sidebar so they never overflow */
body.layout-v2 #nav a,
body.layout-v2 #nav span,
body.layout-v2 #sidebar-nav a,
body.layout-v2 #sidebar-nav li{
overflow-wrap:break-word;word-break:break-word;
}
body.layout-v2 #content{padding:24px 44px 60px}
/* S3 — Code-block bottom spacing.
Default .webr-container margin is 22/22; the dark block visually
carries a lot of weight, so the next paragraph reads as cramped.
Lift bottom to 30px under layout-v2. */
body.layout-v2 #content .webr-container{margin-bottom:30px}
/* S7 — Further Reading: convert auto-injected <ul> to a 2-column
card grid that matches the .rt-grid pattern used elsewhere.
No HTML/auto_link.py changes needed — pure CSS. */
body.layout-v2 #content #auto-further-reading .further-reading-list{
list-style:none;padding:0;margin:14px 0 0;
display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;
}
body.layout-v2 #content #auto-further-reading .further-reading-list li{margin:0}
body.layout-v2 #content #auto-further-reading .further-reading-list li a{
display:block;padding:14px 16px;
background:var(--lv2-card);border:1px solid var(--lv2-border);
border-radius:8px;color:var(--lv2-ink);
font-weight:500;font-size:15px;line-height:1.4;
text-decoration:none;
transition:border-color .15s,background .15s,transform .15s;
}
body.layout-v2 #content #auto-further-reading .further-reading-list li a:hover{
border-color:var(--lv2-accent);background:var(--lv2-accent-soft);
text-decoration:none;transform:translateY(-1px);
}
@media(max-width:820px){
body.layout-v2 #content #auto-further-reading .further-reading-list{
grid-template-columns:1fr;
}
}
body.layout-v2 #toc-sidebar{padding:24px 18px;position:sticky;top:74px;align-self:start}
@media(max-width:1280px){
body.layout-v2 .row{grid-template-columns:clamp(180px, 18vw, 260px) minmax(0,1fr)}
body.layout-v2 #toc-sidebar{display:none}
}
@media(max-width:820px){
body.layout-v2 .row{grid-template-columns:1fr}
body.layout-v2 #nav{display:none}
body.layout-v2 #content{padding:20px}
}
/* Typography refresh - sized to mock spec */
body.layout-v2 #content{
font-size:16.5px;line-height:1.7;color:var(--lv2-ink);
font-feature-settings:"tnum","ss01","cv11";text-rendering:optimizeLegibility;
}
body.layout-v2 #content p{line-height:1.7;margin:13px 0;color:var(--lv2-ink);text-wrap:pretty}
body.layout-v2 #content h1{
font-size:38px;font-weight:700;line-height:1.2;letter-spacing:-0.018em;
margin:10px 0 13px;text-wrap:balance;color:var(--lv2-ink);
}
/* H2: hairline divider + breathing room above. Mock breaks each
section with a top rule and ~48px space; staging used 34px and no
divider, leaving sections to blur together. :first-of-type keeps
the very first H2 flush with the actionbar (no double divider). */
body.layout-v2 #content h2{
font-size:25px;font-weight:600;line-height:1.25;letter-spacing:-0.018em;
margin:48px 0 12px;padding-top:32px;border-top:1px solid var(--lv2-line);
text-wrap:balance;color:var(--lv2-ink);
}
body.layout-v2 #content h2:first-of-type{
margin-top:24px;padding-top:0;border-top:none;
}
body.layout-v2 #content h3,body.layout-v2 #content h4{
font-size:18px;font-weight:600;line-height:1.3;margin:24px 0 8px;text-wrap:balance;color:var(--lv2-ink);
}
/* Specificity bump: `body.layout-v2 #content p` (1 id + 1 class
+ 2 elements) was beating `body.layout-v2 p.lead` (2 classes +
2 elements) and forcing the dek to var(--lv2-ink) instead of
var(--lv2-mut). Adding #content here matches that specificity. */
body.layout-v2 #content p.lead{
font-size:18.5px;line-height:1.6;color:var(--lv2-mut);
border-left:3px solid var(--lv2-navy);padding-left:17px;margin:-2px 0 20px;font-weight:400;
}
/* Body link color: legacy a{color:#1d3158} and Bootstrap .text-muted
leave inline links almost indistinguishable from body text. Use
the mock accent so links are obviously clickable. Excludes
buttons, cards, prev/next nav, and TOC items which have their
own palette. */
body.layout-v2 #content a:not(.btn):not(.rt-card):not(.pn-link):not(.lv2-anchor):not([class*="toc"]){
color:var(--lv2-accent);
}
body.layout-v2 #content a:not(.btn):not(.rt-card):not(.pn-link):not(.lv2-anchor):not([class*="toc"]):hover{
text-decoration:underline;
}
/* Inline <code> palette: match the mock's navy-soft tint instead
of the legacy purple-blue (#eef vs #eef1f7). */
body.layout-v2 #content :not(pre) > code{
background:var(--lv2-navy-soft);color:var(--lv2-ink);
border-radius:4px;padding:2px 5px;font-size:0.92em;
}
/* TOC right rail */
body.layout-v2 #toc-sidebar .toc-title{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--lv2-faint);margin-bottom:9px}
body.layout-v2 #toc{font-size:13px}
body.layout-v2 #toc li{margin:0;line-height:1.45}
body.layout-v2 #toc li a{
display:block;padding:5px 0 5px 11px;
border-left:2px solid var(--lv2-line);
color:var(--lv2-faint);font-size:13px;
transition:color .15s,border-color .15s;
}
body.layout-v2 #toc li a:hover{color:var(--lv2-ink)}
body.layout-v2 #toc li a.toc-active{
border-left-color:var(--lv2-navy);color:var(--lv2-ink);font-weight:600;
}
/* Reading progress bar - uses transform:scaleX so we don't fight any
containing-block / overflow quirks that can pin a width-% bar to 0. */
.lv2-progress{
position:fixed;top:0;left:0;width:100vw;height:3px;
background:var(--lv2-accent,#2056d2);z-index:90;
transform:scaleX(0);transform-origin:left center;
transition:transform .1s ease-out;pointer-events:none;
}
/* Heading anchor links (hover-reveal) */
body.layout-v2 #content h2,
body.layout-v2 #content h3,
body.layout-v2 #content h4{position:relative}
body.layout-v2 .lv2-anchor{
position:absolute;left:-26px;top:50%;transform:translateY(-50%);
font-size:.55em;color:var(--lv2-faint);text-decoration:none;
opacity:0;transition:opacity .15s,color .15s;
cursor:pointer;padding:4px 6px;line-height:1;font-weight:400;
}
body.layout-v2 #content h2:hover .lv2-anchor,
body.layout-v2 #content h3:hover .lv2-anchor,
body.layout-v2 #content h4:hover .lv2-anchor,
body.layout-v2 .lv2-anchor:focus-visible{opacity:1}
body.layout-v2 .lv2-anchor:hover{color:var(--lv2-accent)}
@media(max-width:820px){body.layout-v2 .lv2-anchor{left:0;top:-22px;transform:none}}
/* Focus ring refresh */
body.layout-v2 a:focus-visible,
body.layout-v2 button:focus-visible,
body.layout-v2 input:focus-visible,
body.layout-v2 textarea:focus-visible{
outline:none;
box-shadow:0 0 0 3px rgba(32,86,210,.22);
border-radius:4px;
}
html.dark body.layout-v2 a:focus-visible,
html.dark body.layout-v2 button:focus-visible,
html.dark body.layout-v2 input:focus-visible{box-shadow:0 0 0 3px rgba(127,170,255,.22)}
/* Reduced motion: shut everything down for users who request it */
@media (prefers-reduced-motion: reduce){
body.layout-v2 *,body.layout-v2 *::before,body.layout-v2 *::after{
animation-duration:0.01ms!important;
animation-iteration-count:1!important;
transition-duration:0.01ms!important;
scroll-behavior:auto!important;
}
}
</style>
<!-- Full Bootstrap deferred (non-render-blocking) -->
<link href="www/bootstrap.min.css?h=dae0a568" rel="stylesheet" media="print" onload="this.media='all'">
<noscript><link href="www/bootstrap.min.css?h=dae0a568" rel="stylesheet"></noscript>
<!-- Roadmap-jel: load code-highlight CSS normally (not deferred) so code blocks paint COLORED on first load, not after interaction. Small file; negligible render cost. -->
<link href="www/highlight.min.css?h=f103014a" rel="stylesheet">
<link href="css/main.min.css?h=ba504769" rel="stylesheet" media="print" onload="this.media='all'">
<noscript><link href="css/main.min.css?h=ba504769" rel="stylesheet"></noscript>
<!-- Sitewide navbar (canonical roadmap .nav design). Loaded sync: the nav
is above the fold and must never flash unstyled. -->
<link href="/www/site-nav.css?v=1" rel="stylesheet">
<style>
a{color:#1d3158}a:hover{text-decoration:underline}
li{line-height:1.65}
.MathJax_Display{margin:0}
blockquote p{line-height:1.75;color:#717171}
/* engagement.js renders a meta strip into .engagement-header that
duplicates the byline (difficulty + time). Hide it; saved-posts-
button.js reads the data-* attrs directly for the byline. */
.engagement-header{display:none!important}
/* Byline (saved-posts widget rebuilds this after H1+lead, mock-style) */
.byline{display:flex;flex-wrap:wrap;align-items:center;gap:8px;
font-size:13.5px;color:#4b5260;margin:6px 0 16px;line-height:1.5}
/* P1 — bump avatar 26→30 to match mock visual weight. */
.byline .av-sm{width:30px;height:30px;border-radius:50%;
background:linear-gradient(135deg,#1c2c4f,#2d4173);color:#fff;
display:inline-flex;align-items:center;justify-content:center;
font-weight:700;font-size:12px;flex:none;letter-spacing:.02em}
.byline .who{color:#0d1117;font-weight:600}
.byline .dot{color:#c0c5cf}
.byline .rev{color:#137a3e;font-weight:600;display:inline-flex;align-items:center;gap:4px}
.byline .time{display:inline-flex;align-items:center;gap:4px;color:#6b7280}
.byline .diff{font-size:10.5px;font-weight:700;text-transform:uppercase;
letter-spacing:.05em;background:#eef1f7;color:#4b5260;
padding:3px 8px;border-radius:999px;margin-left:2px}
/* Action bar (saved-posts widget injects this after byline) */
.actionbar{display:flex;align-items:center;gap:9px;margin:10px 0 26px;padding:12px 0;
border-top:1px solid #e4e7ee;border-bottom:1px solid #e4e7ee;flex-wrap:wrap}
.actionbar .act{display:inline-flex;align-items:center;gap:6px;border:1px solid #d4d9e3;
background:#fff;border-radius:9px;padding:7px 12px;font-size:13px;font-weight:600;
color:#4b5260;cursor:pointer;font-family:inherit;
transition:border-color .15s,color .15s,background .15s}
.actionbar .act:hover{border-color:#0a0d14;color:#0a0d14}
.actionbar .act.bookmark-btn[data-saved="1"]{background:#fef3c7;border-color:#f59e0b;color:#92400e}
.actionbar .act.bookmark-btn[data-saved="1"] svg{fill:#f59e0b}
.actionbar .act:disabled{opacity:.55;cursor:wait}
.actionbar-sync{margin-left:auto;font-size:12px;color:#6b7280}
.actionbar-sync a{color:#2056d2;font-weight:600;text-decoration:none}
.actionbar-sync a:hover{text-decoration:underline}
/* Dark-mode overrides for byline + actionbar. The hard-coded #0d1117
on .who renders invisible on the dark background; the action-bar
borders and surfaces also need to flip. Tokens (--lv2-ink, --lv2-mut,
--lv2-line, --lv2-card) already swap under html.dark body.layout-v2;
we just need to point the hard-coded rules at them under dark. */
html.dark body.layout-v2 .byline{color:var(--lv2-mut)}
html.dark body.layout-v2 .byline .who{color:var(--lv2-ink)}
html.dark body.layout-v2 .byline .dot{color:var(--lv2-faint)}
html.dark body.layout-v2 .byline .time{color:var(--lv2-mut)}
html.dark body.layout-v2 .byline .diff{background:var(--lv2-navy-soft);color:var(--lv2-mut)}
html.dark body.layout-v2 .actionbar{border-top-color:var(--lv2-line);border-bottom-color:var(--lv2-line)}
html.dark body.layout-v2 .actionbar .act{background:var(--lv2-card);border-color:var(--lv2-border);color:var(--lv2-mut)}
html.dark body.layout-v2 .actionbar .act:hover{border-color:var(--lv2-ink);color:var(--lv2-ink)}
html.dark body.layout-v2 .actionbar-sync{color:var(--lv2-mut)}
/* Toast (Share button "Link copied" feedback) */
.rs-toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(8px);
background:#0a0d14;color:#fff;padding:9px 18px;border-radius:8px;font-size:13px;
font-family:'IBM Plex Sans',sans-serif;z-index:1000;opacity:0;pointer-events:none;
transition:opacity .2s,transform .2s;box-shadow:0 8px 24px rgba(10,13,20,.25)}
.rs-toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
/* Auth-state visibility helpers (used by masthead variants) */
.auth-anon,.auth-user{display:none}
body.state-anon .auth-anon{display:inline-flex;align-items:center}
body.state-pro .auth-user{display:inline-flex;align-items:center;gap:8px}
.auth-signout.masthead-icon-btn{background:none;border:1px solid #d8dce2;border-radius:6px;padding:4px 9px;font-size:14px;line-height:1;color:#4a5160;cursor:pointer;transition:border-color .15s,color .15s}
.auth-signout.masthead-icon-btn:hover{border-color:#9a1f1f;color:#9a1f1f}
html.dark .auth-signout.masthead-icon-btn{border-color:#262a31;color:#c3cad9}
html.dark .auth-signout.masthead-icon-btn:hover{border-color:#f08989;color:#f08989}
@media(min-width:1200px){.container{width:1170px}}
#nav,#content,#toc-sidebar{box-sizing:border-box}
#content{padding-left:15px;padding-right:15px;overflow-wrap:break-word;word-wrap:break-word;overflow-x:clip}
@media(max-width:767px){#nav{display:none}}
.mobile-sidebar-overlay{display:none;position:fixed;top:0;left:0;right:0;bottom:0;z-index:9999;background:rgba(0,0,0,0.4)}
.mobile-sidebar-overlay.open{display:block}
.mobile-sidebar-panel{position:fixed;top:0;left:0;bottom:0;width:280px;background:#fff;z-index:10000;overflow-y:auto;padding:16px;box-shadow:2px 0 16px rgba(0,0,0,0.15);transform:translateX(-100%);transition:transform 0.25s ease}
.mobile-sidebar-overlay.open .mobile-sidebar-panel{transform:translateX(0)}
.mobile-sidebar-close{position:absolute;top:10px;right:12px;background:none;border:none;font-size:22px;cursor:pointer;color:#666}
/* Mobile top-nav drawer section */
.mnav-section{margin-bottom:18px;padding-bottom:14px;border-bottom:1px solid #e5e7eb}
.mnav-section:last-child{border-bottom:none}
.mnav-title{font-family:'IBM Plex Sans',sans-serif;font-size:11px;font-weight:600;color:#8a8f99;text-transform:uppercase;letter-spacing:0.06em;margin:0 0 8px}
.mnav-link{display:block;padding:9px 10px;color:#3a3f4a;text-decoration:none;font-size:15px;border-radius:6px;font-family:'IBM Plex Sans',sans-serif}
.mnav-link:hover,.mnav-link:active{background:#f1f3f6;color:#0d1117;text-decoration:none}
.mnav-accordion{padding:0}
.mnav-accordion>summary{padding:9px 10px;cursor:pointer;font-size:15px;font-weight:500;color:#3a3f4a;list-style:none;border-radius:6px;font-family:'IBM Plex Sans',sans-serif;display:flex;align-items:center;justify-content:space-between}
.mnav-accordion>summary::-webkit-details-marker{display:none}
.mnav-accordion>summary::after{content:'\25BE';font-size:11px;color:#8a8f99;transition:transform 0.15s}
.mnav-accordion[open]>summary::after{transform:rotate(180deg)}
.mnav-accordion>summary:hover{background:#f1f3f6}
.mnav-accordion-body{padding:4px 6px 8px 10px}
.mnav-accordion-body .mnav-link{padding:7px 8px;font-size:14px;color:#4a5160}
.mnav-accordion-body h6{margin:10px 0 4px 8px;font-family:'IBM Plex Sans',sans-serif;font-size:10px;font-weight:600;color:#8a8f99;text-transform:uppercase;letter-spacing:0.06em}
html.dark .mobile-sidebar-panel{background:#1e293b}
html.dark .mobile-sidebar-overlay{background:rgba(0,0,0,0.6)}
html.dark .mobile-sidebar-close{color:#94a3b8}
html.dark .mnav-section{border-bottom-color:#334155}
html.dark .mnav-title{color:#7a808c}
html.dark .mnav-link,html.dark .mnav-accordion>summary{color:#c5cad3}
html.dark .mnav-link:hover,html.dark .mnav-link:active,html.dark .mnav-accordion>summary:hover{background:#1a1d22;color:#fff}
html.dark .mnav-accordion-body .mnav-link{color:#b0b5bf}
html.dark .mnav-accordion-body h6{color:#7a808c}
/* ============================================================
ROADMAP-JEL (Stage 1) - re-skin tutorial pages to match /roadmap/.
Additive + reversible: delete this block + the Inter <link> to
restore the IBM Plex look. Scoped to body.layout-v2.
============================================================ */
body.layout-v2{
--lv2-bg:#ffffff;--lv2-card:#ffffff;--lv2-ink:#14161b;--lv2-mut:#4d525b;--lv2-faint:#888e97;
--lv2-navy:#14161b;--lv2-navy-h:#2f333c;--lv2-navy-soft:#f2f2ee;
--lv2-accent:#2563a8;--lv2-accent-soft:#eaf1f8;
--lv2-line:#e9e9e4;--lv2-border:#e0e0da;--lv2-green:#1f7a55;
background:#ffffff;
}
/* type system -> Inter / Inter Tight / JetBrains Mono (matches roadmap) */
body.layout-v2,
body.layout-v2 #content{font-family:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif!important}
body.layout-v2 #content h1,body.layout-v2 #content h2,
body.layout-v2 #content h3,body.layout-v2 #content h4{
font-family:'Inter Tight','Inter',sans-serif!important;letter-spacing:-.022em;color:var(--lv2-ink);
}
body.layout-v2 #content h1{letter-spacing:-.03em}
body.layout-v2 #content :not(pre)>code,
body.layout-v2 #content pre,
body.layout-v2 #content pre code{font-family:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace}
/* Exercises mega-menu (xn-*) typography jel is handled at its source in
www/practice-nav.css (Inter / Inter Tight / JetBrains Mono). */
/* remove the faint divider lines (left sidebar + right TOC) */
body.layout-v2 #nav.col-sm-3{border-right:none!important}
#toc-wrapper{border-left:none!important}
/* drop the right-hand TOC on tutorial pages; widen + cap the reading column */
body.layout-v2 .row{grid-template-columns:clamp(210px,18vw,280px) minmax(0,1fr)!important}
body.layout-v2 #toc-sidebar{display:none!important}
/* tighter, roadmap-like container so the content isn't right-heavy */
body.layout-v2 .container{max-width:1200px}
body.layout-v2 #content{max-width:760px;margin:0 auto;padding:30px 44px 96px}
/* ---- reading typography v2 (premium long-form: measure, size, rhythm) ---- */
body.layout-v2 #content{font-size:17.5px;line-height:1.75;font-feature-settings:"kern","liga","calt";color:#20242c}
body.layout-v2 #content p{margin:0 0 1.35em;color:#20242c;text-wrap:pretty}
body.layout-v2 #content h1{font-size:2.55rem;line-height:1.12;margin:6px 0 .4em;letter-spacing:-.032em}
body.layout-v2 #content h2{font-size:1.62rem;line-height:1.24;margin:2.7em 0 .55em;padding-top:0;border-top:none;letter-spacing:-.022em}
body.layout-v2 #content h2:first-of-type{margin-top:1.3em}
body.layout-v2 #content h3,body.layout-v2 #content h4{font-size:1.2rem;line-height:1.35;margin:2em 0 .5em}
body.layout-v2 #content p.lead{font-size:1.3rem;line-height:1.52;color:#565c66;border-left:none;padding-left:0;margin:2px 0 1.5em;font-weight:400}
body.layout-v2 #content ul,body.layout-v2 #content ol{margin:0 0 1.35em;padding-left:1.35em}
body.layout-v2 #content li{margin:.42em 0;line-height:1.72;color:#20242c}
body.layout-v2 #content blockquote{border-left:3px solid #dcdfe4;padding:4px 0 4px 20px;margin:1.7em 0;color:#4d525b;font-style:normal}
body.layout-v2 #content blockquote p{color:#4d525b}
body.layout-v2 #content a:not(.btn){text-underline-offset:2px}
body.layout-v2 #content hr{border-top-color:#e9e9e4;margin:2.4em 0}
/* wide tables scroll inside the column instead of forcing horizontal overflow (esp. mobile) */
body.layout-v2 #content table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
/* ---- sidebar: pythoncompiler-style progress rail, on white ---- */
body.layout-v2 #nav,body.layout-v2 #sidebar-nav{font-family:'Inter',system-ui,sans-serif}
body.layout-v2 .sidebar-section-header{display:flex;align-items:center;gap:7px;padding:9px 8px;border-radius:8px;font-weight:600;font-size:14px;color:#14161b}
body.layout-v2 .sidebar-section-header:hover{background:#f4f4f0}
body.layout-v2 .sidebar-chevron{font-size:9px;color:#9aa1b0;margin:0;transition:transform .15s}
body.layout-v2 .sidebar-section.expanded .sidebar-chevron{transform:rotate(90deg)}
body.layout-v2 .sec-num{color:#9aa1b0;font-weight:600;font-variant-numeric:tabular-nums}
body.layout-v2 .sec-title-t{flex:1}
body.layout-v2 .section-meta{font-size:11px;font-weight:600;color:#888e97;background:#f2f2ee;border-radius:20px;padding:2px 8px;font-variant-numeric:tabular-nums}
body.layout-v2 .section-meta:empty{display:none}
body.layout-v2 .sidebar-section-items > li > a{display:flex;align-items:center;gap:11px;padding:6px 12px 6px 40px;font-size:13.5px;line-height:1.35;color:#4d525b;border-radius:0 8px 8px 0;text-decoration:none}
body.layout-v2 .sidebar-section-items > li > a:hover{background:#f4f4f0;color:#14161b}
/* node ring: always-visible hollow ring; green fill + check once opened/read */
/* ---- minimal progress nodes (thin, flat, quiet) ---- */
body.layout-v2 .sidebar-section-items .progress-dot{visibility:visible!important;width:12px;height:12px;min-width:12px;border:1.5px solid #cdd3dd;border-radius:50%;background:#fff;position:relative;z-index:1;margin:0;transition:border-color .15s}
body.layout-v2 .sidebar-section-items > li > a:hover .progress-dot{border-color:#9aa2b2}
body.layout-v2 .sidebar-section-items .progress-dot.visited,
body.layout-v2 .sidebar-section-items .progress-dot.started{border-color:#33ab70;background:#fff}
body.layout-v2 .sidebar-section-items .progress-dot.visited::after,
body.layout-v2 .sidebar-section-items .progress-dot.started::after{content:"";position:absolute;left:3.2px;top:1.4px;width:2.8px;height:5.6px;border:solid #178a4e;border-width:0 1.4px 1.4px 0;transform:rotate(45deg)}
/* ---- minimal rail (thin hairline) ---- */
body.layout-v2 .sidebar-section-items > li:not(.sidebar-divider){position:relative}
body.layout-v2 .sidebar-section-items > li:not(.sidebar-divider)::before{content:"";position:absolute;left:46.85px;top:0;bottom:0;width:1.5px;background:#e4e7ee;z-index:0}
body.layout-v2 .sidebar-divider + li:not(.sidebar-divider)::before,
body.layout-v2 .sidebar-section-items > li:not(.sidebar-divider):first-child::before{top:calc(50% - 1px)}
body.layout-v2 .sidebar-section-items > li:not(.sidebar-divider):has(+ .sidebar-divider)::before,
body.layout-v2 .sidebar-section-items > li:not(.sidebar-divider):last-child::before{bottom:calc(50% - 1px)}
body.layout-v2 .sidebar-section-items > li:not(.sidebar-divider):has(.progress-dot.visited)::before,
body.layout-v2 .sidebar-section-items > li:not(.sidebar-divider):has(.progress-dot.started)::before{background:#a9d6bf}
/* current-page row + node: quiet accent, no glow/pulse */
body.layout-v2 .sidebar-section-items > li > a.active{background:#eef3fb;color:#14161b;font-weight:600}
body.layout-v2 .sidebar-section-items > li > a.active .progress-dot{border-color:#2563a8;background:#fff}
body.layout-v2 .sidebar-section-items > li > a.active .progress-dot::after{content:"";position:absolute;inset:3px;border-radius:50%;background:#2563a8;border:0;transform:none}
body.layout-v2 .sidebar-section-items > li > a.active .progress-dot.visited,
body.layout-v2 .sidebar-section-items > li > a.active .progress-dot.started{border-color:#33ab70}
body.layout-v2 .sidebar-section-items > li > a.active .progress-dot.visited::after,
body.layout-v2 .sidebar-section-items > li > a.active .progress-dot.started::after{inset:auto;left:3.2px;top:1.4px;width:2.8px;height:5.6px;border:solid #178a4e;border-width:0 1.4px 1.4px 0;border-radius:0;background:none;transform:rotate(45deg)}
/* section-end quiz row: single gold badge + gold 'Quiz' label */
/* kill the legacy graduation-cap emoji ::before (the 'hat') so the row is
one badge + Quiz, and the marker/text align with the lesson rows */
body.layout-v2 .sidebar-section-items > li.is-quiz > a::before{content:none!important;display:none!important}
body.layout-v2 .sidebar-section-items > li.is-quiz > a{color:#9a7320;font-weight:600}
body.layout-v2 .sidebar-section-items > li.is-quiz > a:hover{color:#7d5d16;background:#f7f2e6}
body.layout-v2 .quiz-marker{display:inline-flex;width:12px;min-width:12px;height:12px;align-items:center;justify-content:center;color:#c8a13a;background:#fff;border-radius:50%;position:relative;z-index:1}
body.layout-v2 .quiz-marker svg{width:13px;height:13px}
/* sub-section dividers */
body.layout-v2 .sidebar-divider{position:relative;font-size:10.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:#9aa1b0;padding:14px 10px 5px 40px;border-bottom:none;cursor:pointer}
body.layout-v2 .sidebar-divider:hover{color:#6b7280}
/* expand/collapse caret so a collapsed sub-group doesn't look empty.
toc.js swaps the glyph (down = open, right = collapsed) + toggles the items. */
body.layout-v2 .subsec-chevron{display:inline-block;position:absolute;left:25px;top:15px;font-size:8px;color:#aab0bd;line-height:1;pointer-events:none}
/* tab strip (Posts/Tools) -> Inter + roadmap ink */
body.layout-v2 .sidebar-tab{font-family:'Inter',sans-serif;color:#888e97}
body.layout-v2 .sidebar-tab.active{color:#14161b;border-bottom-color:#14161b}
@media(max-width:820px){
body.layout-v2 .row{grid-template-columns:1fr!important}
body.layout-v2 #content{padding:22px 18px 72px;max-width:100%}
body.layout-v2 #content{font-size:17px}
body.layout-v2 #content h1{font-size:2rem}
}
/* mobile masthead: drop the dark toggle on small screens + the wordmark
text on tiny ones so Get-certified + Sign-in never clip off the edge */
@media(max-width:600px){body.layout-v2 #dark-mode-toggle{display:none}}
</style>
<!-- Open Graph -->
<meta property="og:title" content="Bootstrap in R: The boot Package, Step by Step">
<meta property="og:description" content="Bootstrap in R with the boot package: confidence intervals and hypothesis tests without distributional assumptions. Runnable BCa, percentile, basic examples.">
<meta property="og:type" content="article">
<meta property="og:url" content="https://r-statistics.co/Bootstrap-in-R.html">
<meta property="og:site_name" content="r-statistics.co">
<meta property="og:image" content="https://r-statistics.co/screenshots/og/Bootstrap-in-R.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Bootstrap in R: The boot Package, Step by Step">
<meta name="twitter:description" content="Bootstrap in R with the boot package: confidence intervals and hypothesis tests without distributional assumptions. Runnable BCa, percentile, basic examples.">
<meta name="twitter:image" content="https://r-statistics.co/screenshots/og/Bootstrap-in-R.png">
<!-- JSON-LD Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": ["TechArticle", "LearningResource"],
"headline": "Bootstrap in R: The boot Package, Step by Step",
"description": "Bootstrap in R with the boot package: confidence intervals and hypothesis tests without distributional assumptions. Runnable BCa, percentile, basic examples.",
"author": {"@type": "Person", "name": "Selva Prabhakaran", "url": "https://r-statistics.co/about/", "jobTitle": "Data Scientist"},
"publisher": {"@type": "Organization", "name": "r-statistics.co", "url": "https://r-statistics.co/", "logo": {"@type": "ImageObject", "url": "https://r-statistics.co/screenshots/og-default.png"}},
"url": "https://r-statistics.co/Bootstrap-in-R.html",
"datePublished": "2026-07-09",
"dateModified": "2026-07-09",
"inLanguage": "en",
"educationalLevel": "Intermediate",
"programmingLanguage": "R",
"speakable": {"@type": "SpeakableSpecification", "cssSelector": [".lead", "#content h1"]}
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{"@type": "ListItem", "position": 1, "name": "Home", "item": "https://r-statistics.co/"},
{"@type": "ListItem", "position": 2, "name": "Statistics", "item": "https://r-statistics.co/"},
{"@type": "ListItem", "position": 3, "name": "Bootstrap in R: The boot Package, Step by Step", "item": "https://r-statistics.co/Bootstrap-in-R.html"}
]
}
</script>
<link rel="stylesheet" href="www/webr.min.css?h=4dfeabf6">
<link rel="stylesheet" href="www/engagement.min.css?h=6cdbfd3e" media="print" onload="this.media='all'">
<noscript><link rel="stylesheet" href="www/engagement.min.css?h=6cdbfd3e"></noscript>
</head>
<body>
<script>try{if(localStorage.getItem('rsc-tools-rail')==='1')document.body.classList.add('tools-rail')}catch(e){}</script>
<!-- LAYOUT V2 (default for all tutorial pages as of 2026-05-29).
Was previously opt-in via a V2_PAGES whitelist; reference work on
/R-Vectors validated the design, so it now applies unconditionally
to every page served from this template.
To opt a specific page OUT (e.g. landing/marketing pages that need
the legacy look), add `data-no-lv2` to its <body> or set
window.__noLv2 = true in an inline script before this block. -->
<script>
(function(){
if (window.__noLv2 || document.body.hasAttribute('data-no-lv2')) return;
document.body.classList.add('layout-v2');
})();
</script>
<!-- Mobile sidebar overlay -->
<div class="mobile-sidebar-overlay" id="mobile-sidebar">
<div class="mobile-sidebar-panel">
<button class="mobile-sidebar-close" id="mobile-sidebar-close">×</button>
<!-- Top nav (mobile only) -->
<div class="mnav-section">
<h6 class="mnav-title">Navigate</h6>
<a class="mnav-link" href="/roadmap/">Roadmap</a>
<a class="mnav-link" href="/tutorials/">Tutorials</a>
<a class="mnav-link" href="/exercises/">Exercises</a>
<a class="mnav-link" href="/tools/">Tools</a>
<a class="mnav-link mnav-cta" href="/pricing.html">Get certified</a>
</div>
<div id="mobile-sidebar-content">
<!-- Populated by toc.js (curriculum nav) -->
</div>
</div>
</div>
<div class="container">
<nav class="sitenav" aria-label="Site">
<div class="snav-wrap">
<button id="mobile-menu-btn" class="snav-burger" type="button" aria-label="Menu"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg></button>
<a class="snav-brand" href="/"><span class="brand-mark">R</span><span>r‑statistics<span class="co">.co</span></span></a>
<div class="snav-links">
<a href="/roadmap/">Roadmap</a>
<a href="/tutorials/">Tutorials</a>
<a href="/exercises/">Exercises <span class="ex-caret" aria-hidden="true">▾</span></a>
<a href="/tools/">Tools</a>
</div>
<div class="snav-right">
<a class="snav-btn" href="/pricing.html">Get certified <span class="a">→</span></a>
<span class="auth-anon"><a href="/signin.html" class="masthead-auth-link">Sign in</a></span>
<span class="auth-user"><!-- auth-hydrate.js fills with avatar + dropdown --></span>
</div>
</div>
</nav>
<div class="row">
<div class="col-xs-12 col-sm-3" id="nav">
<div id="sidebar-nav"><div class="continue-chip" data-continue-chip><span class="chip-label">Continue reading</span><a href="#" data-continue-link></a></div><button class="rail-fold" type="button" title="Collapse sidebar to icons" aria-label="Collapse sidebar to icons" onclick="var r=document.body.classList.toggle('tools-rail');try{localStorage.setItem('rsc-tools-rail',r?'1':'0')}catch(e){}"><span class="rf-a">« Collapse</span><span class="rf-b">»</span></button><div class="sidebar-tabs" role="tablist"><button class="sidebar-tab active" data-tab="posts" type="button" role="tab" onclick="var n=this.dataset.tab;document.querySelectorAll('.sidebar-tab').forEach(function(x){x.classList.toggle('active',x.dataset.tab===n)});document.querySelectorAll('.sidebar-panel').forEach(function(p){p.classList.toggle('active',p.dataset.panel===n)});try{localStorage.setItem('rstat_sidebar_tab',n)}catch(e){}">Posts</button><button class="sidebar-tab" data-tab="tools" type="button" role="tab" onclick="var n=this.dataset.tab;document.querySelectorAll('.sidebar-tab').forEach(function(x){x.classList.toggle('active',x.dataset.tab===n)});document.querySelectorAll('.sidebar-panel').forEach(function(p){p.classList.toggle('active',p.dataset.panel===n)});try{localStorage.setItem('rstat_sidebar_tab',n)}catch(e){}">Tools</button></div><div class="sidebar-panel active" data-panel="posts"><ul class="sidebar-menu list-unstyled"><li class="sidebar-section expanded"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">1.</span> <span class="sec-title-t">Learn R</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec0sub1" data-collapsed="false"><span class="subsec-chevron">▼</span> Getting Started</li><li data-subkey="sec0sub1"><a href="/Is-R-Worth-Learning-in-2026.html" title="Is R Worth Learning?"><span class="progress-dot"></span>Is R Worth Learning?</a></li><li data-subkey="sec0sub1"><a href="/Install-R-and-RStudio-2026.html" title="Install R & RStudio"><span class="progress-dot"></span>Install R & RStudio</a></li><li data-subkey="sec0sub1"><a href="/RStudio-IDE-Tour.html" title="RStudio IDE Tour"><span class="progress-dot"></span>RStudio IDE Tour</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec0sub2" data-collapsed="false"><span class="subsec-chevron">▼</span> R Fundamentals</li><li data-subkey="sec0sub2"><a href="/R-Syntax-101.html" title="R Syntax 101"><span class="progress-dot"></span>R Syntax 101</a></li><li data-subkey="sec0sub2"><a href="/R-Data-Types.html" title="R Data Types"><span class="progress-dot"></span>R Data Types</a></li><li data-subkey="sec0sub2"><a href="/R-Vectors.html" title="R Vectors"><span class="progress-dot"></span>R Vectors</a></li><li data-subkey="sec0sub2"><a href="/R-Matrices.html" title="R Matrices"><span class="progress-dot"></span>R Matrices</a></li><li data-subkey="sec0sub2"><a href="/R-Factors.html" title="R Factors"><span class="progress-dot"></span>R Factors</a></li><li data-subkey="sec0sub2"><a href="/R-Data-Frames.html" title="R Data Frames"><span class="progress-dot"></span>R Data Frames</a></li><li data-subkey="sec0sub2"><a href="/R-Lists.html" title="R Lists"><span class="progress-dot"></span>R Lists</a></li><li data-subkey="sec0sub2"><a href="/R-Control-Flow.html" title="R Control Flow"><span class="progress-dot"></span>R Control Flow</a></li><li data-subkey="sec0sub2"><a href="/R-Special-Values.html" title="R Special Values"><span class="progress-dot"></span>R Special Values</a></li><li data-subkey="sec0sub2"><a href="/R-Type-Coercion.html" title="R Type Coercion"><span class="progress-dot"></span>R Type Coercion</a></li><li data-subkey="sec0sub2"><a href="/R-Functions.html" title="Writing R Functions"><span class="progress-dot"></span>Writing R Functions</a></li><li data-subkey="sec0sub2" class="is-quiz"><a href="/R-Beginner-Exercises-quiz.html" title="R Fundamentals Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec0sub3" data-collapsed="false"><span class="subsec-chevron">▼</span> Working Effectively</li><li data-subkey="sec0sub3"><a href="/R-Subsetting.html" title="R Subsetting"><span class="progress-dot"></span>R Subsetting</a></li><li data-subkey="sec0sub3"><a href="/Getting-Help-in-R.html" title="Getting Help in R"><span class="progress-dot"></span>Getting Help in R</a></li><li data-subkey="sec0sub3"><a href="/R-Project-Structure.html" title="R Project Structure"><span class="progress-dot"></span>R Project Structure</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec0sub4" data-collapsed="false"><span class="subsec-chevron">▼</span> R Career & Resources</li><li data-subkey="sec0sub4"><a href="/R-vs-Python.html" title="R vs Python"><span class="progress-dot"></span>R vs Python</a></li><li data-subkey="sec0sub4"><a href="/How-to-Learn-R.html" title="How to Learn R"><span class="progress-dot"></span>How to Learn R</a></li><li data-subkey="sec0sub4"><a href="/R-for-Excel-Users.html" title="R for Excel Users"><span class="progress-dot"></span>R for Excel Users</a></li><li data-subkey="sec0sub4"><a href="/R-Interview-Questions.html" title="R Interview Questions"><span class="progress-dot"></span>R Interview Questions</a></li><li data-subkey="sec0sub4" class="is-quiz"><a href="/R-Interview-Questions-quiz.html" title="R Interview Readiness Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec0sub4"><a href="/R-Cheat-Sheet.html" title="R Cheat Sheet"><span class="progress-dot"></span>R Cheat Sheet</a></li></ul></li><li class="sidebar-section expanded"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">2.</span> <span class="sec-title-t">Data Wrangling</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec1sub1" data-collapsed="false"><span class="subsec-chevron">▼</span> Import & Setup</li><li data-subkey="sec1sub1"><a href="/Importing-Data-in-R.html" title="Importing Data"><span class="progress-dot"></span>Importing Data</a></li><li data-subkey="sec1sub1"><a href="/R-Pipe-Operator.html" title="Pipe Operator"><span class="progress-dot"></span>Pipe Operator</a></li><li data-subkey="sec1sub1"><a href="/Tidy-Data-in-R.html" title="Tidy Data"><span class="progress-dot"></span>Tidy Data</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec1sub2" data-collapsed="false"><span class="subsec-chevron">▼</span> dplyr Essentials</li><li data-subkey="sec1sub2"><a href="/dplyr-filter-select.html" title="dplyr filter & select"><span class="progress-dot"></span>dplyr filter & select</a></li><li data-subkey="sec1sub2"><a href="/dplyr-mutate-rename.html" title="dplyr mutate & rename"><span class="progress-dot"></span>dplyr mutate & rename</a></li><li data-subkey="sec1sub2"><a href="/dplyr-group-by-summarise.html" title="dplyr group_by & summarise"><span class="progress-dot"></span>dplyr group_by & summarise</a></li><li data-subkey="sec1sub2"><a href="/dplyr-arrange-slice.html" title="dplyr arrange & slice"><span class="progress-dot"></span>dplyr arrange & slice</a></li><li data-subkey="sec1sub2"><a href="/dplyr-across.html" title="dplyr across()"><span class="progress-dot"></span>dplyr across()</a></li><li data-subkey="sec1sub2"><a href="/dplyr-case-when.html" title="dplyr case_when()"><span class="progress-dot"></span>dplyr case_when()</a></li><li data-subkey="sec1sub2" class="is-quiz"><a href="/dplyr-Exercises-in-R-quiz.html" title="dplyr Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec1sub3" data-collapsed="false"><span class="subsec-chevron">▼</span> Join & Reshape</li><li data-subkey="sec1sub3"><a href="/R-Joins.html" title="R Joins"><span class="progress-dot"></span>R Joins</a></li><li data-subkey="sec1sub3"><a href="/pivot_longer-pivot_wider-Reshape-Data-in-R.html" title="pivot_longer & pivot_wider"><span class="progress-dot"></span>pivot_longer & pivot_wider</a></li><li data-subkey="sec1sub3"><a href="/tidyr-separate-unite-Split-Combine-Columns-in-R.html" title="separate() & unite()"><span class="progress-dot"></span>separate() & unite()</a></li><li data-subkey="sec1sub3" class="is-quiz"><a href="/tidyr-Exercises-in-R-quiz.html" title="tidyr Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec1sub4" data-collapsed="false"><span class="subsec-chevron">▼</span> Clean & Quality</li><li data-subkey="sec1sub4"><a href="/Missing-Values-in-R-Detect-Count-Remove-Impute-NA.html" title="Missing Values (NA)"><span class="progress-dot"></span>Missing Values (NA)</a></li><li data-subkey="sec1sub4"><a href="/Data-Quality-Checking-in-R.html" title="Data Quality Checking"><span class="progress-dot"></span>Data Quality Checking</a></li><li data-subkey="sec1sub4"><a href="/janitor-Package-in-R.html" title="janitor Package"><span class="progress-dot"></span>janitor Package</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec1sub5" data-collapsed="false"><span class="subsec-chevron">▼</span> Strings & Dates</li><li data-subkey="sec1sub5"><a href="/stringr-in-R.html" title="stringr"><span class="progress-dot"></span>stringr</a></li><li data-subkey="sec1sub5"><a href="/R-Regex-stringr-Pattern-Matching.html" title="Regex Patterns"><span class="progress-dot"></span>Regex Patterns</a></li><li data-subkey="sec1sub5"><a href="/lubridate-in-R.html" title="lubridate"><span class="progress-dot"></span>lubridate</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec1sub6" data-collapsed="false"><span class="subsec-chevron">▼</span> Scale & Connect</li><li data-subkey="sec1sub6"><a href="/DBI-in-R.html" title="DBI & Databases"><span class="progress-dot"></span>DBI & Databases</a></li><li data-subkey="sec1sub6"><a href="/DuckDB-in-R.html" title="DuckDB & duckplyr"><span class="progress-dot"></span>DuckDB & duckplyr</a></li><li data-subkey="sec1sub6"><a href="/Web-Scraping-in-R-with-rvest.html" title="Web Scraping (rvest)"><span class="progress-dot"></span>Web Scraping (rvest)</a></li><li data-subkey="sec1sub6"><a href="/REST-APIs-in-R-with-httr2.html" title="REST APIs (httr2)"><span class="progress-dot"></span>REST APIs (httr2)</a></li><li data-subkey="sec1sub6"><a href="/Data-Wrangling-dplyr-Course.html" title="Data Wrangling with dplyr (Course)"><span class="progress-dot"></span>Data Wrangling with dplyr (Course)</a></li><li data-subkey="sec1sub6"><a href="/Join-Reshape-Course.html" title="Join & Reshape (Course)"><span class="progress-dot"></span>Join & Reshape (Course)</a></li><li data-subkey="sec1sub6"><a href="/data-table-Course.html" title="data.table (Course)"><span class="progress-dot"></span>data.table (Course)</a></li><li data-subkey="sec1sub6"><a href="/Report-Tables-Course.html" title="Report-Ready Tables (Course)"><span class="progress-dot"></span>Report-Ready Tables (Course)</a></li><li data-subkey="sec1sub6"><a href="/Communicate-Automate-Course.html" title="Communicate & Automate (Course)"><span class="progress-dot"></span>Communicate & Automate (Course)</a></li></ul></li><li class="sidebar-section expanded"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">3.</span> <span class="sec-title-t">Statistics</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub1" data-collapsed="false"><span class="subsec-chevron">▼</span> EDA & Data Quality</li><li data-subkey="sec2sub1"><a href="/Automated-EDA-in-R.html" title="Automated EDA"><span class="progress-dot"></span>Automated EDA</a></li><li data-subkey="sec2sub1"><a href="/Missing-Data-Visualization-in-R-naniar.html" title="Missing Data Viz (naniar)"><span class="progress-dot"></span>Missing Data Viz (naniar)</a></li><li data-subkey="sec2sub1"><a href="/Outlier-Detection-in-R.html" title="Outlier Detection"><span class="progress-dot"></span>Outlier Detection</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub2" data-collapsed="false"><span class="subsec-chevron">▼</span> Probability</li><li data-subkey="sec2sub2"><a href="/Sample-Spaces-Events-and-Probability-Axioms-in-R-With-Monte-Carlo-Proof.html" title="Probability Axioms"><span class="progress-dot"></span>Probability Axioms</a></li><li data-subkey="sec2sub2"><a href="/Conditional-Probability-in-R.html" title="Conditional Probability"><span class="progress-dot"></span>Conditional Probability</a></li><li data-subkey="sec2sub2"><a href="/Random-Variables-in-R.html" title="Random Variables"><span class="progress-dot"></span>Random Variables</a></li><li data-subkey="sec2sub2"><a href="/Binomial-and-Poisson-Distributions-in-R.html" title="Binomial vs Poisson"><span class="progress-dot"></span>Binomial vs Poisson</a></li><li data-subkey="sec2sub2"><a href="/Normal-t-F-and-Chi-Squared-Distributions-in-R.html" title="Normal, t, F, Chi-Squared"><span class="progress-dot"></span>Normal, t, F, Chi-Squared</a></li><li data-subkey="sec2sub2"><a href="/Central-Limit-Theorem-in-R.html" title="Central Limit Theorem"><span class="progress-dot"></span>Central Limit Theorem</a></li><li data-subkey="sec2sub2"><a href="/Sampling-Distributions-in-R.html" title="Sampling Distributions"><span class="progress-dot"></span>Sampling Distributions</a></li><li data-subkey="sec2sub2"><a href="/Law-of-Large-Numbers-vs-CLT-in-R.html" title="LLN vs CLT"><span class="progress-dot"></span>LLN vs CLT</a></li><li data-subkey="sec2sub2"><a href="/What-Is-Probability-Simulation-First-Intuition-in-R-Before-the-Formulas.html" title="Probability (Simulation-First)"><span class="progress-dot"></span>Probability (Simulation-First)</a></li><li data-subkey="sec2sub2"><a href="/Expected-Value-and-Variance-in-R.html" title="Expected Value and Variance"><span class="progress-dot"></span>Expected Value and Variance</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub3" data-collapsed="false"><span class="subsec-chevron">▼</span> Inference & Estimation</li><li data-subkey="sec2sub3"><a href="/Maximum-Likelihood-Estimation-in-R.html" title="Maximum Likelihood Estimation"><span class="progress-dot"></span>Maximum Likelihood Estimation</a></li><li data-subkey="sec2sub3"><a href="/Hypothesis-Testing-in-R.html" title="Hypothesis Testing"><span class="progress-dot"></span>Hypothesis Testing</a></li><li data-subkey="sec2sub3"><a href="/Sample-Size-Planning-in-R.html" title="Sample Size Planning"><span class="progress-dot"></span>Sample Size Planning</a></li><li data-subkey="sec2sub3"><a href="/Which-Statistical-Test-in-R.html" title="Choosing the Right Test"><span class="progress-dot"></span>Choosing the Right Test</a></li><li data-subkey="sec2sub3"><a href="/Statistical-Tests-in-R.html" title="Statistical Tests"><span class="progress-dot"></span>Statistical Tests</a></li><li data-subkey="sec2sub3"><a href="/Measures-of-Association-in-R.html" title="Measures of Association"><span class="progress-dot"></span>Measures of Association</a></li><li data-subkey="sec2sub3"><a href="/Point-Estimation-in-R.html" title="Point Estimation"><span class="progress-dot"></span>Point Estimation</a></li><li data-subkey="sec2sub3"><a href="/Confidence-Intervals-in-R.html" title="Confidence Intervals"><span class="progress-dot"></span>Confidence Intervals</a></li><li data-subkey="sec2sub3"><a href="/Type-I-and-Type-II-Errors-in-R.html" title="Type I and II Errors"><span class="progress-dot"></span>Type I and II Errors</a></li><li data-subkey="sec2sub3"><a href="/Statistical-Power-Analysis-in-R.html" title="Power Analysis"><span class="progress-dot"></span>Power Analysis</a></li><li data-subkey="sec2sub3"><a href="/Effect-Size-in-R.html" title="Effect Size"><span class="progress-dot"></span>Effect Size</a></li><li data-subkey="sec2sub3"><a href="/t-Tests-in-R.html" title="t-Tests"><span class="progress-dot"></span>t-Tests</a></li><li data-subkey="sec2sub3"><a href="/Proportion-Tests-in-R.html" title="Proportion Tests"><span class="progress-dot"></span>Proportion Tests</a></li><li data-subkey="sec2sub3"><a href="/Normality-and-Variance-Tests-in-R.html" title="Normality & Variance Tests"><span class="progress-dot"></span>Normality & Variance Tests</a></li><li data-subkey="sec2sub3"><a href="/Chi-Square-Tests-in-R.html" title="Chi-Square Tests"><span class="progress-dot"></span>Chi-Square Tests</a></li><li data-subkey="sec2sub3"><a href="/Wilcoxon-Mann-Whitney-and-Kruskal-Wallis-in-R.html" title="Wilcoxon, Mann-Whitney & Kruskal-Wallis"><span class="progress-dot"></span>Wilcoxon, Mann-Whitney & Kruskal-Wallis</a></li><li data-subkey="sec2sub3"><a href="/Multiple-Comparisons-in-R.html" title="Multiple Testing Correction"><span class="progress-dot"></span>Multiple Testing Correction</a></li><li data-subkey="sec2sub3" class="is-quiz"><a href="/Hypothesis-Testing-Exercises-in-R-quiz.html" title="Hypothesis Testing Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub4" data-collapsed="false"><span class="subsec-chevron">▼</span> Regression</li><li data-subkey="sec2sub4"><a href="/Linear-Regression.html" title="Linear Regression"><span class="progress-dot"></span>Linear Regression</a></li><li data-subkey="sec2sub4"><a href="/Logistic-Regression-With-R.html" title="Logistic Regression"><span class="progress-dot"></span>Logistic Regression</a></li><li data-subkey="sec2sub4"><a href="/Variable-Selection-and-Importance-With-R.html" title="Feature Selection"><span class="progress-dot"></span>Feature Selection</a></li><li data-subkey="sec2sub4"><a href="/Model-Selection-in-R.html" title="Model Selection"><span class="progress-dot"></span>Model Selection</a></li><li data-subkey="sec2sub4"><a href="/Missing-Value-Treatment-With-R.html" title="Missing Value Treatment"><span class="progress-dot"></span>Missing Value Treatment</a></li><li data-subkey="sec2sub4"><a href="/Outlier-Treatment-With-R.html" title="Outlier Analysis"><span class="progress-dot"></span>Outlier Analysis</a></li><li data-subkey="sec2sub4"><a href="/adv-regression-models.html" title="Advanced Regression Models"><span class="progress-dot"></span>Advanced Regression Models</a></li><li data-subkey="sec2sub4" class="is-quiz"><a href="/Linear-Regression-Exercises-in-R-quiz.html" title="Linear Regression Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub5" data-collapsed="false"><span class="subsec-chevron">▼</span> Reporting</li><li data-subkey="sec2sub5"><a href="/Statistical-Consulting-in-R.html" title="Statistical Consulting"><span class="progress-dot"></span>Statistical Consulting</a></li><li data-subkey="sec2sub5"><a href="/Statistical-Report-Writing-in-R.html" title="Statistical Report Writing"><span class="progress-dot"></span>Statistical Report Writing</a></li><li data-subkey="sec2sub5"><a href="/Bootstrap-Confidence-Intervals-in-R.html" title="Bootstrap Confidence Intervals"><span class="progress-dot"></span>Bootstrap Confidence Intervals</a></li><li data-subkey="sec2sub5"><a href="/Reporting-Statistics-in-R.html" title="Reporting Statistics"><span class="progress-dot"></span>Reporting Statistics</a></li><li data-subkey="sec2sub5"><a href="/Correlation-in-R.html" title="Correlation (Pearson, Spearman, Kendall)"><span class="progress-dot"></span>Correlation (Pearson, Spearman, Kendall)</a></li><li data-subkey="sec2sub5"><a href="/Linear-Regression-Assumptions-in-R.html" title="Linear Regression Assumptions"><span class="progress-dot"></span>Linear Regression Assumptions</a></li><li data-subkey="sec2sub5"><a href="/Dummy-Variables-in-R.html" title="Dummy Variables in R"><span class="progress-dot"></span>Dummy Variables in R</a></li><li data-subkey="sec2sub5"><a href="/Interaction-Effects-in-R.html" title="Interaction Effects"><span class="progress-dot"></span>Interaction Effects</a></li><li data-subkey="sec2sub5"><a href="/Regression-Diagnostics-in-R.html" title="Regression Diagnostics"><span class="progress-dot"></span>Regression Diagnostics</a></li><li data-subkey="sec2sub5"><a href="/Logistic-Regression-in-R.html" title="Logistic Regression (glm + ROC)"><span class="progress-dot"></span>Logistic Regression (glm + ROC)</a></li><li data-subkey="sec2sub5"><a href="/Variable-Selection-in-R.html" title="Variable Selection"><span class="progress-dot"></span>Variable Selection</a></li><li data-subkey="sec2sub5"><a href="/Poisson-Regression-in-R.html" title="Poisson Regression"><span class="progress-dot"></span>Poisson Regression</a></li><li data-subkey="sec2sub5"><a href="/Ridge-and-Lasso-Regression-in-R.html" title="Ridge & Lasso Regression"><span class="progress-dot"></span>Ridge & Lasso Regression</a></li><li data-subkey="sec2sub5"><a href="/Polynomial-and-Spline-Regression-in-R.html" title="Polynomial & Splines"><span class="progress-dot"></span>Polynomial & Splines</a></li><li data-subkey="sec2sub5"><a href="/Regression-Tables-in-R.html" title="Regression Tables (3 packages)"><span class="progress-dot"></span>Regression Tables (3 packages)</a></li><li data-subkey="sec2sub5"><a href="/One-Way-ANOVA-in-R.html" title="One-Way ANOVA"><span class="progress-dot"></span>One-Way ANOVA</a></li><li data-subkey="sec2sub5"><a href="/Post-Hoc-Tests-After-ANOVA.html" title="Post-Hoc Tests After ANOVA"><span class="progress-dot"></span>Post-Hoc Tests After ANOVA</a></li><li data-subkey="sec2sub5"><a href="/Two-Way-ANOVA-in-R.html" title="Two-Way ANOVA"><span class="progress-dot"></span>Two-Way ANOVA</a></li><li data-subkey="sec2sub5"><a href="/Repeated-Measures-ANOVA-in-R.html" title="Repeated Measures ANOVA"><span class="progress-dot"></span>Repeated Measures ANOVA</a></li><li data-subkey="sec2sub5"><a href="/ANCOVA-in-R.html" title="ANCOVA"><span class="progress-dot"></span>ANCOVA</a></li><li data-subkey="sec2sub5"><a href="/Experimental-Design-Principles-in-R.html" title="Experimental Design in R"><span class="progress-dot"></span>Experimental Design in R</a></li><li data-subkey="sec2sub5"><a href="/Factorial-Experiments-in-R.html" title="Factorial Designs (2^k)"><span class="progress-dot"></span>Factorial Designs (2^k)</a></li><li data-subkey="sec2sub5"><a href="/AB-Testing-in-R.html" title="A/B Testing"><span class="progress-dot"></span>A/B Testing</a></li><li data-subkey="sec2sub5"><a href="/MANOVA-in-R.html" title="MANOVA"><span class="progress-dot"></span>MANOVA</a></li><li data-subkey="sec2sub5"><a href="/Mixed-ANOVA-in-R.html" title="Mixed ANOVA"><span class="progress-dot"></span>Mixed ANOVA</a></li><li data-subkey="sec2sub5"><a href="/Multivariate-Statistics-in-R.html" title="Multivariate Distances & Hotelling's T²"><span class="progress-dot"></span>Multivariate Distances & Hotelling's T²</a></li><li data-subkey="sec2sub5"><a href="/PCA-in-R.html" title="PCA with prcomp()"><span class="progress-dot"></span>PCA with prcomp()</a></li><li data-subkey="sec2sub5"><a href="/Interpreting-PCA-Results-in-R.html" title="Interpreting PCA Output"><span class="progress-dot"></span>Interpreting PCA Output</a></li><li data-subkey="sec2sub5"><a href="/Exploratory-Factor-Analysis-in-R.html" title="Exploratory Factor Analysis"><span class="progress-dot"></span>Exploratory Factor Analysis</a></li><li data-subkey="sec2sub5"><a href="/CFA-and-Structural-Equation-Modeling-in-R.html" title="SEM and CFA (lavaan)"><span class="progress-dot"></span>SEM and CFA (lavaan)</a></li><li data-subkey="sec2sub5"><a href="/Linear-Discriminant-Analysis-in-R.html" title="LDA (Linear Discriminant Analysis)"><span class="progress-dot"></span>LDA (Linear Discriminant Analysis)</a></li><li data-subkey="sec2sub5"><a href="/Cluster-Analysis-in-R.html" title="Clustering (k-Means / HC / DBSCAN)"><span class="progress-dot"></span>Clustering (k-Means / HC / DBSCAN)</a></li><li data-subkey="sec2sub5"><a href="/Correspondence-Analysis-in-R.html" title="Correspondence Analysis"><span class="progress-dot"></span>Correspondence Analysis</a></li><li data-subkey="sec2sub5"><a href="/t-SNE-and-UMAP-in-R.html" title="t-SNE and UMAP"><span class="progress-dot"></span>t-SNE and UMAP</a></li><li data-subkey="sec2sub5"><a href="/Simple-Linear-Regression-in-R.html" title="Simple Linear Regression"><span class="progress-dot"></span>Simple Linear Regression</a></li><li data-subkey="sec2sub5"><a href="/Multiple-Regression-in-R.html" title="Multiple Regression"><span class="progress-dot"></span>Multiple Regression</a></li><li data-subkey="sec2sub5"><a href="/Robust-Regression-in-R.html" title="Robust Regression (rlm)"><span class="progress-dot"></span>Robust Regression (rlm)</a></li><li data-subkey="sec2sub5"><a href="/factoextra-and-FactoMineR.html" title="factoextra (PCA + Clusters)"><span class="progress-dot"></span>factoextra (PCA + Clusters)</a></li><li data-subkey="sec2sub5"><a href="/Categorical-Data-in-R.html" title="Categorical Data (Tables & Mosaic)"><span class="progress-dot"></span>Categorical Data (Tables & Mosaic)</a></li><li data-subkey="sec2sub5"><a href="/Chi-Square-Test-of-Independence-in-R.html" title="Chi-Square Test of Independence"><span class="progress-dot"></span>Chi-Square Test of Independence</a></li><li data-subkey="sec2sub5"><a href="/Chi-Square-Goodness-of-Fit-Test-in-R.html" title="Chi-Square Goodness-of-Fit"><span class="progress-dot"></span>Chi-Square Goodness-of-Fit</a></li><li data-subkey="sec2sub5"><a href="/Fishers-Exact-Test-in-R.html" title="Fisher's Exact Test"><span class="progress-dot"></span>Fisher's Exact Test</a></li><li data-subkey="sec2sub5"><a href="/Odds-Ratios-and-Relative-Risk-in-R.html" title="Odds Ratios & Relative Risk"><span class="progress-dot"></span>Odds Ratios & Relative Risk</a></li><li data-subkey="sec2sub5"><a href="/Logistic-Regression-in-R-2.html" title="Logistic Regression (Diagnostics)"><span class="progress-dot"></span>Logistic Regression (Diagnostics)</a></li><li data-subkey="sec2sub5"><a href="/Poisson-and-Negative-Binomial-Regression.html" title="Poisson & Negative Binomial Regression"><span class="progress-dot"></span>Poisson & Negative Binomial Regression</a></li><li data-subkey="sec2sub5"><a href="/Multinomial-and-Ordinal-Logistic-Regression-in-R.html" title="Multinomial & Ordinal Logistic Regression"><span class="progress-dot"></span>Multinomial & Ordinal Logistic Regression</a></li><li data-subkey="sec2sub5"><a href="/When-to-Use-Nonparametric-Tests-in-R.html" title="When to Use Nonparametric Tests"><span class="progress-dot"></span>When to Use Nonparametric Tests</a></li><li data-subkey="sec2sub5"><a href="/Wilcoxon-Signed-Rank-Test-in-R.html" title="Wilcoxon Signed-Rank Test"><span class="progress-dot"></span>Wilcoxon Signed-Rank Test</a></li><li data-subkey="sec2sub5"><a href="/Mann-Whitney-U-Test-in-R.html" title="Mann-Whitney U Test"><span class="progress-dot"></span>Mann-Whitney U Test</a></li><li data-subkey="sec2sub5"><a href="/Kruskal-Wallis-Test-in-R-2.html" title="Kruskal-Wallis Test"><span class="progress-dot"></span>Kruskal-Wallis Test</a></li><li data-subkey="sec2sub5"><a href="/Friedman-Test-in-R.html" title="Friedman Test"><span class="progress-dot"></span>Friedman Test</a></li><li data-subkey="sec2sub5"><a href="/Spearman-and-Kendall-Correlation-in-R.html" title="Spearman & Kendall Correlation"><span class="progress-dot"></span>Spearman & Kendall Correlation</a></li><li data-subkey="sec2sub5"><a href="/Bootstrap-in-R.html" class="active" title="Bootstrap (boot package)"><span class="progress-dot"></span>Bootstrap (boot package)</a></li><li data-subkey="sec2sub5"><a href="/Quantile-Regression-in-R-2.html" title="Quantile Regression"><span class="progress-dot"></span>Quantile Regression</a></li><li data-subkey="sec2sub5"><a href="/Matrix-Operations-in-R.html" title="Matrix Operations in R"><span class="progress-dot"></span>Matrix Operations in R</a></li><li data-subkey="sec2sub5"><a href="/Solving-Linear-Systems-in-R.html" title="Solving Linear Systems in R"><span class="progress-dot"></span>Solving Linear Systems in R</a></li><li data-subkey="sec2sub5"><a href="/Eigenvalues-and-Eigenvectors-in-R.html" title="Eigenvalues & Eigenvectors in R"><span class="progress-dot"></span>Eigenvalues & Eigenvectors in R</a></li><li data-subkey="sec2sub5"><a href="/Singular-Value-Decomposition-in-R.html" title="Singular Value Decomposition in R"><span class="progress-dot"></span>Singular Value Decomposition in R</a></li><li data-subkey="sec2sub5"><a href="/Projections-and-the-Hat-Matrix-in-R.html" title="Projections & the Hat Matrix"><span class="progress-dot"></span>Projections & the Hat Matrix</a></li><li data-subkey="sec2sub5"><a href="/QR-Decomposition-in-R.html" title="QR Decomposition in R"><span class="progress-dot"></span>QR Decomposition in R</a></li><li data-subkey="sec2sub5"><a href="/Quadratic-Forms-in-R.html" title="Quadratic Forms"><span class="progress-dot"></span>Quadratic Forms</a></li><li data-subkey="sec2sub5"><a href="/Matrix-Derivatives-and-the-Hessian-in-R.html" title="Matrix Derivatives & Hessian"><span class="progress-dot"></span>Matrix Derivatives & Hessian</a></li><li data-subkey="sec2sub5"><a href="/Exponential-Family-Distributions-in-R.html" title="Exponential Family Distributions"><span class="progress-dot"></span>Exponential Family Distributions</a></li><li data-subkey="sec2sub5"><a href="/Sufficient-Statistics-in-R.html" title="Sufficient Statistics"><span class="progress-dot"></span>Sufficient Statistics</a></li><li data-subkey="sec2sub5"><a href="/Complete-and-Ancillary-Statistics-in-R.html" title="Complete & Ancillary Statistics"><span class="progress-dot"></span>Complete & Ancillary Statistics</a></li><li data-subkey="sec2sub5"><a href="/UMVUE-in-R-2.html" title="UMVUE (Rao-Blackwell & Lehmann-Scheffé)"><span class="progress-dot"></span>UMVUE (Rao-Blackwell & Lehmann-Scheffé)</a></li><li data-subkey="sec2sub5"><a href="/Cramer-Rao-Lower-Bound-in-R-2.html" title="Cramér-Rao Lower Bound"><span class="progress-dot"></span>Cramér-Rao Lower Bound</a></li><li data-subkey="sec2sub5"><a href="/Asymptotic-Theory-in-R-2.html" title="Asymptotic Theory"><span class="progress-dot"></span>Asymptotic Theory</a></li><li data-subkey="sec2sub5"><a href="/Neyman-Pearson-Lemma-in-R-2.html" title="Neyman-Pearson Lemma"><span class="progress-dot"></span>Neyman-Pearson Lemma</a></li><li data-subkey="sec2sub5"><a href="/Likelihood-Ratio-Tests-and-Pivotal-Methods.html" title="Likelihood Ratio & Pivotal Methods"><span class="progress-dot"></span>Likelihood Ratio & Pivotal Methods</a></li><li data-subkey="sec2sub5"><a href="/Decision-Theory-in-R.html" title="Decision Theory"><span class="progress-dot"></span>Decision Theory</a></li><li data-subkey="sec2sub5"><a href="/Asymptotic-Relative-Efficiency-in-R.html" title="Asymptotic Relative Efficiency"><span class="progress-dot"></span>Asymptotic Relative Efficiency</a></li><li data-subkey="sec2sub5"><a href="/Bayes-Theorem-in-R.html" title="Bayes' Theorem"><span class="progress-dot"></span>Bayes' Theorem</a></li><li data-subkey="sec2sub5"><a href="/Bayesian-Statistics-in-R.html" title="Bayesian Statistics"><span class="progress-dot"></span>Bayesian Statistics</a></li><li data-subkey="sec2sub5"><a href="/Conjugate-Priors-in-R.html" title="Conjugate Priors"><span class="progress-dot"></span>Conjugate Priors</a></li><li data-subkey="sec2sub5"><a href="/Grid-Approximation-in-R.html" title="Grid Approximation"><span class="progress-dot"></span>Grid Approximation</a></li><li data-subkey="sec2sub5"><a href="/MCMC-in-R.html" title="MCMC in R"><span class="progress-dot"></span>MCMC in R</a></li><li data-subkey="sec2sub5"><a href="/Gibbs-Sampling-in-R.html" title="Gibbs Sampling"><span class="progress-dot"></span>Gibbs Sampling</a></li><li data-subkey="sec2sub5"><a href="/Hamiltonian-Monte-Carlo-in-R.html" title="Hamiltonian Monte Carlo"><span class="progress-dot"></span>Hamiltonian Monte Carlo</a></li><li data-subkey="sec2sub5"><a href="/Stan-in-R.html" title="Stan"><span class="progress-dot"></span>Stan</a></li><li data-subkey="sec2sub5"><a href="/brms-in-R.html" title="brms"><span class="progress-dot"></span>brms</a></li><li data-subkey="sec2sub5"><a href="/Choosing-Priors-in-R.html" title="Choosing Priors"><span class="progress-dot"></span>Choosing Priors</a></li><li data-subkey="sec2sub5"><a href="/Prior-Predictive-Checks-in-R.html" title="Prior Predictive Checks"><span class="progress-dot"></span>Prior Predictive Checks</a></li><li data-subkey="sec2sub5"><a href="/Compare-Bayesian-Models-in-R.html" title="Compare Bayesian Models"><span class="progress-dot"></span>Compare Bayesian Models</a></li><li data-subkey="sec2sub5"><a href="/Posterior-Predictive-Checks-in-R.html" title="Posterior Predictive Checks"><span class="progress-dot"></span>Posterior Predictive Checks</a></li><li data-subkey="sec2sub5"><a href="/Bayesian-Linear-Regression-in-R.html" title="Bayesian Linear Regression"><span class="progress-dot"></span>Bayesian Linear Regression</a></li><li data-subkey="sec2sub5"><a href="/Bayesian-Logistic-Regression-in-R.html" title="Bayesian Logistic Regression"><span class="progress-dot"></span>Bayesian Logistic Regression</a></li><li data-subkey="sec2sub5"><a href="/Bayesian-Hierarchical-Models-in-R.html" title="Bayesian Hierarchical Models"><span class="progress-dot"></span>Bayesian Hierarchical Models</a></li><li data-subkey="sec2sub5"><a href="/Multilevel-Models-in-R.html" title="Multilevel Models"><span class="progress-dot"></span>Multilevel Models</a></li><li data-subkey="sec2sub5"><a href="/Bayesian-ANOVA-in-R.html" title="Bayesian ANOVA"><span class="progress-dot"></span>Bayesian ANOVA</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub6" data-collapsed="false"><span class="subsec-chevron">▼</span> Machine Learning</li><li data-subkey="sec2sub6"><a href="/Random-Forest-Course.html" title="Random Forests (Course)"><span class="progress-dot"></span>Random Forests (Course)</a></li><li data-subkey="sec2sub6"><a href="/R-Gradient-Boosting-Course.html" title="Gradient Boosting (Course)"><span class="progress-dot"></span>Gradient Boosting (Course)</a></li><li data-subkey="sec2sub6"><a href="/R-tidymodels-Course.html" title="tidymodels (Course)"><span class="progress-dot"></span>tidymodels (Course)</a></li><li data-subkey="sec2sub6" class="is-quiz"><a href="/Machine-Learning-Exercises-in-R-quiz.html" title="Machine Learning Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec2sub6"><a href="/T-Test-Course.html" title="The t-test (Lesson)"><span class="progress-dot"></span>The t-test (Lesson)</a></li></ul></li><li class="sidebar-section"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">4.</span> <span class="sec-title-t">Visualization</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub1" data-collapsed="false"><span class="subsec-chevron">▼</span> ggplot2 Foundations</li><li data-subkey="sec3sub1"><a href="/ggplot2-Grammar-of-Graphics.html" title="Grammar of Graphics"><span class="progress-dot"></span>Grammar of Graphics</a></li><li data-subkey="sec3sub1"><a href="/ggplot2-Getting-Started.html" title="ggplot2 Getting Started"><span class="progress-dot"></span>ggplot2 Getting Started</a></li><li data-subkey="sec3sub1"><a href="/ggplot2-Aesthetics-aes-Map-Data.html" title="ggplot2 Aesthetics (aes)"><span class="progress-dot"></span>ggplot2 Aesthetics (aes)</a></li><li data-subkey="sec3sub1"><a href="/ggplot2-Colours.html" title="ggplot2 Colours"><span class="progress-dot"></span>ggplot2 Colours</a></li><li data-subkey="sec3sub1"><a href="/ggplot2-Scales.html" title="ggplot2 Scales"><span class="progress-dot"></span>ggplot2 Scales</a></li><li data-subkey="sec3sub1"><a href="/ggplot2-Themes-in-R.html" title="ggplot2 Themes"><span class="progress-dot"></span>ggplot2 Themes</a></li><li data-subkey="sec3sub1"><a href="/ggplot2-Labels-and-Annotations.html" title="Labels & Annotations"><span class="progress-dot"></span>Labels & Annotations</a></li><li data-subkey="sec3sub1"><a href="/ggplot2-Facets.html" title="ggplot2 Facets"><span class="progress-dot"></span>ggplot2 Facets</a></li><li data-subkey="sec3sub1" class="is-quiz"><a href="/ggplot2-Exercises-in-R-quiz.html" title="ggplot2 Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub2" data-collapsed="false"><span class="subsec-chevron">▼</span> Core Charts</li><li data-subkey="sec3sub2"><a href="/ggplot2-Scatter-Plots.html" title="Scatter Plots"><span class="progress-dot"></span>Scatter Plots</a></li><li data-subkey="sec3sub2"><a href="/ggplot2-Line-Charts.html" title="Line Charts"><span class="progress-dot"></span>Line Charts</a></li><li data-subkey="sec3sub2"><a href="/ggplot2-Bar-Charts.html" title="Bar Charts"><span class="progress-dot"></span>Bar Charts</a></li><li data-subkey="sec3sub2"><a href="/ggplot2-Distribution-Charts.html" title="Distribution Charts"><span class="progress-dot"></span>Distribution Charts</a></li><li data-subkey="sec3sub2"><a href="/Error-Bars-in-R.html" title="Error Bars"><span class="progress-dot"></span>Error Bars</a></li><li data-subkey="sec3sub2"><a href="/geom_smooth-in-R.html" title="geom_smooth()"><span class="progress-dot"></span>geom_smooth()</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub3" data-collapsed="false"><span class="subsec-chevron">▼</span> Distributions & Groups</li><li data-subkey="sec3sub3"><a href="/Violin-Plot-in-R.html" title="Violin Plot"><span class="progress-dot"></span>Violin Plot</a></li><li data-subkey="sec3sub3"><a href="/Ridgeline-Plot-in-R.html" title="Ridgeline Plot"><span class="progress-dot"></span>Ridgeline Plot</a></li><li data-subkey="sec3sub3"><a href="/Lollipop-Chart-in-R.html" title="Lollipop Chart"><span class="progress-dot"></span>Lollipop Chart</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub4" data-collapsed="false"><span class="subsec-chevron">▼</span> Relationships</li><li data-subkey="sec3sub4"><a href="/Bubble-Chart-in-R.html" title="Bubble Chart"><span class="progress-dot"></span>Bubble Chart</a></li><li data-subkey="sec3sub4"><a href="/Heatmap-in-R.html" title="Heatmap in R"><span class="progress-dot"></span>Heatmap in R</a></li><li data-subkey="sec3sub4"><a href="/Correlation-Matrix-Plot-in-R.html" title="Correlation Matrix"><span class="progress-dot"></span>Correlation Matrix</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub5" data-collapsed="false"><span class="subsec-chevron">▼</span> Advanced Charts</li><li data-subkey="sec3sub5"><a href="/Pie-Donut-Chart-in-R.html" title="Pie & Donut Chart"><span class="progress-dot"></span>Pie & Donut Chart</a></li><li data-subkey="sec3sub5"><a href="/Treemap-in-R.html" title="Treemap"><span class="progress-dot"></span>Treemap</a></li><li data-subkey="sec3sub5"><a href="/Waffle-Chart-in-R.html" title="Waffle Chart"><span class="progress-dot"></span>Waffle Chart</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub6" data-collapsed="false"><span class="subsec-chevron">▼</span> Exploratory Analysis</li><li data-subkey="sec3sub6"><a href="/Exploratory-Data-Analysis-in-R.html" title="EDA (7-Step Framework)"><span class="progress-dot"></span>EDA (7-Step Framework)</a></li><li data-subkey="sec3sub6"><a href="/Univariate-EDA-in-R.html" title="Univariate EDA"><span class="progress-dot"></span>Univariate EDA</a></li><li data-subkey="sec3sub6"><a href="/Bivariate-EDA-in-R.html" title="Bivariate EDA"><span class="progress-dot"></span>Bivariate EDA</a></li><li data-subkey="sec3sub6"><a href="/Descriptive-Statistics-in-R.html" title="Descriptive Statistics"><span class="progress-dot"></span>Descriptive Statistics</a></li><li data-subkey="sec3sub6"><a href="/Correlation-Analysis-in-R.html" title="Correlation Analysis"><span class="progress-dot"></span>Correlation Analysis</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub7" data-collapsed="false"><span class="subsec-chevron">▼</span> Interactive & Maps</li><li data-subkey="sec3sub7"><a href="/Combining-ggplot2-with-plotly.html" title="ggplot2 + plotly Interactive"><span class="progress-dot"></span>ggplot2 + plotly Interactive</a></li><li data-subkey="sec3sub7"><a href="/Interactive-Maps-in-R-with-leaflet.html" title="Leaflet Interactive Maps"><span class="progress-dot"></span>Leaflet Interactive Maps</a></li><li data-subkey="sec3sub7"><a href="/Spatial-Data-in-R-with-sf.html" title="Spatial Data (sf)"><span class="progress-dot"></span>Spatial Data (sf)</a></li><li data-subkey="sec3sub7"><a href="/Choropleth-Maps-in-R.html" title="Choropleth Maps (sf)"><span class="progress-dot"></span>Choropleth Maps (sf)</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec3sub8" data-collapsed="false"><span class="subsec-chevron">▼</span> Customization & Reference</li><li data-subkey="sec3sub8"><a href="/ggplot2-Legends-in-R.html" title="ggplot2 Legends"><span class="progress-dot"></span>ggplot2 Legends</a></li><li data-subkey="sec3sub8"><a href="/ggplot2-Secondary-Axis.html" title="Secondary Axis"><span class="progress-dot"></span>Secondary Axis</a></li><li data-subkey="sec3sub8"><a href="/ggplot2-Log-Scale.html" title="Log Scale"><span class="progress-dot"></span>Log Scale</a></li><li data-subkey="sec3sub8"><a href="/patchwork-Package.html" title="patchwork (Combine Plots)"><span class="progress-dot"></span>patchwork (Combine Plots)</a></li><li data-subkey="sec3sub8"><a href="/Publication-Quality-Figures-in-R.html" title="Publication-Ready Figures"><span class="progress-dot"></span>Publication-Ready Figures</a></li><li data-subkey="sec3sub8"><a href="/ggplot2-cheatsheet.html" title="ggplot2 Quickref"><span class="progress-dot"></span>ggplot2 Quickref</a></li><li data-subkey="sec3sub8"><a href="/Advanced-ggplot2-Course.html" title="Advanced ggplot2 (Course)"><span class="progress-dot"></span>Advanced ggplot2 (Course)</a></li><li data-subkey="sec3sub8"><a href="/ggplot2-Course.html" title="ggplot2 (Course)"><span class="progress-dot"></span>ggplot2 (Course)</a></li><li data-subkey="sec3sub8"><a href="/Dashboards-Course.html" title="Interactive Dashboards (Course)"><span class="progress-dot"></span>Interactive Dashboards (Course)</a></li></ul></li><li class="sidebar-section"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">5.</span> <span class="sec-title-t">Time Series</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li data-subkey="sec4sub0"><a href="/Time-Series-Analysis-With-R.html" title="Time Series Analysis"><span class="progress-dot"></span>Time Series Analysis</a></li><li data-subkey="sec4sub0"><a href="/Time-Series-Forecasting-With-R.html" title="Time Series Forecasting"><span class="progress-dot"></span>Time Series Forecasting</a></li><li data-subkey="sec4sub0"><a href="/Time-Series-Forecasting-With-R-part2.html" title="More Time Series Forecasting"><span class="progress-dot"></span>More Time Series Forecasting</a></li><li data-subkey="sec4sub0" class="is-quiz"><a href="/Time-Series-Exercises-in-R-quiz.html" title="Time Series Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li></ul></li><li class="sidebar-section"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">6.</span> <span class="sec-title-t">Advanced R</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec5sub1" data-collapsed="false"><span class="subsec-chevron">▼</span> Functional Programming</li><li data-subkey="sec5sub1"><a href="/Functional-Programming-in-R.html" title="Functional Programming"><span class="progress-dot"></span>Functional Programming</a></li><li data-subkey="sec5sub1" class="is-quiz"><a href="/R-Functional-Programming-Exercises-quiz.html" title="Functional Programming Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec5sub1"><a href="/purrr-map-Variants.html" title="purrr map() Variants"><span class="progress-dot"></span>purrr map() Variants</a></li><li data-subkey="sec5sub1"><a href="/R-Anonymous-Functions.html" title="R Anonymous Functions"><span class="progress-dot"></span>R Anonymous Functions</a></li><li data-subkey="sec5sub1"><a href="/R-Function-Factories.html" title="R Function Factories"><span class="progress-dot"></span>R Function Factories</a></li><li data-subkey="sec5sub1"><a href="/R-Function-Operators.html" title="R Function Operators"><span class="progress-dot"></span>R Function Operators</a></li><li data-subkey="sec5sub1"><a href="/Reduce-Filter-Map-in-R.html" title="Reduce, Filter, Map"><span class="progress-dot"></span>Reduce, Filter, Map</a></li><li data-subkey="sec5sub1"><a href="/Memoization-in-R.html" title="Memoization in R"><span class="progress-dot"></span>Memoization in R</a></li><li data-subkey="sec5sub1"><a href="/Writing-Composable-R-Code.html" title="Composable R Code"><span class="progress-dot"></span>Composable R Code</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec5sub2" data-collapsed="false"><span class="subsec-chevron">▼</span> OOP in R</li><li data-subkey="sec5sub2"><a href="/OOP-in-R.html" title="OOP in R: S3/S4/R6"><span class="progress-dot"></span>OOP in R: S3/S4/R6</a></li><li data-subkey="sec5sub2"><a href="/S3-Classes-in-R.html" title="S3 Classes"><span class="progress-dot"></span>S3 Classes</a></li><li data-subkey="sec5sub2"><a href="/S3-Method-Dispatch-in-R.html" title="S3 Method Dispatch"><span class="progress-dot"></span>S3 Method Dispatch</a></li><li data-subkey="sec5sub2"><a href="/S4-Classes-in-R.html" title="S4 Classes"><span class="progress-dot"></span>S4 Classes</a></li><li data-subkey="sec5sub2"><a href="/S4-Methods-in-R.html" title="S4 Methods & Dispatch"><span class="progress-dot"></span>S4 Methods & Dispatch</a></li><li data-subkey="sec5sub2"><a href="/R6-Classes-in-R.html" title="R6 Classes"><span class="progress-dot"></span>R6 Classes</a></li><li data-subkey="sec5sub2"><a href="/R6-Advanced.html" title="R6 Advanced"><span class="progress-dot"></span>R6 Advanced</a></li><li data-subkey="sec5sub2"><a href="/Operator-Overloading-in-R.html" title="Operator Overloading"><span class="progress-dot"></span>Operator Overloading</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec5sub3" data-collapsed="false"><span class="subsec-chevron">▼</span> How R Works</li><li data-subkey="sec5sub3"><a href="/R-Names-and-Values.html" title="R Names & Values"><span class="progress-dot"></span>R Names & Values</a></li><li data-subkey="sec5sub3"><a href="/R-Assignment-Deep-Dive.html" title="R Assignment Deep Dive"><span class="progress-dot"></span>R Assignment Deep Dive</a></li><li data-subkey="sec5sub3"><a href="/R-Memory-lobstr.html" title="R Memory & lobstr"><span class="progress-dot"></span>R Memory & lobstr</a></li><li data-subkey="sec5sub3"><a href="/R-Environments.html" title="R Environments"><span class="progress-dot"></span>R Environments</a></li><li data-subkey="sec5sub3"><a href="/R-Lexical-Scoping.html" title="Lexical Scoping"><span class="progress-dot"></span>Lexical Scoping</a></li><li data-subkey="sec5sub3"><a href="/R-Closures.html" title="R Closures"><span class="progress-dot"></span>R Closures</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec5sub4" data-collapsed="false"><span class="subsec-chevron">▼</span> Debugging & Performance</li><li data-subkey="sec5sub4"><a href="/R-Conditions-System.html" title="Conditions System"><span class="progress-dot"></span>Conditions System</a></li><li data-subkey="sec5sub4"><a href="/R-Debugging.html" title="Debugging R Code"><span class="progress-dot"></span>Debugging R Code</a></li><li data-subkey="sec5sub4"><a href="/R-Common-Errors.html" title="50 Common R Errors"><span class="progress-dot"></span>50 Common R Errors</a></li><li data-subkey="sec5sub4"><a href="/Parallel-Computing-With-R.html" title="Parallel Computing"><span class="progress-dot"></span>Parallel Computing</a></li><li data-subkey="sec5sub4"><a href="/Strategies-To-Improve-And-Speedup-R-Code.html" title="Speedup R Code"><span class="progress-dot"></span>Speedup R Code</a></li><li data-subkey="sec5sub4" class="is-quiz"><a href="/Shiny-Exercises-in-R-quiz.html" title="Shiny Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li></ul></li><li class="sidebar-section"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">7.</span> <span class="sec-title-t">Classic Tutorials</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li data-subkey="sec6sub0"><a href="/R-Tutorial.html" title="R Tutorial (Classic)"><span class="progress-dot"></span>R Tutorial (Classic)</a></li><li data-subkey="sec6sub0"><a href="/ggplot2-Tutorial-With-R.html" title="ggplot2 Short Tutorial"><span class="progress-dot"></span>ggplot2 Short Tutorial</a></li><li data-subkey="sec6sub0"><a href="/Complete-Ggplot2-Tutorial-Part1-With-R-Code.html" title="ggplot2 Tutorial 1 - Intro"><span class="progress-dot"></span>ggplot2 Tutorial 1 - Intro</a></li><li data-subkey="sec6sub0"><a href="/Complete-Ggplot2-Tutorial-Part2-Customizing-Theme-With-R-Code.html" title="ggplot2 Tutorial 2 - Theme"><span class="progress-dot"></span>ggplot2 Tutorial 2 - Theme</a></li><li data-subkey="sec6sub0"><a href="/Top50-Ggplot2-Visualizations-MasterList-R-Code.html" title="ggplot2 Tutorial 3 - Masterlist"><span class="progress-dot"></span>ggplot2 Tutorial 3 - Masterlist</a></li><li data-subkey="sec6sub0"><a href="/Association-Mining-With-R.html" title="Association Mining"><span class="progress-dot"></span>Association Mining</a></li><li data-subkey="sec6sub0"><a href="/Multi-Dimensional-Scaling-With-R.html" title="Multi Dimensional Scaling"><span class="progress-dot"></span>Multi Dimensional Scaling</a></li><li data-subkey="sec6sub0"><a href="/Optimization-With-R.html" title="Optimization"><span class="progress-dot"></span>Optimization</a></li><li data-subkey="sec6sub0"><a href="/Information-Value-With-R.html" title="InformationValue Package"><span class="progress-dot"></span>InformationValue Package</a></li></ul></li><li class="sidebar-section"><div class="sidebar-section-header"><span class="sidebar-chevron">▸</span><span class="sec-num">8.</span> <span class="sec-title-t">Practice Exercises</span><span class="section-meta" data-section-meta></span></div><ul class="sidebar-section-items list-unstyled"><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec7sub1" data-collapsed="false"><span class="subsec-chevron">▼</span> Mastery Quizzes (Certificate)</li><li data-subkey="sec7sub1" class="is-quiz"><a href="/R-Beginner-Exercises-quiz.html" title="R Fundamentals Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/dplyr-Exercises-in-R-quiz.html" title="dplyr Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/ggplot2-Exercises-in-R-quiz.html" title="ggplot2 Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/Hypothesis-Testing-Exercises-in-R-quiz.html" title="Hypothesis Testing Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/Linear-Regression-Exercises-in-R-quiz.html" title="Linear Regression Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/Machine-Learning-Exercises-in-R-quiz.html" title="Machine Learning Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/tidyr-Exercises-in-R-quiz.html" title="tidyr Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/Time-Series-Exercises-in-R-quiz.html" title="Time Series Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/Shiny-Exercises-in-R-quiz.html" title="Shiny Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/R-Interview-Questions-quiz.html" title="R Interview Readiness Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li data-subkey="sec7sub1" class="is-quiz"><a href="/R-Functional-Programming-Exercises-quiz.html" title="Functional Programming Quiz"><span class="quiz-marker" aria-hidden="true"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 4 5.1v5.7c0 4.9 3.4 8.4 8 9.9 4.6-1.5 8-5 8-9.9V5.1L12 2z"/></svg></span>Quiz</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec7sub2" data-collapsed="false"><span class="subsec-chevron">▼</span> R Fundamentals</li><li data-subkey="sec7sub2"><a href="/R-Basics-Exercises.html" title="R Basics (15 problems)"><span class="progress-dot"></span>R Basics (15 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Vectors-Exercises.html" title="R Vectors (12 problems)"><span class="progress-dot"></span>R Vectors (12 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Data-Frames-Exercises.html" title="R Data Frames (15 problems)"><span class="progress-dot"></span>R Data Frames (15 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Lists-Exercises.html" title="R Lists (10 problems)"><span class="progress-dot"></span>R Lists (10 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Control-Flow-Exercises.html" title="R Control Flow (12 problems)"><span class="progress-dot"></span>R Control Flow (12 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Functions-Exercises.html" title="R Functions (10 problems)"><span class="progress-dot"></span>R Functions (10 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-String-Exercises.html" title="R Strings (10 problems)"><span class="progress-dot"></span>R Strings (10 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Date-Time-Exercises.html" title="R Date & Time (10 problems)"><span class="progress-dot"></span>R Date & Time (10 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Apply-Exercises.html" title="R apply Family (12 problems)"><span class="progress-dot"></span>R apply Family (12 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Subsetting-Exercises.html" title="R Subsetting (10 problems)"><span class="progress-dot"></span>R Subsetting (10 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-Functional-Programming-Exercises.html" title="Functional Programming (10 problems)"><span class="progress-dot"></span>Functional Programming (10 problems)</a></li><li data-subkey="sec7sub2"><a href="/R-OOP-Exercises.html" title="OOP in R (8 problems)"><span class="progress-dot"></span>OOP in R (8 problems)</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec7sub3" data-collapsed="false"><span class="subsec-chevron">▼</span> Data Wrangling</li><li data-subkey="sec7sub3"><a href="/R-Data-Import-Exercises.html" title="Data Import (10 problems)"><span class="progress-dot"></span>Data Import (10 problems)</a></li><li data-subkey="sec7sub3"><a href="/dplyr-Exercises.html" title="dplyr (15 problems)"><span class="progress-dot"></span>dplyr (15 problems)</a></li><li data-subkey="sec7sub3"><a href="/dplyr-filter-select-Exercises.html" title="dplyr filter() & select() (12 problems)"><span class="progress-dot"></span>dplyr filter() & select() (12 problems)</a></li><li data-subkey="sec7sub3"><a href="/dplyr-group-by-summarise-Exercises.html" title="dplyr group_by() & summarise() (10 problems)"><span class="progress-dot"></span>dplyr group_by() & summarise() (10 problems)</a></li><li data-subkey="sec7sub3"><a href="/dplyr-Join-Exercises.html" title="dplyr Joins (10 problems)"><span class="progress-dot"></span>dplyr Joins (10 problems)</a></li><li data-subkey="sec7sub3"><a href="/data-table-Exercises.html" title="data.table (12 problems)"><span class="progress-dot"></span>data.table (12 problems)</a></li><li data-subkey="sec7sub3"><a href="/purrr-Exercises.html" title="purrr (10 problems)"><span class="progress-dot"></span>purrr (10 problems)</a></li><li data-subkey="sec7sub3"><a href="/tidyr-Reshaping-Exercises.html" title="tidyr Reshaping (10 problems)"><span class="progress-dot"></span>tidyr Reshaping (10 problems)</a></li><li data-subkey="sec7sub3"><a href="/Missing-Data-in-R-Exercises.html" title="Missing Data in R (10 problems)"><span class="progress-dot"></span>Missing Data in R (10 problems)</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec7sub4" data-collapsed="false"><span class="subsec-chevron">▼</span> Visualization</li><li data-subkey="sec7sub4"><a href="/ggplot2-Exercises.html" title="ggplot2 (15 problems)"><span class="progress-dot"></span>ggplot2 (15 problems)</a></li><li data-subkey="sec7sub4"><a href="/ggplot2-Geom-Exercises.html" title="ggplot2 Geoms (12 problems)"><span class="progress-dot"></span>ggplot2 Geoms (12 problems)</a></li><li data-subkey="sec7sub4"><a href="/ggplot2-Aesthetics-Exercises.html" title="ggplot2 Aesthetics (10 problems)"><span class="progress-dot"></span>ggplot2 Aesthetics (10 problems)</a></li><li data-subkey="sec7sub4"><a href="/ggplot2-Customization-Exercises.html" title="ggplot2 Customization (10 problems)"><span class="progress-dot"></span>ggplot2 Customization (10 problems)</a></li><li data-subkey="sec7sub4"><a href="/ggplot2-Facet-Exercises.html" title="ggplot2 Facets (8 problems)"><span class="progress-dot"></span>ggplot2 Facets (8 problems)</a></li><li data-subkey="sec7sub4"><a href="/R-Visualization-Project.html" title="R Visualization Project (5 charts)"><span class="progress-dot"></span>R Visualization Project (5 charts)</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec7sub5" data-collapsed="false"><span class="subsec-chevron">▼</span> Statistics</li><li data-subkey="sec7sub5"><a href="/Probability-in-R-Exercises.html" title="Probability in R Exercises"><span class="progress-dot"></span>Probability in R Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-Probability-Distributions-Exercises.html" title="R Probability Distributions (12 problems)"><span class="progress-dot"></span>R Probability Distributions (12 problems)</a></li><li data-subkey="sec7sub5"><a href="/Binomial-Distribution-Exercises-in-R.html" title="Binomial Distribution Exercises"><span class="progress-dot"></span>Binomial Distribution Exercises</a></li><li data-subkey="sec7sub5"><a href="/Poisson-Distribution-Exercises-in-R.html" title="Poisson Distribution Exercises"><span class="progress-dot"></span>Poisson Distribution Exercises</a></li><li data-subkey="sec7sub5"><a href="/Central-Limit-Theorem-Exercises-in-R.html" title="Central Limit Theorem Exercises"><span class="progress-dot"></span>Central Limit Theorem Exercises</a></li><li data-subkey="sec7sub5"><a href="/Hypothesis-Testing-Exercises-in-R.html" title="Hypothesis Testing Exercises"><span class="progress-dot"></span>Hypothesis Testing Exercises</a></li><li data-subkey="sec7sub5"><a href="/t-Test-Exercises-in-R.html" title="t-Test Exercises (12 problems)"><span class="progress-dot"></span>t-Test Exercises (12 problems)</a></li><li data-subkey="sec7sub5"><a href="/Chi-Square-Test-Exercises-in-R.html" title="Chi-Square Exercises (10 problems)"><span class="progress-dot"></span>Chi-Square Exercises (10 problems)</a></li><li data-subkey="sec7sub5"><a href="/Confidence-Interval-Exercises-in-R.html" title="Confidence Interval (10 problems)"><span class="progress-dot"></span>Confidence Interval (10 problems)</a></li><li data-subkey="sec7sub5"><a href="/Power-Analysis-Exercises-in-R.html" title="Power Analysis Exercises (8 problems)"><span class="progress-dot"></span>Power Analysis Exercises (8 problems)</a></li><li data-subkey="sec7sub5"><a href="/Nonparametric-Tests-Exercises-in-R.html" title="Nonparametric Exercises (10 problems)"><span class="progress-dot"></span>Nonparametric Exercises (10 problems)</a></li><li data-subkey="sec7sub5"><a href="/Multiple-Testing-Exercises-in-R.html" title="Multiple Testing (8 problems)"><span class="progress-dot"></span>Multiple Testing (8 problems)</a></li><li data-subkey="sec7sub5"><a href="/Multiple-Regression-Exercises-in-R.html" title="Multiple Regression Exercises"><span class="progress-dot"></span>Multiple Regression Exercises</a></li><li data-subkey="sec7sub5"><a href="/Logistic-Regression-Exercises-in-R.html" title="Logistic Regression Exercises (10 problems)"><span class="progress-dot"></span>Logistic Regression Exercises (10 problems)</a></li><li data-subkey="sec7sub5"><a href="/Regression-Diagnostics-Exercises-in-R.html" title="Regression Diagnostics Exercises"><span class="progress-dot"></span>Regression Diagnostics Exercises</a></li><li data-subkey="sec7sub5"><a href="/Ridge-and-Lasso-Exercises-in-R.html" title="Ridge & Lasso Exercises"><span class="progress-dot"></span>Ridge & Lasso Exercises</a></li><li data-subkey="sec7sub5"><a href="/GLM-Exercises-in-R.html" title="GLM Exercises (10 problems)"><span class="progress-dot"></span>GLM Exercises (10 problems)</a></li><li data-subkey="sec7sub5"><a href="/ANOVA-Exercises-in-R.html" title="ANOVA Exercises (15 problems)"><span class="progress-dot"></span>ANOVA Exercises (15 problems)</a></li><li data-subkey="sec7sub5"><a href="/Post-Hoc-Tests-Exercises-in-R.html" title="Post-Hoc Tests Exercises (8 problems)"><span class="progress-dot"></span>Post-Hoc Tests Exercises (8 problems)</a></li><li data-subkey="sec7sub5"><a href="/Repeated-Measures-Exercises-in-R.html" title="Repeated Measures (8 problems)"><span class="progress-dot"></span>Repeated Measures (8 problems)</a></li><li data-subkey="sec7sub5"><a href="/Experimental-Design-Exercises-in-R.html" title="Experimental Design Exercises (8 problems)"><span class="progress-dot"></span>Experimental Design Exercises (8 problems)</a></li><li data-subkey="sec7sub5"><a href="/AB-Testing-Exercises-in-R.html" title="A/B Testing Exercises (8 problems)"><span class="progress-dot"></span>A/B Testing Exercises (8 problems)</a></li><li data-subkey="sec7sub5"><a href="/Linear-Regression-Exercises-in-R.html" title="Linear Regression (15 problems)"><span class="progress-dot"></span>Linear Regression (15 problems)</a></li><li data-subkey="sec7sub5"><a href="/PCA-Exercises-in-R.html" title="PCA Exercises (10 problems)"><span class="progress-dot"></span>PCA Exercises (10 problems)</a></li><li data-subkey="sec7sub5"><a href="/Cluster-Analysis-Exercises-in-R.html" title="Clustering Exercises (10 problems)"><span class="progress-dot"></span>Clustering Exercises (10 problems)</a></li><li data-subkey="sec7sub5"><a href="/SEM-Exercises-in-R.html" title="SEM Exercises (8 problems)"><span class="progress-dot"></span>SEM Exercises (8 problems)</a></li><li data-subkey="sec7sub5"><a href="/A-B-Testing-Exercises-in-R.html" title="A/B Testing Exercises"><span class="progress-dot"></span>A/B Testing Exercises</a></li><li data-subkey="sec7sub5"><a href="/API-Calls-Exercises-in-R.html" title="API Calls Exercises"><span class="progress-dot"></span>API Calls Exercises</a></li><li data-subkey="sec7sub5"><a href="/ARIMA-Exercises-in-R.html" title="ARIMA Exercises"><span class="progress-dot"></span>ARIMA Exercises</a></li><li data-subkey="sec7sub5"><a href="/Apply-Family-Exercises-in-R.html" title="Apply Family Exercises"><span class="progress-dot"></span>Apply Family Exercises</a></li><li data-subkey="sec7sub5"><a href="/Bayesian-Statistics-Exercises-in-R.html" title="Bayesian Statistics Exercises"><span class="progress-dot"></span>Bayesian Statistics Exercises</a></li><li data-subkey="sec7sub5"><a href="/Clustering-Exercises-in-R.html" title="Clustering Exercises"><span class="progress-dot"></span>Clustering Exercises</a></li><li data-subkey="sec7sub5"><a href="/Correlation-Exercises-in-R.html" title="Correlation Exercises"><span class="progress-dot"></span>Correlation Exercises</a></li><li data-subkey="sec7sub5"><a href="/Cross-Validation-Exercises-in-R.html" title="Cross Validation Exercises"><span class="progress-dot"></span>Cross Validation Exercises</a></li><li data-subkey="sec7sub5"><a href="/Data-Cleaning-Exercises-in-R.html" title="Data Cleaning Exercises"><span class="progress-dot"></span>Data Cleaning Exercises</a></li><li data-subkey="sec7sub5"><a href="/Data-Visualization-Exercises-in-R.html" title="Data Viz Exercises"><span class="progress-dot"></span>Data Viz Exercises</a></li><li data-subkey="sec7sub5"><a href="/Data-Wrangling-Exercises-in-R.html" title="Data Wrangling Exercises"><span class="progress-dot"></span>Data Wrangling Exercises</a></li><li data-subkey="sec7sub5"><a href="/Decision-Tree-Exercises-in-R.html" title="Decision Tree Exercises"><span class="progress-dot"></span>Decision Tree Exercises</a></li><li data-subkey="sec7sub5"><a href="/EDA-Exercises-in-R.html" title="EDA Exercises"><span class="progress-dot"></span>EDA Exercises</a></li><li data-subkey="sec7sub5"><a href="/GAM-Exercises-in-R.html" title="GAM Exercises"><span class="progress-dot"></span>GAM Exercises</a></li><li data-subkey="sec7sub5"><a href="/Machine-Learning-Exercises-in-R.html" title="Machine Learning Exercises"><span class="progress-dot"></span>Machine Learning Exercises</a></li><li data-subkey="sec7sub5"><a href="/Mixed-Effects-Models-Exercises-in-R.html" title="Mixed Effects Exercises"><span class="progress-dot"></span>Mixed Effects Exercises</a></li><li data-subkey="sec7sub5"><a href="/Network-Analysis-Exercises-in-R.html" title="Network Analysis Exercises"><span class="progress-dot"></span>Network Analysis Exercises</a></li><li data-subkey="sec7sub5"><a href="/Parallel-Computing-in-R-Exercises.html" title="Parallel Computing Exercises"><span class="progress-dot"></span>Parallel Computing Exercises</a></li><li data-subkey="sec7sub5"><a href="/Poisson-Regression-Exercises-in-R.html" title="Poisson Regression"><span class="progress-dot"></span>Poisson Regression</a></li><li data-subkey="sec7sub5"><a href="/Probability-Distributions-Exercises-in-R.html" title="Probability Distributions"><span class="progress-dot"></span>Probability Distributions</a></li><li data-subkey="sec7sub5"><a href="/R-Beginner-Exercises.html" title="R Beginner Exercises"><span class="progress-dot"></span>R Beginner Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-Debugging-Exercises.html" title="R Debugging Exercises"><span class="progress-dot"></span>R Debugging Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-Markdown-Exercises.html" title="R Markdown Exercises"><span class="progress-dot"></span>R Markdown Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-Package-Development-Exercises.html" title="R Package Development"><span class="progress-dot"></span>R Package Development</a></li><li data-subkey="sec7sub5"><a href="/R-Performance-Optimization-Exercises.html" title="R Performance Exercises"><span class="progress-dot"></span>R Performance Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-for-Biostatistics-Exercises.html" title="R for Biostatistics"><span class="progress-dot"></span>R for Biostatistics</a></li><li data-subkey="sec7sub5"><a href="/R-for-Data-Science-Exercises.html" title="R for Data Science Exercises"><span class="progress-dot"></span>R for Data Science Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-for-Finance-Exercises.html" title="R for Finance Exercises"><span class="progress-dot"></span>R for Finance Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-for-Genomics-Exercises.html" title="R for Genomics"><span class="progress-dot"></span>R for Genomics</a></li><li data-subkey="sec7sub5"><a href="/R-for-Healthcare-Exercises.html" title="R for Healthcare Exercises"><span class="progress-dot"></span>R for Healthcare Exercises</a></li><li data-subkey="sec7sub5"><a href="/R-for-Marketing-Analytics-Exercises.html" title="R for Marketing Analytics"><span class="progress-dot"></span>R for Marketing Analytics</a></li><li data-subkey="sec7sub5"><a href="/R-for-Sports-Analytics-Exercises.html" title="R for Sports Analytics"><span class="progress-dot"></span>R for Sports Analytics</a></li><li data-subkey="sec7sub5"><a href="/Random-Forest-Exercises-in-R.html" title="Random Forest Exercises"><span class="progress-dot"></span>Random Forest Exercises</a></li><li data-subkey="sec7sub5"><a href="/Regex-Exercises-in-R.html" title="Regex Exercises"><span class="progress-dot"></span>Regex Exercises</a></li><li data-subkey="sec7sub5"><a href="/Sampling-Methods-Exercises-in-R.html" title="Sampling Methods Exercises"><span class="progress-dot"></span>Sampling Methods Exercises</a></li><li data-subkey="sec7sub5"><a href="/Shiny-Exercises-in-R.html" title="Shiny Exercises"><span class="progress-dot"></span>Shiny Exercises</a></li><li data-subkey="sec7sub5"><a href="/Spatial-Analysis-Exercises-in-R.html" title="Spatial Analysis Exercises"><span class="progress-dot"></span>Spatial Analysis Exercises</a></li><li data-subkey="sec7sub5"><a href="/Survey-Analysis-in-R-Exercises.html" title="Survey Analysis Exercises"><span class="progress-dot"></span>Survey Analysis Exercises</a></li><li data-subkey="sec7sub5"><a href="/Survival-Analysis-Exercises-in-R.html" title="Survival Analysis Exercises"><span class="progress-dot"></span>Survival Analysis Exercises</a></li><li data-subkey="sec7sub5"><a href="/Text-Mining-Exercises-in-R.html" title="Text Mining Exercises"><span class="progress-dot"></span>Text Mining Exercises</a></li><li data-subkey="sec7sub5"><a href="/Time-Series-Exercises-in-R.html" title="Time Series Exercises"><span class="progress-dot"></span>Time Series Exercises</a></li><li data-subkey="sec7sub5"><a href="/Web-Scraping-Exercises-in-R.html" title="Web Scraping Exercises"><span class="progress-dot"></span>Web Scraping Exercises</a></li><li data-subkey="sec7sub5"><a href="/XGBoost-Exercises-in-R.html" title="XGBoost Exercises"><span class="progress-dot"></span>XGBoost Exercises</a></li><li data-subkey="sec7sub5"><a href="/broom-Exercises-in-R.html" title="broom Exercises"><span class="progress-dot"></span>broom Exercises</a></li><li data-subkey="sec7sub5"><a href="/caret-Exercises-in-R.html" title="caret Exercises"><span class="progress-dot"></span>caret Exercises</a></li><li data-subkey="sec7sub5"><a href="/data.table-Exercises-in-R.html" title="data.table Exercises"><span class="progress-dot"></span>data.table Exercises</a></li><li data-subkey="sec7sub5"><a href="/dbplyr-SQL-Exercises-in-R.html" title="dbplyr / SQL Exercises"><span class="progress-dot"></span>dbplyr / SQL Exercises</a></li><li data-subkey="sec7sub5"><a href="/dplyr-Exercises-in-R.html" title="dplyr Exercises"><span class="progress-dot"></span>dplyr Exercises</a></li><li data-subkey="sec7sub5"><a href="/dplyr-Group-By-Exercises-in-R.html" title="dplyr group_by Exercises"><span class="progress-dot"></span>dplyr group_by Exercises</a></li><li data-subkey="sec7sub5"><a href="/dplyr-Joins-Exercises-in-R.html" title="dplyr Joins Exercises"><span class="progress-dot"></span>dplyr Joins Exercises</a></li><li data-subkey="sec7sub5"><a href="/dplyr-Window-Functions-Exercises-in-R.html" title="dplyr Window Functions Exercises"><span class="progress-dot"></span>dplyr Window Functions Exercises</a></li><li data-subkey="sec7sub5"><a href="/forcats-Exercises-in-R.html" title="forcats Exercises"><span class="progress-dot"></span>forcats Exercises</a></li><li data-subkey="sec7sub5"><a href="/ggplot2-Bar-Chart-Exercises-in-R.html" title="ggplot2 Bar Chart Exercises"><span class="progress-dot"></span>ggplot2 Bar Chart Exercises</a></li><li data-subkey="sec7sub5"><a href="/ggplot2-Color-Scales-Exercises-in-R.html" title="ggplot2 Color Scales Exercises"><span class="progress-dot"></span>ggplot2 Color Scales Exercises</a></li><li data-subkey="sec7sub5"><a href="/ggplot2-Exercises-in-R.html" title="ggplot2 Exercises"><span class="progress-dot"></span>ggplot2 Exercises</a></li><li data-subkey="sec7sub5"><a href="/ggplot2-Facets-Exercises-in-R.html" title="ggplot2 Facets Exercises"><span class="progress-dot"></span>ggplot2 Facets Exercises</a></li><li data-subkey="sec7sub5"><a href="/ggplot2-Heatmap-Exercises-in-R.html" title="ggplot2 Heatmap Exercises"><span class="progress-dot"></span>ggplot2 Heatmap Exercises</a></li><li data-subkey="sec7sub5"><a href="/ggplot2-Themes-Exercises-in-R.html" title="ggplot2 Themes Exercises"><span class="progress-dot"></span>ggplot2 Themes Exercises</a></li><li data-subkey="sec7sub5"><a href="/gt-Tables-Exercises-in-R.html" title="gt Tables Exercises"><span class="progress-dot"></span>gt Tables Exercises</a></li><li data-subkey="sec7sub5"><a href="/leaflet-Exercises-in-R.html" title="leaflet Exercises"><span class="progress-dot"></span>leaflet Exercises</a></li><li data-subkey="sec7sub5"><a href="/lubridate-Exercises-in-R.html" title="lubridate Exercises"><span class="progress-dot"></span>lubridate Exercises</a></li><li data-subkey="sec7sub5"><a href="/plotly-Exercises-in-R.html" title="plotly Exercises"><span class="progress-dot"></span>plotly Exercises</a></li><li data-subkey="sec7sub5"><a href="/purrr-Exercises-in-R.html" title="purrr Exercises"><span class="progress-dot"></span>purrr Exercises</a></li><li data-subkey="sec7sub5"><a href="/readr-Exercises-in-R.html" title="readr Exercises"><span class="progress-dot"></span>readr Exercises</a></li><li data-subkey="sec7sub5"><a href="/stringr-Exercises-in-R.html" title="stringr Exercises"><span class="progress-dot"></span>stringr Exercises</a></li><li data-subkey="sec7sub5"><a href="/testthat-Exercises-in-R.html" title="testthat Exercises"><span class="progress-dot"></span>testthat Exercises</a></li><li data-subkey="sec7sub5"><a href="/tidymodels-Exercises-in-R.html" title="tidymodels Exercises"><span class="progress-dot"></span>tidymodels Exercises</a></li><li data-subkey="sec7sub5"><a href="/tidyr-Exercises-in-R.html" title="tidyr Exercises"><span class="progress-dot"></span>tidyr Exercises</a></li><li data-subkey="sec7sub5"><a href="/tidyr-Nest-Unnest-Exercises-in-R.html" title="tidyr Nest/Unnest Exercises"><span class="progress-dot"></span>tidyr Nest/Unnest Exercises</a></li><li data-subkey="sec7sub5"><a href="/tidyr-Pivot-Exercises-in-R.html" title="tidyr Pivot Exercises"><span class="progress-dot"></span>tidyr Pivot Exercises</a></li><li data-subkey="sec7sub5"><a href="/tidyverse-Exercises-in-R.html" title="Tidyverse Exercises"><span class="progress-dot"></span>Tidyverse Exercises</a></li><li data-subkey="sec7sub5"><a href="/Date-Time-Manipulation-Exercises-in-R.html" title="Date-Time Manipulation Exercises"><span class="progress-dot"></span>Date-Time Manipulation Exercises</a></li><li data-subkey="sec7sub5"><a href="/Loops-vs-Vectorization-Exercises-in-R.html" title="Loops vs Vectorization Exercises"><span class="progress-dot"></span>Loops vs Vectorization Exercises</a></li></ul></li></ul><div class="sidebar-subscribe"><p>Stay up-to-date. <a href="https://docs.google.com/forms/d/1xkMYkLNFU9U39Dd8S_2JC0p8B5t6_Yq6zUQjanQQJpY/viewform">Subscribe!</a></p><p><a href="https://docs.google.com/forms/d/13GrkCFcNa-TOIllQghsz2SIEbc-YqY9eJX02B19l5Ow/viewform">Chat!</a></p></div></div><div class="sidebar-panel" data-panel="tools"><ul class="sidebar-tools-list list-unstyled"><li class="sidebar-divider"><span class="subsec-chevron">▼</span> Calculators</li><li><a href="/tools/ab-test-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="3.5" width="4" height="9" rx="0.5"/><rect x="9.5" y="3.5" width="4" height="9" rx="0.5"/></svg></span><span class="tool-label">A/B Test Calculator</span></a></li><li><a href="/tools/t-test-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12c1.5 0 2-6 3.5-6S7 12 8.5 12"/><path d="M6 12c1.5 0 2-6 3.5-6s2 6 3.5 6"/><path d="M2 12.5h12"/></svg></span><span class="tool-label">t-Test Calculator</span></a></li><li><a href="/tools/chi-square-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 3c4 3.5 4 6.5 8 10"/><path d="M12 3c-4 3.5-4 6.5-8 10"/></svg></span><span class="tool-label">Chi-Square Test</span></a></li><li><a href="/tools/confidence-interval-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 4v8M3.5 4H5M3.5 12H5"/><circle cx="8" cy="8" r="1.4" fill="currentColor" stroke="none"/><path d="M12.5 4v8M12.5 4H11M12.5 12H11"/></svg></span><span class="tool-label">Confidence Interval</span></a></li><li><a href="/tools/bootstrap-ci-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13 8a5 5 0 1 1-1.4-3.5"/><path d="M13 2.5V5h-2.5"/></svg></span><span class="tool-label">Bootstrap CI</span></a></li><li><a href="/tools/effect-size-converter.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 5.5h11M11 3l2.5 2.5L11 8"/><path d="M13.5 10.5h-11M5 8l-2.5 2.5L5 13"/></svg></span><span class="tool-label">Effect Size Converter</span></a></li><li><a href="/tools/power-analysis.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 2L4 9h3.5L7 14l5-7H8.5z"/></svg></span><span class="tool-label">Power Analysis</span></a></li><li><a href="/tools/survival-power-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 3.5h3.5V7H9v3.5h3.5V13H14"/></svg></span><span class="tool-label">Survival Power</span></a></li><li><a href="/tools/type-i-ii-error-visualizer.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12c1.5 0 2-2 3.5-2S7 12 8 12s2-8 3.5-8S13 12 14.5 12"/><line x1="8" y1="2" x2="8" y2="14" stroke-dasharray="2 2"/></svg></span><span class="tool-label">Type I / II Error</span></a></li><li><a href="/tools/z-score-percentile.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 13c2 0 3-1 4-3s1.5-6 2-6 .5 6 2 6 2.5 0 4 0"/><path d="M2 13.5h12"/></svg></span><span class="tool-label">Z-Score & Percentile</span></a></li><li><a href="/tools/equivalence-noninferiority-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3.5v9M13 3.5v9"/><path d="M5.5 8h5"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/></svg></span><span class="tool-label">Equivalence / NI</span></a></li><li><a href="/tools/outlier-detection-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5" cy="10" r="1" fill="currentColor" stroke="none"/><circle cx="7.5" cy="8.5" r="1" fill="currentColor" stroke="none"/><circle cx="5.5" cy="12.5" r="1" fill="currentColor" stroke="none"/><circle cx="12" cy="4" r="2.4"/></svg></span><span class="tool-label">Outlier Detection</span></a></li><li><a href="/tools/roc-auc-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 13.5L13.5 2.5" stroke-dasharray="2 2"/><path d="M2.5 13.5C2.5 7 7 2.5 13.5 2.5"/></svg></span><span class="tool-label">ROC / AUC</span></a></li><li class="sidebar-divider"><span class="subsec-chevron">▼</span> Bayesian</li><li><a href="/tools/bayes-theorem-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 8h4M7 8l4-4.5M7 8l4 4.5"/><circle cx="3" cy="8" r="1.2" fill="currentColor" stroke="none"/><circle cx="12" cy="3.5" r="1.2" fill="currentColor" stroke="none"/><circle cx="12" cy="12.5" r="1.2" fill="currentColor" stroke="none"/></svg></span><span class="tool-label">Bayes Theorem</span></a></li><li><a href="/tools/bayes-factor-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v9.5M4 4.5h8"/><path d="M4 4.5L2.5 8h3zM12 4.5L10.5 8h3z"/><path d="M5.5 12.5h5"/></svg></span><span class="tool-label">Bayes Factor</span></a></li><li class="sidebar-divider"><span class="subsec-chevron">▼</span> Interpreters</li><li><a href="/tools/lm-output-interpreter.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 13.5L14 3"/><circle cx="4" cy="11.5" r="1" fill="currentColor" stroke="none"/><circle cx="7.5" cy="9" r="1" fill="currentColor" stroke="none"/><circle cx="11" cy="6.5" r="1" fill="currentColor" stroke="none"/></svg></span><span class="tool-label">lm() Output</span></a></li><li><a href="/tools/glm-output-interpreter.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 13C5 13 5 3 8 3s3 10 6 10"/><path d="M2 13.5h12"/></svg></span><span class="tool-label">glm() Output</span></a></li><li><a href="/tools/anova-output-interpreter.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 13V7M8 13V3.5M12.5 13V9"/><path d="M2 13.5h12"/></svg></span><span class="tool-label">ANOVA Output</span></a></li><li><a href="/tools/vif-interpreter.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="6" cy="8" r="3.6"/><circle cx="10" cy="8" r="3.6"/></svg></span><span class="tool-label">VIF / Multicollinearity</span></a></li><li><a href="/tools/confusion-matrix-interpreter.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="2.5" width="4.5" height="4.5"/><rect x="9" y="2.5" width="4.5" height="4.5"/><rect x="2.5" y="9" width="4.5" height="4.5"/><rect x="9" y="9" width="4.5" height="4.5"/></svg></span><span class="tool-label">Confusion Matrix</span></a></li><li><a href="/tools/diagnostic-plot-interpreter.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="M10.4 10.4L14 14"/><path d="M4.8 8l1.4-1.6L7.6 8l1.5-2"/></svg></span><span class="tool-label">Diagnostic Plots</span></a></li><li class="sidebar-divider"><span class="subsec-chevron">▼</span> Pickers</li><li><a href="/tools/normality-test-picker.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 13c2 0 3-1 4-3s1.5-6 2-6 .5 6 2 6 2.5 0 4 0"/><circle cx="13" cy="4" r="1.6" fill="currentColor" stroke="none"/></svg></span><span class="tool-label">Normality Test</span></a></li><li><a href="/tools/nonparametric-test-picker.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4" cy="11" r="1.2" fill="currentColor" stroke="none"/><circle cx="8" cy="7.5" r="1.2" fill="currentColor" stroke="none"/><circle cx="12" cy="4" r="1.2" fill="currentColor" stroke="none"/><path d="M3 13.5h10"/></svg></span><span class="tool-label">Non-Parametric Test</span></a></li><li><a href="/tools/multiple-testing-correction.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 4l2 2 3-3M2.5 8l2 2 3-3M2.5 12l2 2 3-3"/><path d="M10.5 4h3M10.5 8h3M10.5 12h3"/></svg></span><span class="tool-label">Multiple Testing</span></a></li><li class="sidebar-divider"><span class="subsec-chevron">▼</span> Time series</li><li><a href="/tools/ts-stationarity-calculator.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 8c1-3.5 2-3.5 3 0s2 3.5 3 0 1.8-2.2 2.8-1 2.2 1.6 3.2 1.4"/></svg></span><span class="tool-label">TS Stationarity</span></a></li><li class="sidebar-divider"><span class="subsec-chevron">▼</span> Utilities</li><li><a href="/tools/dag-confounder-picker.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="3.5" r="1.6"/><circle cx="3.5" cy="12" r="1.6"/><circle cx="12.5" cy="12" r="1.6"/><path d="M6.9 4.9L4.4 10.4M9.1 4.9l2.5 5.5M5.2 12h5.6"/></svg></span><span class="tool-label">DAG Confounder Picker</span></a></li><li><a href="/tools/reprex-builder.html"><span class="tool-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 4L2.5 8l3 4"/><path d="M10.5 4l3 4-3 4"/></svg></span><span class="tool-label">Reprex Builder</span></a></li></ul></div></div>
</div>
<main id="content" class="col-xs-12 col-sm-7">
<nav class="breadcrumb-nav" aria-label="Breadcrumb"><a href="/">Home</a> <span class="breadcrumb-sep">›</span> <span>Statistics</span> <span class="breadcrumb-sep">›</span> <span class="breadcrumb-current">Bootstrap in R: The boot Package, Step by Step</span></nav>
<!-- md2html:generated -->
<h1>Bootstrap in R: The boot Package, Step by Step</h1>
<p class="lead">The <a class="auto-link" href="broom-bootstrap-in-R.html" title="broom Bootstrap in R: Tidy Resampled Estimates">bootstrap resamples</a> your data with replacement to estimate confidence intervals and run hypothesis tests without assuming a <a class="auto-link" href="Normal-t-F-and-Chi-Squared-Distributions-in-R.html" title="Normal, t, F, and Chi-Squared in R: Understand Each Distribution and When It Arises">normal distribution</a>. The <code>boot</code> package in R turns the workflow into two calls: <code>boot()</code> to generate replicates and <code>boot.ci()</code> to extract BCa, percentile, basic, or normal intervals.</p>
<div class="post-byline" style="color:#6b7280;font-size:14px;margin:2px 0 18px 0;line-height:1.5;">By <strong>Selva Prabhakaran</strong> · Published July 9, 2026 · Last updated July 9, 2026</div>
<div class="engagement-header" data-difficulty="Intermediate" data-time="30" data-exercises="8" data-xp="120"></div>
<h2>How do you bootstrap in R with the boot package?</h2>
<p>The fastest way to see the bootstrap in action is to compute a 95% CI for a statistic that has no clean textbook formula. The median of a small sample fits: there is no closed-form CI, and its sampling distribution is rarely normal. Here is the entire bootstrap pipeline for the median MPG in <code>mtcars</code>.</p>
<p>The pattern is always the same: define a statistic function that takes data and an index vector, hand it to <code>boot()</code>, then pass the result to <code>boot.ci()</code>.</p>
<div class="webr-container" data-block-title="First bootstrap CI for median MPG">
<div class="webr-code-block">
<div class="webr-header"><div class="webr-header-left"><span class="webr-header-badge">R</span><span class="webr-header-label">First bootstrap CI for median MPG</span></div><div class="webr-header-right"><button type="button" class="webr-copy-btn" aria-label="Copy code" title="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button><button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run <span class="webr-run-shortcut">Ctrl+Enter</span></button></div></div>
<div class="webr-editor" data-language="r"><span class="cl"><span class="nf">library</span>(boot)</span>
<span class="cl"><span class="nf">set.seed</span>(<span class="m">42</span>)</span>
<span class="cl"></span>
<span class="cl">median_stat <span class="o"><-</span> <span class="kr">function</span>(d, i) <span class="nf">median</span>(d[i])</span>
<span class="cl">boot_out <span class="o"><-</span> <span class="nf">boot</span>(data <span class="o">=</span> mtcars<span class="o">$</span>mpg, statistic <span class="o">=</span> median_stat, R <span class="o">=</span> <span class="m">2000</span>)</span>
<span class="cl"></span>
<span class="cl"><span class="nf">boot.ci</span>(boot_out, type <span class="o">=</span> <span class="nf">c</span>(<span class="s">"perc"</span>, <span class="s">"bca"</span>))</span>
<span class="cl"><span class="c1">#> BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS</span></span>
<span class="cl"><span class="c1">#> Based on 2000 bootstrap replicates</span></span>
<span class="cl"><span class="c1">#></span></span>
<span class="cl"><span class="c1">#> Intervals :</span></span>
<span class="cl"><span class="c1">#> Level Percentile BCa</span></span>
<span class="cl"><span class="c1">#> 95% (16.40, 21.40) (16.40, 22.05)</span></span></div>
<div class="webr-buttons">
<button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run</button>
<button class="btn btn-sm btn-default webr-reset-btn" onclick="resetWebR(this)">↺ Reset</button>
</div>
<pre class="webr-output"></pre>
</div>
<div class="webr-plot-output"></div>
</div>
<p>Two thousand resamples produced two 95% intervals for the median. The percentile CI runs from 16.4 to 21.4 MPG. The BCa CI runs slightly wider on the upper end (22.05) because BCa adjusts for <a class="auto-link" href="Descriptive-Statistics-in-R.html" title="Descriptive Statistics in R: The 8 Numbers That Tell You What Your Data Is Doing">skewness</a> in the <a class="auto-link" href="Bootstrap-Confidence-Intervals-in-R.html" title="Bootstrap CIs in R: Distribution-Free Confidence Intervals for Any Statistic">bootstrap distribution</a>. Both agree the true population median plausibly sits in this range, and you got there without a single distributional assumption.</p>
<div class="callout callout-tip"><div class="callout-label">Tip</div><div class="callout-body"><strong>Always set a seed before <code>boot()</code>.</strong> Two <code>boot()</code> calls with the same seed produce identical replicates, which means your CIs are reproducible across reviewers and across re-runs. Pick a fresh integer for each major example so you do not silently reuse the same random pattern.</div></div>
<p>The <code>statistic</code> function has a strict signature: first argument is the data, second is an integer index vector. Inside the function, <code>d[i]</code> (for vectors) or <code>d[i, ]</code> (for data frames) builds the bootstrap sample. <code>boot()</code> calls your function <code>R</code> times with random indices and stores every replicate in <code>boot_out$t</code>.</p>
<section class="tryit-block">
<p><strong>Try it:</strong> Write a function <code>ex_mean_stat()</code> that returns the mean instead of the median, then bootstrap a 95% percentile CI for the mean MPG. Use 1000 replicates and seed <code>123</code>.</p>
<div class="webr-container" data-block-title="Your turn: bootstrap a CI for the mean">
<div class="webr-code-block">
<div class="webr-header"><div class="webr-header-left"><span class="webr-header-badge">R</span><span class="webr-header-label">Your turn: bootstrap a CI for the mean</span></div><div class="webr-header-right"><button type="button" class="webr-copy-btn" aria-label="Copy code" title="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button><button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run <span class="webr-run-shortcut">Ctrl+Enter</span></button></div></div>
<div class="webr-editor" data-language="r"><span class="cl"><span class="c1"># Try it: bootstrap a CI for the mean MPG</span></span>
<span class="cl">ex_mean_stat <span class="o"><-</span> <span class="kr">function</span>(d, i) {</span>
<span class="cl"> <span class="c1"># your code here</span></span>
<span class="cl">}</span>
<span class="cl"></span>
<span class="cl"><span class="nf">set.seed</span>(<span class="m">123</span>)</span>
<span class="cl">ex_boot <span class="o"><-</span> <span class="nf">boot</span>(mtcars<span class="o">$</span>mpg, ex_mean_stat, R <span class="o">=</span> <span class="m">1000</span>)</span>
<span class="cl"><span class="nf">boot.ci</span>(ex_boot, type <span class="o">=</span> <span class="s">"perc"</span>)</span>
<span class="cl"><span class="c1">#> Expected: a 95% CI roughly (18.0, 22.3)</span></span></div>
<div class="webr-buttons">
<button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run</button>
<button class="btn btn-sm btn-default webr-reset-btn" onclick="resetWebR(this)">↺ Reset</button>
</div>
<pre class="webr-output"></pre>
</div>
<div class="webr-plot-output"></div>
</div>
<details>
<summary>Click to reveal solution</summary>
<div class="webr-container" data-block-title="Mean MPG bootstrap solution">
<div class="webr-code-block">
<div class="webr-header"><div class="webr-header-left"><span class="webr-header-badge">R</span><span class="webr-header-label">Mean MPG bootstrap solution</span></div><div class="webr-header-right"><button type="button" class="webr-copy-btn" aria-label="Copy code" title="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button><button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run <span class="webr-run-shortcut">Ctrl+Enter</span></button></div></div>
<div class="webr-editor" data-language="r"><span class="cl">ex_mean_stat <span class="o"><-</span> <span class="kr">function</span>(d, i) <span class="nf">mean</span>(d[i])</span>
<span class="cl"></span>
<span class="cl"><span class="nf">set.seed</span>(<span class="m">123</span>)</span>
<span class="cl">ex_boot <span class="o"><-</span> <span class="nf">boot</span>(mtcars<span class="o">$</span>mpg, ex_mean_stat, R <span class="o">=</span> <span class="m">1000</span>)</span>
<span class="cl"><span class="nf">boot.ci</span>(ex_boot, type <span class="o">=</span> <span class="s">"perc"</span>)</span>
<span class="cl"><span class="c1">#> Level Percentile</span></span>
<span class="cl"><span class="c1">#> 95% (18.04, 22.27)</span></span></div>
<div class="webr-buttons">
<button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run</button>
<button class="btn btn-sm btn-default webr-reset-btn" onclick="resetWebR(this)">↺ Reset</button>
</div>
<pre class="webr-output"></pre>
</div>
<div class="webr-plot-output"></div>
</div>
<p><strong>Explanation:</strong> Replacing <code>median</code> with <code>mean</code> is the only change. Every other line stays the same, which is the whole point of the boot package: the workflow is statistic-agnostic.</p>
</details>
</section>
<h2>Why does bootstrap work without distributional assumptions?</h2>
<p>Classical confidence intervals lean on a formula like $\bar{x} \pm 1.96 \cdot s/\sqrt{n}$. That formula is correct only if the <a class="auto-link" href="Central-Limit-Theorem-in-R.html" title="Central Limit Theorem in R: Simulate It From Skewed, Bimodal, and Uniform Distributions">sampling distribution of the mean</a> is approximately normal, which itself requires assumptions about the population or a sufficiently large sample. The bootstrap sidesteps that machinery by replacing "what would the population look like?" with "the sample is the best guess we have for the population."</p>
<p>Mathematically, the bootstrap uses the <strong>empirical distribution function</strong>, the discrete distribution that puts probability $1/n$ on each observed data point. Sampling with replacement from your data is sampling from that empirical distribution. As $n$ grows, it converges to the true population, so resampled statistics converge to true sampling statistics.</p>
<p>$$\hat{F}_n(x) = \frac{1}{n} \sum_{i=1}^{n} \mathbb{1}\{x_i \leq x\}$$</p>
<p>Where:</p>
<ul>
<li>$\hat{F}_n(x)$ = the empirical distribution function evaluated at $x$</li>
<li>$n$ = sample size</li>
<li>$\mathbb{1}\{x_i \leq x\}$ = an indicator that is 1 if $x_i \leq x$, else 0</li>
</ul>
<p>If you are not interested in the math, skip to the next paragraph. The practical takeaway is unchanged: every replicate is a "what could my sample have looked like?" scenario, and the spread of replicates is the spread of the statistic.</p>
<p><img src="screenshots/Bootstrap-in-R-resampling-flow.webp" alt="How the bootstrap turns one sample into an inference" class="img-responsive img-zoomable" loading="lazy" width="2248" height="638" /></p>
<p><em>Figure 1: The bootstrap resamples one observed sample many times to build a distribution of any statistic.</em></p>
<p>The bootstrap distribution is just the histogram of <code>boot_out$t</code>. Plotting it tells you the shape of the sampling distribution, the centre (your point estimate), and the spread (the standard error).</p>
<div class="webr-container" data-block-title="Visualise the bootstrap distribution">
<div class="webr-code-block">
<div class="webr-header"><div class="webr-header-left"><span class="webr-header-badge">R</span><span class="webr-header-label">Visualise the bootstrap distribution</span></div><div class="webr-header-right"><button type="button" class="webr-copy-btn" aria-label="Copy code" title="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button><button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run <span class="webr-run-shortcut">Ctrl+Enter</span></button></div></div>
<div class="webr-editor" data-language="r"><span class="cl"><span class="nf">hist</span>(boot_out<span class="o">$</span>t,</span>
<span class="cl"> breaks <span class="o">=</span> <span class="m">30</span>,</span>
<span class="cl"> col <span class="o">=</span> <span class="s">"steelblue"</span>,</span>
<span class="cl"> border <span class="o">=</span> <span class="s">"white"</span>,</span>
<span class="cl"> main <span class="o">=</span> <span class="s">"Bootstrap distribution of median(mpg)"</span>,</span>
<span class="cl"> xlab <span class="o">=</span> <span class="s">"Bootstrap median MPG"</span>)</span>
<span class="cl"><span class="nf">abline</span>(v <span class="o">=</span> <span class="nf">median</span>(mtcars<span class="o">$</span>mpg), col <span class="o">=</span> <span class="s">"red"</span>, lwd <span class="o">=</span> <span class="m">2</span>)</span>
<span class="cl"><span class="c1">#> Histogram with a peak near 19, the red vertical at the observed median</span></span></div>
<div class="webr-buttons">
<button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run</button>
<button class="btn btn-sm btn-default webr-reset-btn" onclick="resetWebR(this)">↺ Reset</button>
</div>
<pre class="webr-output"></pre>
</div>
<div class="webr-plot-output"></div>
</div>
<p>The peak of the histogram lines up with the observed median (red line), confirming the bootstrap is unbiased on average. The width of the histogram is the bootstrap standard error: roughly the standard deviation of the replicates. If you saw a wildly skewed shape or two distinct modes, you would know that a normal-based CI would be wrong here, even before computing the interval.</p>
<div class="callout callout-insight"><div class="callout-label">Key Insight</div><div class="callout-body"><strong>The bootstrap replaces "trust the formula" with "trust the data."</strong> Classical CIs require the sampling distribution to be approximately normal; the bootstrap simulates the sampling distribution from the data itself. The trade-off is computation time, which is cheap, against assumptions, which are expensive when wrong.</div></div>
<section class="tryit-block">
<p><strong>Try it:</strong> The bootstrap standard error is just the standard deviation of replicates. Compute it two ways and check they agree: with <code>sd(boot_out$t)</code> and by reading the <code>std. error</code> printed by <code>boot_out</code>.</p>
<div class="webr-container" data-block-title="Your turn: two views of the bootstrap SE">
<div class="webr-code-block">
<div class="webr-header"><div class="webr-header-left"><span class="webr-header-badge">R</span><span class="webr-header-label">Your turn: two views of the bootstrap SE</span></div><div class="webr-header-right"><button type="button" class="webr-copy-btn" aria-label="Copy code" title="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button><button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run <span class="webr-run-shortcut">Ctrl+Enter</span></button></div></div>
<div class="webr-editor" data-language="r"><span class="cl"><span class="c1"># Try it: SE from sd() of replicates</span></span>
<span class="cl">ex_se_manual <span class="o"><-</span> <span class="c1"># your code here</span></span>
<span class="cl"></span>
<span class="cl"><span class="c1"># Compare to:</span></span>
<span class="cl">boot_out</span>
<span class="cl"><span class="c1">#> Expected: ex_se_manual matches the std. error printed by boot_out</span></span></div>
<div class="webr-buttons">
<button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run</button>
<button class="btn btn-sm btn-default webr-reset-btn" onclick="resetWebR(this)">↺ Reset</button>
</div>
<pre class="webr-output"></pre>
</div>
<div class="webr-plot-output"></div>
</div>
<details>
<summary>Click to reveal solution</summary>
<div class="webr-container" data-block-title="Bootstrap SE solution">
<div class="webr-code-block">
<div class="webr-header"><div class="webr-header-left"><span class="webr-header-badge">R</span><span class="webr-header-label">Bootstrap SE solution</span></div><div class="webr-header-right"><button type="button" class="webr-copy-btn" aria-label="Copy code" title="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button><button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run <span class="webr-run-shortcut">Ctrl+Enter</span></button></div></div>
<div class="webr-editor" data-language="r"><span class="cl">ex_se_manual <span class="o"><-</span> <span class="nf">sd</span>(boot_out<span class="o">$</span>t)</span>
<span class="cl">ex_se_manual</span>
<span class="cl"><span class="c1">#> [1] 1.412</span></span>
<span class="cl"></span>
<span class="cl"><span class="nf">print</span>(boot_out)</span>
<span class="cl"><span class="c1">#> Bootstrap Statistics :</span></span>
<span class="cl"><span class="c1">#> original bias std. error</span></span>
<span class="cl"><span class="c1">#> t1* 19.2 0.0723 1.412</span></span></div>
<div class="webr-buttons">
<button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run</button>
<button class="btn btn-sm btn-default webr-reset-btn" onclick="resetWebR(this)">↺ Reset</button>
</div>
<pre class="webr-output"></pre>
</div>
<div class="webr-plot-output"></div>
</div>
<p><strong>Explanation:</strong> <code>boot_out$t</code> is the matrix of replicates. Its column standard deviation is the bootstrap SE that <code>boot_out</code> prints. Two views, same number.</p>
</details>
</section>
<h2>Which bootstrap confidence interval should you use?</h2>
<p>The boot package offers five interval types: percentile, basic, normal, BCa, and studentized. The first four are one-line calls; studentized needs an extra variance estimate per replicate. For most applied work, the choice narrows to BCa or percentile.</p>
<p><img src="screenshots/Bootstrap-in-R-ci-decision.webp" alt="Which bootstrap CI should you pick?" class="img-responsive img-zoomable" loading="lazy" width="1796" height="806" /></p>
<p><em>Figure 2: A quick decision rule for picking the right <code>boot.ci()</code> type.</em></p>
<p>Asking for all four at once is a quick way to compare them on the same data. A large gap between them is a warning that one or more is misbehaving.</p>
<div class="webr-container" data-block-title="Compare four CI types side by side">
<div class="webr-code-block">
<div class="webr-header"><div class="webr-header-left"><span class="webr-header-badge">R</span><span class="webr-header-label">Compare four CI types side by side</span></div><div class="webr-header-right"><button type="button" class="webr-copy-btn" aria-label="Copy code" title="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button><button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run <span class="webr-run-shortcut">Ctrl+Enter</span></button></div></div>
<div class="webr-editor" data-language="r"><span class="cl">ci_all <span class="o"><-</span> <span class="nf">boot.ci</span>(boot_out, type <span class="o">=</span> <span class="nf">c</span>(<span class="s">"norm"</span>, <span class="s">"basic"</span>, <span class="s">"perc"</span>, <span class="s">"bca"</span>))</span>
<span class="cl">ci_all</span>
<span class="cl"><span class="c1">#> Intervals :</span></span>
<span class="cl"><span class="c1">#> Level Normal Basic</span></span>
<span class="cl"><span class="c1">#> 95% (16.36, 21.91 ) (16.40, 21.40 )</span></span>
<span class="cl"><span class="c1">#></span></span>
<span class="cl"><span class="c1">#> Level Percentile BCa</span></span>
<span class="cl"><span class="c1">#> 95% (16.40, 21.40 ) (16.40, 22.05 )</span></span></div>
<div class="webr-buttons">
<button class="btn btn-sm btn-primary webr-run-btn" onclick="runWebR(this)">▶ Run</button>
<button class="btn btn-sm btn-default webr-reset-btn" onclick="resetWebR(this)">↺ Reset</button>
</div>
<pre class="webr-output"></pre>
</div>
<div class="webr-plot-output"></div>
</div>