Repository navigation
Expand file tree
/
Copy pathTime-Series-Analysis-With-R.html
More file actions
335 lines (309 loc) · 125 KB
/
Copy pathTime-Series-Analysis-With-R.html
File metadata and controls
335 lines (309 loc) · 125 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
<!DOCTYPE html>
<html lang="en">
<head>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:1500});</script>
<script defer src="/www/consent-banner.js?v=2"></script>
<title>Time Series Analysis in R: A Complete Walkthrough</title>
<meta charset="utf-8">
<meta name="Description" content="Analyze time series data in R with decomposition, stationarity tests, and ACF/PACF analysis. Foundation tutorial for forecasting and modeling.">
<meta name="Keywords" content="R, Tutorial, Machine learning, Statistics, Data Mining, Analytics, Data science, Linear Regression, Logistic Regression, Time series, Forecasting">
<meta name="Distribution" content="Global">
<meta name="Author" content="Selva Prabhakaran">
<meta name="Robots" content="index, follow">
<!-- Open Graph -->
<meta property="og:title" content="Time Series Analysis in R: A Complete Walkthrough">
<meta property="og:description" content="Analyze time series data in R with decomposition, stationarity tests, and ACF/PACF analysis. Foundation tutorial for forecasting and modeling.">
<meta property="og:type" content="article">
<meta property="og:url" content="https://r-statistics.co/Time-Series-Analysis-With-R.html">
<meta property="og:site_name" content="r-statistics.co">
<meta property="og:image" content="https://r-statistics.co/screenshots/iconb-64.png?v=2">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Time Series Analysis in R: A Complete Walkthrough">
<meta name="twitter:description" content="Analyze time series data in R with decomposition, stationarity tests, and ACF/PACF analysis. Foundation tutorial for forecasting and modeling.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="/favicon.ico" sizes="any"><link rel="icon" href="/favicon.svg" type="image/svg+xml"><link rel="apple-touch-icon" href="/apple-touch-icon.png"><link rel="manifest" href="/site.webmanifest"><meta name="theme-color" content="#1F6B4A">
<link rel="canonical" href="https://r-statistics.co/Time-Series-Analysis-With-R.html">
<link href="www/bootstrap.min.css" rel="stylesheet">
<link href="www/highlight.css" rel="stylesheet">
<link href="css/main.css?v=20" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter+Tight:wght@500;600;700&family=Inter:wght@400;450;500;600;700&display=swap" rel="stylesheet">
<link href="/www/tutorial-jel.css?v=8" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Inconsolata:400,700'
rel='stylesheet' type='text/css'>
<!-- Color Script -->
<style type="text/css">
a {
color: #3675C5;
color: rgb(25, 145, 248);
color: #4582ec;
color: #3F73D8;
}
li {
line-height: 1.65;
}
/* reduce spacing around math formula*/
.MathJax_Display {
margin: 0em 0em;
}
</style>
<!-- Add Google search -->
<script language="Javascript" type="text/javascript">
function my_search_google()
{
var query = document.getElementById("my-google-search").value;
window.open("https://google.com/search?q=" + query
+ "%20site:" + "https://r-statistics.co");
}
</script>
<!-- JSON-LD Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": ["TechArticle", "LearningResource"],
"headline": "Time Series Analysis in R - A Complete Beginner's Guide",
"description": "Analyze time series data in R with decomposition, stationarity tests, and ACF/PACF analysis. Foundation tutorial for forecasting and modeling.",
"author": {"@type": "Person", "name": "Selva Prabhakaran"},
"publisher": {"@type": "Organization", "name": "r-statistics.co"},
"url": "https://r-statistics.co/Time-Series-Analysis-With-R.html",
"datePublished": "2016-01-01",
"dateModified": "2026-03-29",
"inLanguage": "en",
"educationalLevel": "Intermediate",
"programmingLanguage": "R"
}
</script>
<link rel="stylesheet" href="/www/site-nav.css?v=19"><style id="snav-rail-css">@media(min-width:768px){body.tools-rail #nav{width:64px;min-width:64px;padding-right:0}body.tools-rail #content{width:calc(100% - 64px - 16.667%)}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 .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 .continue-chip,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:#8a90a0;padding:0 10px 8px}.rail-fold svg{display:none}.rail-fold .rf-a{display:block}body.tools-rail .rail-fold .rf-b{display:block}.rail-fold:hover{color:#0d1117}.rail-fold .rf-b{display:none;font-size:15px}@media(max-width:767px){.rail-fold{display:none}}</style>
</head>
<body class="layout-v2" data-page="tutorial"><script>try{if(localStorage.getItem('rsc-tools-rail')==='1')document.body.classList.add('tools-rail')}catch(e){}</script>
<div class="mobile-sidebar-overlay" id="mobile-sidebar"><div class="mobile-sidebar-panel"><button class="mobile-sidebar-close" id="mobile-sidebar-close">×</button><div class="mnav-section"><h6 class="mnav-title">Navigate</h6><a class="mnav-link" href="/roadmap/">Courses</a><a class="mnav-link" href="/tutorials/">Tutorials</a><a class="mnav-link" href="/exercises/">Practice</a><a class="mnav-link" href="/pricing.html">Pricing</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"></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/">Courses <span class="ex-caret" aria-hidden="true">▾</span></a><a href="/tutorials/">Tutorials</a><a href="/exercises/">Practice <span class="ex-caret" aria-hidden="true">▾</span></a><a href="/pricing.html">Pricing</a><a href="/tools/">Tools</a></div><div class="snav-right"><form class="snav-search" role="search" aria-label="Search r-statistics.co" onsubmit="var q=(this.q.value||'').trim();if(q)window.open('https://www.google.com/search?q='+encodeURIComponent(q+' site:r-statistics.co'));return false"><svg class="snav-sicon" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.5" y2="16.5"/></svg><input type="search" name="q" placeholder="Search" aria-label="Search r-statistics.co"></form><button class="snav-sbtn" data-snav-search type="button" aria-label="Search"><svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.5" y2="16.5"/></svg></button><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"></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="Toggle sidebar" aria-label="Toggle sidebar" onclick="var r=document.body.classList.toggle('tools-rail');try{localStorage.setItem('rsc-tools-rail',r?'1':'0')}catch(e){}"><svg class="rf-a" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2.5"/><line x1="9.5" y1="4" x2="9.5" y2="20"/><path d="m16.5 9.5-2.5 2.5 2.5 2.5"/></svg><svg class="rf-b" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2.5"/><line x1="9.5" y1="4" x2="9.5" y2="20"/><path d="m14 9.5 2.5 2.5-2.5 2.5"/></svg></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 & Communication</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="/Regression-Tables-in-R.html" title="Regression Tables (3 packages)"><span class="progress-dot"></span>Regression Tables (3 packages)</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub6" data-collapsed="false"><span class="subsec-chevron">▼</span> Regression in Practice</li><li data-subkey="sec2sub6"><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="sec2sub6"><a href="/Multiple-Regression-in-R.html" title="Multiple Regression"><span class="progress-dot"></span>Multiple Regression</a></li><li data-subkey="sec2sub6"><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="sec2sub6"><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="sec2sub6"><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="sec2sub6"><a href="/Interaction-Effects-in-R.html" title="Interaction Effects"><span class="progress-dot"></span>Interaction Effects</a></li><li data-subkey="sec2sub6"><a href="/Regression-Diagnostics-in-R.html" title="Regression Diagnostics"><span class="progress-dot"></span>Regression Diagnostics</a></li><li data-subkey="sec2sub6"><a href="/Variable-Selection-in-R.html" title="Variable Selection"><span class="progress-dot"></span>Variable Selection</a></li><li data-subkey="sec2sub6"><a href="/Polynomial-and-Spline-Regression-in-R.html" title="Polynomial & Splines"><span class="progress-dot"></span>Polynomial & Splines</a></li><li data-subkey="sec2sub6"><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="sec2sub6"><a href="/Robust-Regression-in-R.html" title="Robust Regression (rlm)"><span class="progress-dot"></span>Robust Regression (rlm)</a></li><li data-subkey="sec2sub6"><a href="/Quantile-Regression-in-R-2.html" title="Quantile Regression"><span class="progress-dot"></span>Quantile Regression</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub7" data-collapsed="false"><span class="subsec-chevron">▼</span> ANOVA & Experiments</li><li data-subkey="sec2sub7"><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="sec2sub7"><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="sec2sub7"><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="sec2sub7"><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="sec2sub7"><a href="/ANCOVA-in-R.html" title="ANCOVA"><span class="progress-dot"></span>ANCOVA</a></li><li data-subkey="sec2sub7"><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="sec2sub7"><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="sec2sub7"><a href="/AB-Testing-in-R.html" title="A/B Testing"><span class="progress-dot"></span>A/B Testing</a></li><li data-subkey="sec2sub7"><a href="/MANOVA-in-R.html" title="MANOVA"><span class="progress-dot"></span>MANOVA</a></li><li data-subkey="sec2sub7"><a href="/Mixed-ANOVA-in-R.html" title="Mixed ANOVA"><span class="progress-dot"></span>Mixed ANOVA</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub8" data-collapsed="false"><span class="subsec-chevron">▼</span> GLMs & Categorical Data</li><li data-subkey="sec2sub8"><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="sec2sub8"><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="sec2sub8"><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="sec2sub8"><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="sec2sub8"><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="sec2sub8"><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="sec2sub8"><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="sec2sub8"><a href="/Poisson-Regression-in-R.html" title="Poisson Regression"><span class="progress-dot"></span>Poisson Regression</a></li><li data-subkey="sec2sub8"><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="sec2sub8"><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 class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub9" data-collapsed="false"><span class="subsec-chevron">▼</span> Multivariate Methods</li><li data-subkey="sec2sub9"><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="sec2sub9"><a href="/PCA-in-R.html" title="PCA with prcomp()"><span class="progress-dot"></span>PCA with prcomp()</a></li><li data-subkey="sec2sub9"><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="sec2sub9"><a href="/factoextra-and-FactoMineR.html" title="factoextra (PCA + Clusters)"><span class="progress-dot"></span>factoextra (PCA + Clusters)</a></li><li data-subkey="sec2sub9"><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="sec2sub9"><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="sec2sub9"><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="sec2sub9"><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="sec2sub9"><a href="/Correspondence-Analysis-in-R.html" title="Correspondence Analysis"><span class="progress-dot"></span>Correspondence Analysis</a></li><li data-subkey="sec2sub9"><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 class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub10" data-collapsed="false"><span class="subsec-chevron">▼</span> Nonparametric & Resampling</li><li data-subkey="sec2sub10"><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="sec2sub10"><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="sec2sub10"><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="sec2sub10"><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="sec2sub10"><a href="/Friedman-Test-in-R.html" title="Friedman Test"><span class="progress-dot"></span>Friedman Test</a></li><li data-subkey="sec2sub10"><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="sec2sub10"><a href="/Bootstrap-in-R.html" title="Bootstrap (boot package)"><span class="progress-dot"></span>Bootstrap (boot package)</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub11" data-collapsed="false"><span class="subsec-chevron">▼</span> Linear Algebra for Statistics</li><li data-subkey="sec2sub11"><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="sec2sub11"><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="sec2sub11"><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="sec2sub11"><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="sec2sub11"><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="sec2sub11"><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="sec2sub11"><a href="/Quadratic-Forms-in-R.html" title="Quadratic Forms"><span class="progress-dot"></span>Quadratic Forms</a></li><li data-subkey="sec2sub11"><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 class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub12" data-collapsed="false"><span class="subsec-chevron">▼</span> Statistical Theory</li><li data-subkey="sec2sub12"><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="sec2sub12"><a href="/Sufficient-Statistics-in-R.html" title="Sufficient Statistics"><span class="progress-dot"></span>Sufficient Statistics</a></li><li data-subkey="sec2sub12"><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="sec2sub12"><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="sec2sub12"><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="sec2sub12"><a href="/Asymptotic-Theory-in-R-2.html" title="Asymptotic Theory"><span class="progress-dot"></span>Asymptotic Theory</a></li><li data-subkey="sec2sub12"><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="sec2sub12"><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="sec2sub12"><a href="/Decision-Theory-in-R.html" title="Decision Theory"><span class="progress-dot"></span>Decision Theory</a></li><li data-subkey="sec2sub12"><a href="/Asymptotic-Relative-Efficiency-in-R.html" title="Asymptotic Relative Efficiency"><span class="progress-dot"></span>Asymptotic Relative Efficiency</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub13" data-collapsed="false"><span class="subsec-chevron">▼</span> Bayesian Foundations</li><li data-subkey="sec2sub13"><a href="/Bayes-Theorem-in-R.html" title="Bayes' Theorem"><span class="progress-dot"></span>Bayes' Theorem</a></li><li data-subkey="sec2sub13"><a href="/Bayesian-Statistics-in-R.html" title="Bayesian Statistics"><span class="progress-dot"></span>Bayesian Statistics</a></li><li data-subkey="sec2sub13"><a href="/Conjugate-Priors-in-R.html" title="Conjugate Priors"><span class="progress-dot"></span>Conjugate Priors</a></li><li data-subkey="sec2sub13"><a href="/Grid-Approximation-in-R.html" title="Grid Approximation"><span class="progress-dot"></span>Grid Approximation</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub14" data-collapsed="false"><span class="subsec-chevron">▼</span> MCMC & Stan</li><li data-subkey="sec2sub14"><a href="/MCMC-in-R.html" title="MCMC in R"><span class="progress-dot"></span>MCMC in R</a></li><li data-subkey="sec2sub14"><a href="/Gibbs-Sampling-in-R.html" title="Gibbs Sampling"><span class="progress-dot"></span>Gibbs Sampling</a></li><li data-subkey="sec2sub14"><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="sec2sub14"><a href="/Stan-in-R.html" title="Stan"><span class="progress-dot"></span>Stan</a></li><li data-subkey="sec2sub14"><a href="/brms-in-R.html" title="brms"><span class="progress-dot"></span>brms</a></li><li class="sidebar-divider sidebar-subsection-toggle" data-subkey="sec2sub15" data-collapsed="false"><span class="subsec-chevron">▼</span> Bayesian Modeling</li><li data-subkey="sec2sub15"><a href="/Choosing-Priors-in-R.html" title="Choosing Priors"><span class="progress-dot"></span>Choosing Priors</a></li><li data-subkey="sec2sub15"><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="sec2sub15"><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="sec2sub15"><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="sec2sub15"><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="sec2sub15"><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="sec2sub15"><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="sec2sub15"><a href="/Multilevel-Models-in-R.html" title="Multilevel Models"><span class="progress-dot"></span>Multilevel Models</a></li><li data-subkey="sec2sub15"><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="sec2sub16" data-collapsed="false"><span class="subsec-chevron">▼</span> Machine Learning</li><li data-subkey="sec2sub16"><a href="/Random-Forest-Course.html" title="Random Forests (Course)"><span class="progress-dot"></span>Random Forests (Course)</a></li><li data-subkey="sec2sub16"><a href="/R-Gradient-Boosting-Course.html" title="Gradient Boosting (Course)"><span class="progress-dot"></span>Gradient Boosting (Course)</a></li><li data-subkey="sec2sub16"><a href="/R-tidymodels-Course.html" title="tidymodels (Course)"><span class="progress-dot"></span>tidymodels (Course)</a></li><li data-subkey="sec2sub16" 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="sec2sub16"><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 expanded"><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" class="active" 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.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.5V2.5M2.5 13.5H14"/><path d="M4 11l3-2.5 3-1.5 3.5-3"/><circle cx="11.5" cy="4" r="1.1" fill="currentColor" stroke="none"/></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>
<div id="content" class="col-xs-12 col-sm-7">
<h1>Time Series Analysis in R: A Complete Walkthrough</h1>
<blockquote>
<p>Any metric that is measured over regular time intervals forms a time series. Analysis of time series is commercially importance because of industrial need and relevance especially w.r.t forecasting (demand, sales, supply etc).</p>
</blockquote>
<p>A time series can be broken down to its components so as to systematically understand, analyze, model and forecast it. This is a beginners introduction to time series analysis, answering fundamental questions such as:</p>
<ol style="list-style-type: decimal">
<li>What are the components of a time series</li>
<li>What is a stationary time series</li>
<li>How to decompose it</li>
<li>How to de-trend, de-seasonalize a time series</li>
<li>What is auto correlation etc.</li>
</ol>
<h2>What is a Time Series ?</h2>
<p>Any metric that is measured over regular time intervals makes a Time Series. Example: Weather data, Stock prices, Industry forecasts, etc are some of the common ones.</p>
<h2>How to create a Time Series in R ?</h2>
<p>Upon importing your data into R, use ts() function as follows. The inputData used here is ideally a numeric vector of the class ‘numeric’ or ‘integer’.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ts</span> (inputData, <span class="dt">frequency =</span> <span class="dv">4</span>, <span class="dt">start =</span> <span class="kw">c</span>(<span class="dv">1959</span>, <span class="dv">2</span>)) <span class="co"># frequency 4 => Quarterly Data</span>
<span class="kw">ts</span> (<span class="dv">1</span>:<span class="dv">10</span>, <span class="dt">frequency =</span> <span class="dv">12</span>, <span class="dt">start =</span> <span class="dv">1990</span>) <span class="co"># freq 12 => Monthly data. </span>
<span class="kw">ts</span> (inputData, <span class="dt">start=</span><span class="kw">c</span>(<span class="dv">2009</span>), <span class="dt">end=</span><span class="kw">c</span>(<span class="dv">2014</span>), <span class="dt">frequency=</span><span class="dv">1</span>) <span class="co"># Yearly Data</span></code></pre></div>
<h2>Understanding your Time Series</h2>
<p>Each data point <span class="math inline">(<em>Y</em><em>t</em>)</span> at time <span class="math inline"><em>t</em></span> in a Time Series can be expressed as either a sum or a product of 3 components, namely, <em>Seasonality (St)</em>, <em>Trend (Tt)</em> and <em>Error (et)</em> (a.k.a White Noise).</p>
<h5>For Additive Time Series,</h5>
<p><br /><span class="math display"><em>Y</em><sub><em>t</em></sub> = <em>S</em><sub><em>t</em></sub> + <em>T</em><sub><em>t</em></sub> + <em>ϵ</em><sub><em>t</em></sub></span><br /></p>
<h5>For Multiplicative Time Series,</h5>
<p><br /><span class="math display"><em>Y</em><sub><em>t</em></sub> = <em>S</em><sub><em>t</em></sub> × <em>T</em><sub><em>t</em></sub> × <em>ϵ</em><sub><em>t</em></sub></span><br /></p>
<p>A multiplicative time series can be converted to additive by taking a log of the time series.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">additiveTS <-<span class="st"> </span><span class="kw">log</span> (multiplcativeTS) <span class="co"># often converts multiplicative to additive time series</span></code></pre></div>
<h2>What is a Stationary Time Series ?</h2>
<p>A time series is said to be stationary if it holds the following conditions true.</p>
<ol style="list-style-type: decimal">
<li>The mean value of time-series is constant over time, which implies, the trend component is nullified.</li>
<li>The variance does not increase over time.</li>
<li>Seasonality effect is minimal.</li>
</ol>
<p>This means it is devoid of trend or seasonal patterns, which makes it looks like a random <em>white noise</em> irrespective of the observed time interval.</p>
<h2>How to extract the trend, seasonality and error?</h2>
<p>The <code>decompose()</code> and <code>forecast::stl()</code> splits the time series into <em>seasonality</em>, <em>trend</em> and <em>error</em> components.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">tsData <-<span class="st"> </span>EuStockMarkets[, <span class="dv">1</span>] <span class="co"># ts data</span>
decomposedRes <-<span class="st"> </span><span class="kw">decompose</span>(tsData, <span class="dt">type=</span><span class="st">"mult"</span>) <span class="co"># use type = "additive" for additive components</span>
<span class="kw">plot</span> (decomposedRes) <span class="co"># see plot below</span>
stlRes <-<span class="st"> </span><span class="kw">stl</span>(tsData, <span class="dt">s.window =</span> <span class="st">"periodic"</span>)
<span class="co">#> Few rows of stlRes</span>
<span class="co">#> $time.series</span>
<span class="co">#> Time Series:</span>
<span class="co">#> Start = c(1991, 130) </span>
<span class="co">#> End = c(1998, 169) </span>
<span class="co">#> Frequency = 260 </span>
<span class="co">#> seasonal trend remainder</span>
<span class="co">#> 1991.496 43.1900952 1602.604 -17.0445950</span>
<span class="co">#> 1991.500 55.3795008 1603.064 -44.8134914</span>
<span class="co">#> 1991.504 61.2914064 1603.523 -58.3048878</span>
<span class="co">#> 1991.508 68.4470620 1603.983 -51.3900342</span>
<span class="co">#> 1991.512 68.4527176 1604.442 -54.7351806</span>
<span class="co">#> 1991.515 70.8396232 1604.902 -65.1315770</span></code></pre></div>
<p><img src='screenshots/time-series-analysis/Additive-and-Multiplicative-Decomposition-of-Timeseries.png' width='707' height='436' alt="Additive And Multiplicative Decomposition Of Timeseries" /></p>
<h2>How to create lags of a time-series ?</h2>
<p>When the time base is shifted by a given number of periods, a Lag of time series is created. Lags of a time series are often used as explanatory variables to model the actual time series itself. The underlying reasoning is that the state of the time series few periods back may still has an influence on the series current state.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">laggedTS <-<span class="st"> </span><span class="kw">lag</span>(tsData, <span class="dv">3</span>) <span class="co"># shifted 3 periods earlier. Use `-3` to shift by 3 periods forward.</span></code></pre></div>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(DataCombine)
myDf <-<span class="st"> </span><span class="kw">as.data.frame</span>(tsData)
myDf <-<span class="st"> </span><span class="kw">slide</span>(myDf, <span class="st">"x"</span>, <span class="dt">NewVar =</span> <span class="st">"xLag1"</span>, <span class="dt">slideBy =</span> -<span class="dv">1</span>) <span class="co"># create lag1 variable</span>
myDf <-<span class="st"> </span><span class="kw">slide</span>(myDf, <span class="st">"x"</span>, <span class="dt">NewVar =</span> <span class="st">"xLead1"</span>, <span class="dt">slideBy =</span> <span class="dv">1</span>) <span class="co"># create lead1 variable</span>
<span class="kw">head</span>(myDf)
<span class="co">#> x xLag1 xLead1</span>
<span class="co">#> 1 1628.75 NA 1613.63</span>
<span class="co">#> 2 1613.63 1628.75 1606.51</span>
<span class="co">#> 3 1606.51 1613.63 1621.04</span>
<span class="co">#> 4 1621.04 1606.51 1618.16</span>
<span class="co">#> 5 1618.16 1621.04 1610.61</span>
<span class="co">#> 6 1610.61 1618.16 1630.75</span></code></pre></div>
<h2>What is Autocorrelation and Partial-Autocorrelation?</h2>
<p><strong>Autocorrelation</strong> is the correlation of a Time Series with lags of itself. This is a significant metric because,</p>
<ol style="list-style-type: decimal">
<li><p>It shows if the previous states (lagged observations) of the time series has an influence on the current state. In the autocorrelation chart, if the autocorrelation crosses the dashed blue line, it means that specific lag is significantly correlated with current series. For example, in autocorrelation chart of <code>AirPassengers</code> - the top-left chart (below), there is significant autocorrelation for all the lags shown on x-axis.</p></li>
<li><p>It is used commonly to determine if the time series is stationary or not. A stationary time series will have the autocorrelation fall to zero fairly quickly but for a non-stationary series it drops gradually.</p></li>
</ol>
<p><strong>Partial Autocorrelation</strong> is the correlation of the time series with a lag of itself, with the linear dependence of all the lags between them removed.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># both acf() and pacf() generates plots by default</span>
acfRes <-<span class="st"> </span><span class="kw">acf</span>(AirPassengers) <span class="co"># autocorrelation</span>
pacfRes <-<span class="st"> </span><span class="kw">pacf</span>(AirPassengers) <span class="co"># partial autocorrelation</span>
ccfRes <-<span class="st"> </span><span class="kw">ccf</span>(mdeaths, fdeaths, <span class="dt">ylab =</span> <span class="st">"cross-correlation"</span>) <span class="co"># computes cross correlation between 2 timeseries.</span>
<span class="kw">head</span>(ccfRes[[<span class="dv">1</span>]])
<span class="co">#> [1] 0.01505498 0.36562603 0.61542712 0.70820629 0.62189580 0.34000545</span></code></pre></div>
<p><img src='screenshots/time-series-analysis/acf-pacf-ccf-plot.png' width='575' height='411' alt="Acf Pacf Ccf Plot" /></p>
<h2>How to de-trend a time series ?</h2>
<p>Use linear regression to model the Time Series data with linear indices (Ex: 1, 2, .. n). The resulting model’s residuals is a representation of the time series devoid of the trend. In case, if some trend is left over to be seen in the residuals (like what it seems to be with ‘JohnsonJohnson’ data below), then you might wish to add few predictors to the <code>lm()</code> call (like a <code>forecast::seasonaldummy</code>, <code>forecast::fourier</code> or may be a lag of the series itself), until the trend is filtered.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">trModel <-<span class="st"> </span><span class="kw">lm</span>(JohnsonJohnson ~<span class="st"> </span><span class="kw">c</span>(<span class="dv">1</span>:<span class="kw">length</span>(JohnsonJohnson)))
<span class="kw">plot</span>(<span class="kw">resid</span>(trModel), <span class="dt">type=</span><span class="st">"l"</span>) <span class="co"># resid(trModel) contains the de-trended series.</span></code></pre></div>
<p><img src='screenshots/time-series-analysis/JohnsonJohnson-Detrended.png' width='578' height='206' alt="Johnsonjohnson Detrended" /></p>
<h2>How to de-seasonalize a time series in R?</h2>
<p>De-seasonalizing throws insight about the seasonal pattern in the time series and helps to model the data without the seasonal effects. So how to de-seasonalize? Step 1: De-<a class="auto-link" href="R-Function-Operators.html" title="R Function Operators: Compose, Negate & Partial Application">compose</a> the Time series using <code>forecast::stl()</code> Step 2: use <code>seasadj()</code> from ‘forecast’ package</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(forecast)
ts.stl <-<span class="st"> </span><span class="kw">stl</span>(TS,<span class="st">"periodic"</span>) <span class="co"># decompose the TS</span>
ts.sa <-<span class="st"> </span><span class="kw">seasadj</span>(ts.stl) <span class="co"># de-seasonalize</span>
<span class="kw">plot</span>(AirPassengers, <span class="dt">type=</span><span class="st">"l"</span>) <span class="co"># original series</span>
<span class="kw">plot</span>(ts.sa, <span class="dt">type=</span><span class="st">"l"</span>) <span class="co"># seasonal adjusted</span>
<span class="kw">seasonplot</span>(ts.sa, <span class="dv">12</span>, <span class="dt">col=</span><span class="kw">rainbow</span>(<span class="dv">12</span>), <span class="dt">year.labels=</span><span class="ot">TRUE</span>, <span class="dt">main=</span><span class="st">"Seasonal plot: Airpassengers"</span>) <span class="co"># seasonal frequency set as 12 for monthly data.</span></code></pre></div>
<p><img src='screenshots/time-series-analysis/seasonal-plots.png' width='578' height='371' alt="Seasonal Plots" /></p>
<h2>How to test if a time series is stationary?</h2>
<p>Use <em>Augmented Dickey-Fuller Test</em> (adf test). A <a class="auto-link" href="Statistical-Tests-in-R.html" title="Statistical Tests in R">p-Value</a> of less than 0.05 in adf.test() indicates that it is stationary.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(tseries)
<span class="kw">adf.test</span>(tsData) <span class="co"># p-value < 0.05 indicates the TS is stationary</span>
<span class="kw">kpss.test</span>(tsData)</code></pre></div>
<h2>How to make a time series stationary?</h2>
<p><em>Differencing</em> a time series means, to subtract each data point in the series from its successor. It is commonly used to make a time series <em>stationary</em>. For most time series patterns, 1 or 2 differencing is necessary to make it a stationary series.</p>
<p>But if the time series appears to be seasonal, a better approach is to difference with respective season’s data points to remove seasonal effect. After that, if needed, difference it again with successive data points. But, How to know how many differencing is needed? the <code>nsdiffs</code> and <code>ndiffs</code> from <code>forecast</code> package can help find out how many <em>seasonal differencing</em> and <em>regular differencing</em> respectively is needed to make the series stationary.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Seasonal Differencing</span>
<span class="kw">nsdiffs</span>(AirPassengers) <span class="co"># number for seasonal differencing needed</span>
<span class="co">#> 1</span>
AirPassengers_seasdiff <-<span class="st"> </span><span class="kw">diff</span>(AirPassengers, <span class="dt">lag=</span><span class="kw">frequency</span>(AirPassengers), <span class="dt">differences=</span><span class="dv">1</span>) <span class="co"># seasonal differencing</span>
<span class="kw">plot</span>(ap_seasdiff, <span class="dt">type=</span><span class="st">"l"</span>, <span class="dt">main=</span><span class="st">"Seasonally Differenced"</span>) <span class="co"># still not stationary!</span>
<span class="co"># Make it stationary</span>
<span class="kw">ndiffs</span>(AirPassengers_seasdiff) <span class="co"># number of differences need to make it stationary</span>
<span class="co">#> 1 </span>
stationaryTS <-<span class="st"> </span><span class="kw">diff</span>(AirPassengers_seasdiff, <span class="dt">differences=</span> <span class="dv">1</span>)
<span class="kw">plot</span>(stationaryTS, <span class="dt">type=</span><span class="st">"l"</span>, <span class="dt">main=</span><span class="st">"Differenced and Stationary"</span>) <span class="co"># appears to be stationary</span></code></pre></div>
<p><img src='screenshots/time-series-analysis/seasonal-differenced-stationary.png' width='527' height='188' alt="Seasonal Differenced Stationary" /></p>
<div id="auto-further-reading">
<h2>Further Reading</h2>
<ul class="further-reading-list">
<li><a href="ARIMA-Exercises-in-R.html">ARIMA Exercises in R: 25 Real-World Practice Problems</a></li>
<li><a href="Top-20-Time-Series-Problems-in-R.html">Top 20 Time Series Problems to Solve in R</a></li>
<li><a href="Time-Series-in-R-Exercises.html">Time Series in R Exercises: 50 Real-World Practice Problems</a></li>
</ul>
</div>
</div>
<div class="col-sm-2 hidden-xs" id="toc-sidebar">
<div id="toc-wrapper">
<h5 class="toc-title">On this page</h5>
<ul class="list-unstyled" id="toc"></ul>
</div>
</div>
</div>
</div> <!-- /container -->
<!-- SITE-FOOTER-V2 -->
<style>
.rsft{background:#101a30;color:#aeb9d4;font-size:14px;font-family:'IBM Plex Sans',-apple-system,Segoe UI,Roboto,Arial,sans-serif;line-height:1.6;margin-top:64px}
.rsft a{text-decoration:none;transition:color .14s}
.rsft-in{max-width:1060px;margin:0 auto;padding:46px 26px 0;display:grid;grid-template-columns:1.7fr 1fr 1fr 1fr;gap:32px}
.rsft-bm{display:inline-flex;align-items:center;gap:9px;font-family:'IBM Plex Serif',Georgia,serif;font-weight:700;font-size:18px;color:#fff}.rsft-bm:link,.rsft-bm:visited{color:#fff}.rsft-soc a:link,.rsft-soc a:visited{color:#eef2fb}.rsft-col a:link,.rsft-col a:visited{color:#aeb9d4}.rsft-bot a:link,.rsft-bot a:visited{color:#8a96b5}
.rsft-mk{display:inline-block;flex:none;width:28px;height:28px;background:url(/logo-mark-on-dark.svg) center/100% 100% no-repeat;font-size:0;color:transparent}.rsft-mk::after{display:none}
.rsft-tag{margin:14px 0 16px;color:#aeb9d4;font-size:13.5px;max-width:300px;line-height:1.6}
.rsft-soc{display:flex;gap:10px}
.rsft-soc a{min-width:34px;height:34px;padding:0 10px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:rgba(255,255,255,.06);color:#eef2fb;border:1px solid rgba(255,255,255,.10);font-size:12px;font-weight:600}
.rsft-soc a:hover{background:rgba(255,255,255,.13)}
.rsft-col h4{font-size:12px;letter-spacing:.1em;text-transform:uppercase;color:#eef2fb;margin:4px 0 14px;font-weight:600}
.rsft-col a{display:block;color:#aeb9d4;margin-bottom:10px;font-size:13.5px}
.rsft-col a:hover{color:#fff}
.rsft-bot{max-width:1060px;margin:30px auto 0;padding:18px 26px;border-top:1px solid rgba(255,255,255,.10);display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;font-size:12.5px;color:#8a96b5}
.rsft-bot a{color:#8a96b5}.rsft-bot a:hover{color:#fff}
@media(max-width:720px){.rsft-in{grid-template-columns:1fr 1fr}.rsft-brandcol{grid-column:1/-1}}
</style>
<footer class="rsft" role="contentinfo">
<div class="rsft-in">
<div class="rsft-brandcol">
<a class="rsft-bm" href="/"><span class="rsft-mk">R</span>r-statistics<span style="color:#7da2ff">.co</span></a>
<p class="rsft-tag">Learn R and statistics the practical way: runnable tutorials, auto-graded exercises, free tools, and shareable certificates.</p>
<div class="rsft-soc"><a href="/feed.xml" aria-label="RSS feed">RSS</a></div>
</div>
<div class="rsft-col"><h4>Explore</h4><a href="/posts/">All Tutorials</a><a href="/tools/">All Tools</a><a href="/about/">About</a></div>
<div class="rsft-col"><h4>Popular tools</h4><a href="/tools/t-test-calculator.html">t-Test Calculator</a><a href="/tools/ab-test-calculator.html">A/B Test Calculator</a><a href="/tools/confidence-interval-calculator.html">Confidence Intervals</a></div>
<div class="rsft-col"><h4>Site</h4><a href="/pricing.html">Pricing</a><a href="/contact.html">Contact</a><a href="/feedback.html">Feedback</a><a href="/privacy.html">Privacy</a><a href="/terms-of-service.html">Terms</a><a href="/refund-policy.html">Refunds</a></div>
</div>
<div class="rsft-bot">
<span>© 2016-2026 r-statistics.co</span>
<span>Content licensed under <a href="https://creativecommons.org/licenses/by-nc/3.0/" rel="noopener">CC BY-NC 3.0</a></span>
</div>
</footer>
<!-- /SITE-FOOTER-V2 -->
<script src="//code.jquery.com/jquery.js"></script>
<script src="www/bootstrap.min.js"></script>
<script src="www/toc.js?v=5"></script>
<!-- MathJax Script -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- Google Analytics (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-D5XKCMN7FR"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-D5XKCMN7FR');
</script>
<style type="text/css">
/* reduce spacing around math formula*/
.MathJax_Display {
margin: 0em 0em;
}
body {
font-family: 'Helvetica Neue', Roboto, Arial, sans-serif;
font-size: 16px;
line-height: 27px;
font-weight: 400;
}
blockquote p {
line-height: 1.75;
color: #717171;
}
.well li{
line-height: 28px;
}
li.dropdown-header {
display: block;
padding: 0px;
font-size: 14px;
}
</style>
<script>
(function(){function w(){var t=document.querySelectorAll('.sidebar-tab'),p=document.querySelectorAll('.sidebar-panel');if(!t.length||!p.length)return false;function a(n){t.forEach(function(x){x.classList.toggle('active',x.getAttribute('data-tab')===n)});p.forEach(function(x){x.classList.toggle('active',x.getAttribute('data-panel')===n)})}var tp=location.pathname.indexOf('/tools/')===0;if(tp){a('tools')}else{try{var pin=localStorage.getItem('rstat_sidebar_tab');if(pin==='tools'||pin==='posts')a(pin)}catch(e){}}t.forEach(function(x){if(x.dataset.wired)return;x.dataset.wired='1';x.addEventListener('click',function(){var n=x.getAttribute('data-tab');a(n);try{localStorage.setItem('rstat_sidebar_tab',n)}catch(e){}})});return true}if(!w()){if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',w);else setTimeout(w,50)}})();
</script> <!-- Cloudflare Web Analytics (cookieless; no consent required) -->
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "edf7e3d50c3e4130a913e7f144643624"}'></script>
<script>(function(){var b=document.getElementById('mobile-menu-btn'),o=document.getElementById('mobile-sidebar'),c=document.getElementById('mobile-sidebar-close'),mc=document.getElementById('mobile-sidebar-content');function op(){var s=document.getElementById('sidebar-nav');if(s&&mc&&!mc.children.length)mc.innerHTML=s.innerHTML;o&&o.classList.add('open');}b&&b.addEventListener('click',op);c&&c.addEventListener('click',function(){o.classList.remove('open');});o&&o.addEventListener('click',function(e){if(e.target===o)o.classList.remove('open');});var d=document.getElementById('dark-mode-toggle');try{if(localStorage.getItem('rstat_dark')==='1')document.documentElement.classList.add('dark');}catch(e){}d&&d.addEventListener('click',function(){var on=document.documentElement.classList.toggle('dark');try{localStorage.setItem('rstat_dark',on?'1':'0');}catch(e){}});})();</script>
<script defer src="/www/auth-hydrate.js?v=17"></script>
<script defer src="/www/signin-modal.js?v=1"></script><script defer src="/www/practice-nav.js?v=17"></script><script defer src="/www/roadmap-nav.js?v=10"></script><script defer src="/www/persona-menu.js?v=6"></script>
<script defer src="/www/google-onetap.js?v=2"></script><script defer src="/www/signin-nudge.js?v=17"></script><script defer src="/www/xp-chip.js?v=1"></script>
<script defer src="/www/site-nav.js?v=9"></script><script defer src="/www/feedback-widget.js?v=4"></script>
</body>
</html>