-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise-4-test-your-knowledge.html
582 lines (541 loc) · 59 KB
/
exercise-4-test-your-knowledge.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title> 12 Exercise 4: Test your knowledge | R for Conditional Process Analysis</title>
<meta name="description" content="Using Conditional Process Analysis to evaluate communication theories - B.A. Seminar at IKMZ, FS 2022" />
<meta name="generator" content="bookdown 0.24 and GitBook 2.6.7" />
<meta property="og:title" content=" 12 Exercise 4: Test your knowledge | R for Conditional Process Analysis" />
<meta property="og:type" content="book" />
<meta property="og:description" content="Using Conditional Process Analysis to evaluate communication theories - B.A. Seminar at IKMZ, FS 2022" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content=" 12 Exercise 4: Test your knowledge | R for Conditional Process Analysis" />
<meta name="twitter:description" content="Using Conditional Process Analysis to evaluate communication theories - B.A. Seminar at IKMZ, FS 2022" />
<meta name="author" content="Lara Kobilke, IKMZ, University of Zurich" />
<meta name="date" content="2022-05-04" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="prev" href="tutorial-linear-regression.html"/>
<link rel="next" href="tutorial-mediation-analysis.html"/>
<script src="libs/header-attrs-2.11/header-attrs.js"></script>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.0.1/anchor-sections.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.0.1/anchor-sections.js"></script>
<script src="libs/htmlwidgets-1.5.4/htmlwidgets.js"></script>
<script src="libs/viz-1.8.2/viz.js"></script>
<link href="libs/DiagrammeR-styles-0.2/styles.css" rel="stylesheet" />
<script src="libs/grViz-binding-1.0.9/grViz.js"></script>
<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li><a href="./">CPA Seminar</a></li>
<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>General information on the course</a>
<ul>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html#how-to-use-this-tutorial"><i class="fa fa-check"></i>How to use this tutorial</a></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html#what-can-i-do-if-questions-arise"><i class="fa fa-check"></i>What can I do if questions arise?</a></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html#what-can-i-do-if-i-have-problems-with-my-r-code"><i class="fa fa-check"></i>What can I do if I have problems with my R code?</a></li>
</ul></li>
<li class="chapter" data-level="1" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html"><i class="fa fa-check"></i><b>1</b> Tutorial: Installing & Understanding R/R Studio</a>
<ul>
<li class="chapter" data-level="1.1" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#installing-r"><i class="fa fa-check"></i><b>1.1</b> Installing R</a></li>
<li class="chapter" data-level="1.2" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#installing-r-studio"><i class="fa fa-check"></i><b>1.2</b> Installing R Studio</a></li>
<li class="chapter" data-level="1.3" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#updating-r-and-r-studio"><i class="fa fa-check"></i><b>1.3</b> Updating R and R Studio</a>
<ul>
<li class="chapter" data-level="1.3.1" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#on-windows"><i class="fa fa-check"></i><b>1.3.1</b> On Windows</a></li>
<li class="chapter" data-level="1.3.2" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#on-mac"><i class="fa fa-check"></i><b>1.3.2</b> On MAC</a></li>
</ul></li>
<li class="chapter" data-level="1.4" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#how-does-r-work"><i class="fa fa-check"></i><b>1.4</b> How does R work?</a></li>
<li class="chapter" data-level="1.5" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#how-does-r-studio-work"><i class="fa fa-check"></i><b>1.5</b> How does R Studio work?</a>
<ul>
<li class="chapter" data-level="1.5.1" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#source-writing-your-own-code"><i class="fa fa-check"></i><b>1.5.1</b> Source: Writing your own code</a></li>
<li class="chapter" data-level="1.5.2" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#console-printing-results"><i class="fa fa-check"></i><b>1.5.2</b> Console: Printing results</a></li>
<li class="chapter" data-level="1.5.3" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#environment-overview-of-objects"><i class="fa fa-check"></i><b>1.5.3</b> Environment: Overview of objects</a></li>
<li class="chapter" data-level="1.5.4" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#plotshelppackages-do-everything-else"><i class="fa fa-check"></i><b>1.5.4</b> Plots/Help/Packages: Do everything else</a></li>
</ul></li>
<li class="chapter" data-level="1.6" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#take-aways"><i class="fa fa-check"></i><b>1.6</b> Take-Aways</a></li>
<li class="chapter" data-level="1.7" data-path="tutorial-installing-understanding-rr-studio.html"><a href="tutorial-installing-understanding-rr-studio.html#additional-tutorials"><i class="fa fa-check"></i><b>1.7</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="2" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html"><i class="fa fa-check"></i><b>2</b> Tutorial: Workflow in R</a>
<ul>
<li class="chapter" data-level="2.1" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#defining-your-working-directory"><i class="fa fa-check"></i><b>2.1</b> Defining your working directory</a></li>
<li class="chapter" data-level="2.2" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#packages"><i class="fa fa-check"></i><b>2.2</b> Packages</a>
<ul>
<li class="chapter" data-level="2.2.1" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#installing-packages"><i class="fa fa-check"></i><b>2.2.1</b> Installing packages</a></li>
<li class="chapter" data-level="2.2.2" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#activating-packages"><i class="fa fa-check"></i><b>2.2.2</b> Activating packages</a></li>
<li class="chapter" data-level="2.2.3" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#getting-information-about-packages"><i class="fa fa-check"></i><b>2.2.3</b> Getting information about packages</a></li>
</ul></li>
<li class="chapter" data-level="2.3" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#help"><i class="fa fa-check"></i><b>2.3</b> Help?!</a>
<ul>
<li class="chapter" data-level="2.3.1" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#finding-information-about-packages"><i class="fa fa-check"></i><b>2.3.1</b> Finding information about packages</a></li>
<li class="chapter" data-level="2.3.2" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#finding-information-about-functions"><i class="fa fa-check"></i><b>2.3.2</b> Finding information about functions</a></li>
<li class="chapter" data-level="2.3.3" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#searching-for-help-online"><i class="fa fa-check"></i><b>2.3.3</b> Searching for help online</a></li>
<li class="chapter" data-level="2.3.4" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#interrupting-r"><i class="fa fa-check"></i><b>2.3.4</b> Interrupting R</a></li>
</ul></li>
<li class="chapter" data-level="2.4" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#saving-loading-cleaning-coderesults"><i class="fa fa-check"></i><b>2.4</b> Saving, loading & cleaning code/results</a>
<ul>
<li class="chapter" data-level="2.4.1" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#saving-your-code"><i class="fa fa-check"></i><b>2.4.1</b> Saving your code</a></li>
<li class="chapter" data-level="2.4.2" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#saving-your-results"><i class="fa fa-check"></i><b>2.4.2</b> Saving your results</a></li>
<li class="chapter" data-level="2.4.3" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#loading-working-spaces"><i class="fa fa-check"></i><b>2.4.3</b> Loading working spaces</a></li>
<li class="chapter" data-level="2.4.4" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#clean-your-working-space"><i class="fa fa-check"></i><b>2.4.4</b> Clean your working space</a></li>
<li class="chapter" data-level="2.4.5" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#take-aways-1"><i class="fa fa-check"></i><b>2.4.5</b> Take Aways</a></li>
</ul></li>
<li class="chapter" data-level="2.5" data-path="tutorial-workflow-in-r.html"><a href="tutorial-workflow-in-r.html#additional-tutorials-1"><i class="fa fa-check"></i><b>2.5</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="tutorial-using-r-as-a-calculator.html"><a href="tutorial-using-r-as-a-calculator.html"><i class="fa fa-check"></i><b>3</b> Tutorial: Using R as a calculator</a>
<ul>
<li class="chapter" data-level="3.1" data-path="tutorial-using-r-as-a-calculator.html"><a href="tutorial-using-r-as-a-calculator.html#using-variables-for-calculation"><i class="fa fa-check"></i><b>3.1</b> Using variables for calculation</a></li>
<li class="chapter" data-level="3.2" data-path="tutorial-using-r-as-a-calculator.html"><a href="tutorial-using-r-as-a-calculator.html#using-vectors-for-calculation"><i class="fa fa-check"></i><b>3.2</b> Using vectors for calculation</a></li>
<li class="chapter" data-level="3.3" data-path="tutorial-using-r-as-a-calculator.html"><a href="tutorial-using-r-as-a-calculator.html#take-aways-2"><i class="fa fa-check"></i><b>3.3</b> Take-Aways</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html"><i class="fa fa-check"></i><b>4</b> Tutorial: Objects & structures in R</a>
<ul>
<li class="chapter" data-level="4.1" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#types-of-data"><i class="fa fa-check"></i><b>4.1</b> Types of data</a>
<ul>
<li class="chapter" data-level="4.1.1" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#accessing-variables-in-data-sets"><i class="fa fa-check"></i><b>4.1.1</b> Accessing variables in data sets</a></li>
<li class="chapter" data-level="4.1.2" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#numbers"><i class="fa fa-check"></i><b>4.1.2</b> Numbers</a></li>
<li class="chapter" data-level="4.1.3" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#text"><i class="fa fa-check"></i><b>4.1.3</b> Text</a></li>
<li class="chapter" data-level="4.1.4" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#factors"><i class="fa fa-check"></i><b>4.1.4</b> Factors</a></li>
<li class="chapter" data-level="4.1.5" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#dates"><i class="fa fa-check"></i><b>4.1.5</b> Dates</a></li>
<li class="chapter" data-level="4.1.6" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#missing-datanas"><i class="fa fa-check"></i><b>4.1.6</b> Missing data/NAs</a></li>
<li class="chapter" data-level="4.1.7" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#logicalother-operators"><i class="fa fa-check"></i><b>4.1.7</b> Logical/other operators</a></li>
</ul></li>
<li class="chapter" data-level="4.2" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#types-of-objects"><i class="fa fa-check"></i><b>4.2</b> Types of objects</a>
<ul>
<li class="chapter" data-level="4.2.1" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#scalars"><i class="fa fa-check"></i><b>4.2.1</b> Scalars</a></li>
<li class="chapter" data-level="4.2.2" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#vectors"><i class="fa fa-check"></i><b>4.2.2</b> Vectors</a></li>
<li class="chapter" data-level="4.2.3" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#data-frames-matrices"><i class="fa fa-check"></i><b>4.2.3</b> Data frames & matrices</a></li>
<li class="chapter" data-level="4.2.4" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#lists"><i class="fa fa-check"></i><b>4.2.4</b> Lists</a></li>
<li class="chapter" data-level="4.2.5" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#other-types-of-objects"><i class="fa fa-check"></i><b>4.2.5</b> Other types of objects</a></li>
</ul></li>
<li class="chapter" data-level="4.3" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#take-aways-3"><i class="fa fa-check"></i><b>4.3</b> Take Aways</a></li>
<li class="chapter" data-level="4.4" data-path="tutorial-objects-structures-in-r.html"><a href="tutorial-objects-structures-in-r.html#additional-tutorials-2"><i class="fa fa-check"></i><b>4.4</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="5" data-path="tutorial-reading-data-inout.html"><a href="tutorial-reading-data-inout.html"><i class="fa fa-check"></i><b>5</b> Tutorial: Reading data in/out</a>
<ul>
<li class="chapter" data-level="5.1" data-path="tutorial-reading-data-inout.html"><a href="tutorial-reading-data-inout.html#getting-data-into-r"><i class="fa fa-check"></i><b>5.1</b> Getting data into R</a></li>
<li class="chapter" data-level="5.2" data-path="tutorial-reading-data-inout.html"><a href="tutorial-reading-data-inout.html#getting-data-out-of-r"><i class="fa fa-check"></i><b>5.2</b> Getting data out of R</a></li>
<li class="chapter" data-level="5.3" data-path="tutorial-reading-data-inout.html"><a href="tutorial-reading-data-inout.html#other-packages-for-getting-data-intoout-of-r"><i class="fa fa-check"></i><b>5.3</b> Other packages for getting data into/out of R</a></li>
<li class="chapter" data-level="5.4" data-path="tutorial-reading-data-inout.html"><a href="tutorial-reading-data-inout.html#take-aways-4"><i class="fa fa-check"></i><b>5.4</b> Take Aways</a></li>
<li class="chapter" data-level="5.5" data-path="tutorial-reading-data-inout.html"><a href="tutorial-reading-data-inout.html#additional-tutorials-3"><i class="fa fa-check"></i><b>5.5</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="6" data-path="exercise-1-test-your-knowledge.html"><a href="exercise-1-test-your-knowledge.html"><i class="fa fa-check"></i><b>6</b> Exercise 1: Test your knowledge</a>
<ul>
<li class="chapter" data-level="6.1" data-path="exercise-1-test-your-knowledge.html"><a href="exercise-1-test-your-knowledge.html#task-1"><i class="fa fa-check"></i><b>6.1</b> Task 1</a></li>
<li class="chapter" data-level="6.2" data-path="exercise-1-test-your-knowledge.html"><a href="exercise-1-test-your-knowledge.html#task-2"><i class="fa fa-check"></i><b>6.2</b> Task 2</a></li>
<li class="chapter" data-level="6.3" data-path="exercise-1-test-your-knowledge.html"><a href="exercise-1-test-your-knowledge.html#task-3"><i class="fa fa-check"></i><b>6.3</b> Task 3</a></li>
<li class="chapter" data-level="6.4" data-path="exercise-1-test-your-knowledge.html"><a href="exercise-1-test-your-knowledge.html#task-4"><i class="fa fa-check"></i><b>6.4</b> Task 4</a></li>
<li class="chapter" data-level="6.5" data-path="exercise-1-test-your-knowledge.html"><a href="exercise-1-test-your-knowledge.html#task-5"><i class="fa fa-check"></i><b>6.5</b> Task 5</a></li>
</ul></li>
<li class="chapter" data-level="7" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html"><i class="fa fa-check"></i><b>7</b> Tutorial: Data management with tidyverse</a>
<ul>
<li class="chapter" data-level="7.1" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#why-not-stick-with-base-r"><i class="fa fa-check"></i><b>7.1</b> Why not stick with Base R?</a></li>
<li class="chapter" data-level="7.2" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#tidyverse-packages"><i class="fa fa-check"></i><b>7.2</b> Tidyverse packages</a></li>
<li class="chapter" data-level="7.3" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#tidy-data"><i class="fa fa-check"></i><b>7.3</b> Tidy data</a></li>
<li class="chapter" data-level="7.4" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#the-pipe-operator"><i class="fa fa-check"></i><b>7.4</b> The pipe operator</a></li>
<li class="chapter" data-level="7.5" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#data-transformation-with-dplyr"><i class="fa fa-check"></i><b>7.5</b> Data transformation with dplyr</a>
<ul>
<li class="chapter" data-level="7.5.1" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#select"><i class="fa fa-check"></i><b>7.5.1</b> select()</a></li>
<li class="chapter" data-level="7.5.2" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#filter"><i class="fa fa-check"></i><b>7.5.2</b> filter()</a></li>
<li class="chapter" data-level="7.5.3" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#arrange"><i class="fa fa-check"></i><b>7.5.3</b> arrange()</a></li>
<li class="chapter" data-level="7.5.4" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#mutate"><i class="fa fa-check"></i><b>7.5.4</b> mutate()</a></li>
<li class="chapter" data-level="7.5.5" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#simmarize-group_by"><i class="fa fa-check"></i><b>7.5.5</b> simmarize() [+ group_by()]</a></li>
<li class="chapter" data-level="7.5.6" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#chaining-functions-in-a-pipe"><i class="fa fa-check"></i><b>7.5.6</b> Chaining functions in a pipe</a></li>
</ul></li>
<li class="chapter" data-level="7.6" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#take-aways-5"><i class="fa fa-check"></i><b>7.6</b> Take-Aways</a></li>
<li class="chapter" data-level="7.7" data-path="tutorial-data-management-with-tidyverse.html"><a href="tutorial-data-management-with-tidyverse.html#additional-tutorials-4"><i class="fa fa-check"></i><b>7.7</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="8" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html"><i class="fa fa-check"></i><b>8</b> Exercise 2: Test your knowledge</a>
<ul>
<li class="chapter" data-level="8.1" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html#task-1-1"><i class="fa fa-check"></i><b>8.1</b> Task 1</a></li>
<li class="chapter" data-level="8.2" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html#task-2-1"><i class="fa fa-check"></i><b>8.2</b> Task 2</a></li>
<li class="chapter" data-level="8.3" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html#task-3-1"><i class="fa fa-check"></i><b>8.3</b> Task 3</a></li>
<li class="chapter" data-level="8.4" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html#task-4-1"><i class="fa fa-check"></i><b>8.4</b> Task 4</a></li>
<li class="chapter" data-level="8.5" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html#task-5-1"><i class="fa fa-check"></i><b>8.5</b> Task 5</a></li>
<li class="chapter" data-level="8.6" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html#task-6"><i class="fa fa-check"></i><b>8.6</b> Task 6</a></li>
<li class="chapter" data-level="8.7" data-path="exercise-2-test-your-knowledge.html"><a href="exercise-2-test-your-knowledge.html#task-7"><i class="fa fa-check"></i><b>8.7</b> Task 7</a></li>
</ul></li>
<li class="chapter" data-level="9" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html"><i class="fa fa-check"></i><b>9</b> Tutorial: Data visualization with ggplot</a>
<ul>
<li class="chapter" data-level="9.1" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#why-not-stick-with-base-r-1"><i class="fa fa-check"></i><b>9.1</b> Why not stick with Base R?</a></li>
<li class="chapter" data-level="9.2" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#components-of-a-ggplot-graph"><i class="fa fa-check"></i><b>9.2</b> Components of a ggplot graph</a></li>
<li class="chapter" data-level="9.3" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#installing-activating-ggplot"><i class="fa fa-check"></i><b>9.3</b> Installing & activating ggplot</a></li>
<li class="chapter" data-level="9.4" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#building-your-first-plot"><i class="fa fa-check"></i><b>9.4</b> Building your first plot</a>
<ul>
<li class="chapter" data-level="9.4.1" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#data"><i class="fa fa-check"></i><b>9.4.1</b> Data</a></li>
<li class="chapter" data-level="9.4.2" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#aesthetics"><i class="fa fa-check"></i><b>9.4.2</b> Aesthetics</a></li>
<li class="chapter" data-level="9.4.3" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#geometrics"><i class="fa fa-check"></i><b>9.4.3</b> Geometrics</a></li>
<li class="chapter" data-level="9.4.4" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#scales"><i class="fa fa-check"></i><b>9.4.4</b> Scales</a></li>
<li class="chapter" data-level="9.4.5" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#themes"><i class="fa fa-check"></i><b>9.4.5</b> Themes</a></li>
<li class="chapter" data-level="9.4.6" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#labs"><i class="fa fa-check"></i><b>9.4.6</b> Labs</a></li>
<li class="chapter" data-level="9.4.7" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#facets"><i class="fa fa-check"></i><b>9.4.7</b> Facets</a></li>
<li class="chapter" data-level="9.4.8" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#saving-graphs"><i class="fa fa-check"></i><b>9.4.8</b> Saving graphs</a></li>
</ul></li>
<li class="chapter" data-level="9.5" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#other-common-plot-types"><i class="fa fa-check"></i><b>9.5</b> Other common plot types</a>
<ul>
<li class="chapter" data-level="9.5.1" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#bar-plots"><i class="fa fa-check"></i><b>9.5.1</b> bar plots</a></li>
<li class="chapter" data-level="9.5.2" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#box-plots"><i class="fa fa-check"></i><b>9.5.2</b> box plots</a></li>
</ul></li>
<li class="chapter" data-level="9.6" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#take-aways-6"><i class="fa fa-check"></i><b>9.6</b> Take Aways</a></li>
<li class="chapter" data-level="9.7" data-path="tutorial-data-visualization-with-ggplot.html"><a href="tutorial-data-visualization-with-ggplot.html#additional-tutorials-5"><i class="fa fa-check"></i><b>9.7</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="10" data-path="exercise-3-test-your-knowledge.html"><a href="exercise-3-test-your-knowledge.html"><i class="fa fa-check"></i><b>10</b> Exercise 3: Test your knowledge</a>
<ul>
<li class="chapter" data-level="10.1" data-path="exercise-3-test-your-knowledge.html"><a href="exercise-3-test-your-knowledge.html#task-1-2"><i class="fa fa-check"></i><b>10.1</b> Task 1</a></li>
<li class="chapter" data-level="10.2" data-path="exercise-3-test-your-knowledge.html"><a href="exercise-3-test-your-knowledge.html#task-2-2"><i class="fa fa-check"></i><b>10.2</b> Task 2</a></li>
<li class="chapter" data-level="10.3" data-path="exercise-3-test-your-knowledge.html"><a href="exercise-3-test-your-knowledge.html#task-3-2"><i class="fa fa-check"></i><b>10.3</b> Task 3</a></li>
</ul></li>
<li class="chapter" data-level="11" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html"><i class="fa fa-check"></i><b>11</b> Tutorial: Linear regression</a>
<ul>
<li class="chapter" data-level="11.1" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#knowing-your-data"><i class="fa fa-check"></i><b>11.1</b> Knowing your data</a></li>
<li class="chapter" data-level="11.2" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#visual-inspection-of-linear-trends"><i class="fa fa-check"></i><b>11.2</b> Visual inspection of linear trends</a></li>
<li class="chapter" data-level="11.3" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#pearsons-r"><i class="fa fa-check"></i><b>11.3</b> Pearson´s r</a></li>
<li class="chapter" data-level="11.4" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#ols-regression"><i class="fa fa-check"></i><b>11.4</b> OLS regression</a></li>
<li class="chapter" data-level="11.5" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#standardizing-coefficients"><i class="fa fa-check"></i><b>11.5</b> Standardizing coefficients</a></li>
<li class="chapter" data-level="11.6" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#multiple-regression"><i class="fa fa-check"></i><b>11.6</b> Multiple regression</a></li>
<li class="chapter" data-level="11.7" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#standardized-multiple-regression"><i class="fa fa-check"></i><b>11.7</b> Standardized multiple regression</a></li>
<li class="chapter" data-level="11.8" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#take-aways-7"><i class="fa fa-check"></i><b>11.8</b> Take Aways</a></li>
<li class="chapter" data-level="11.9" data-path="tutorial-linear-regression.html"><a href="tutorial-linear-regression.html#additional-tutorials-6"><i class="fa fa-check"></i><b>11.9</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="12" data-path="exercise-4-test-your-knowledge.html"><a href="exercise-4-test-your-knowledge.html"><i class="fa fa-check"></i><b>12</b> Exercise 4: Test your knowledge</a>
<ul>
<li class="chapter" data-level="12.1" data-path="exercise-4-test-your-knowledge.html"><a href="exercise-4-test-your-knowledge.html#task-1-3"><i class="fa fa-check"></i><b>12.1</b> Task 1</a></li>
<li class="chapter" data-level="12.2" data-path="exercise-4-test-your-knowledge.html"><a href="exercise-4-test-your-knowledge.html#task-2-3"><i class="fa fa-check"></i><b>12.2</b> Task 2</a></li>
<li class="chapter" data-level="12.3" data-path="exercise-4-test-your-knowledge.html"><a href="exercise-4-test-your-knowledge.html#task-3-3"><i class="fa fa-check"></i><b>12.3</b> Task 3</a></li>
<li class="chapter" data-level="12.4" data-path="exercise-4-test-your-knowledge.html"><a href="exercise-4-test-your-knowledge.html#task-4-2"><i class="fa fa-check"></i><b>12.4</b> Task 4</a></li>
<li class="chapter" data-level="12.5" data-path="exercise-4-test-your-knowledge.html"><a href="exercise-4-test-your-knowledge.html#task-5-2"><i class="fa fa-check"></i><b>12.5</b> Task 5</a></li>
<li class="chapter" data-level="12.6" data-path="exercise-4-test-your-knowledge.html"><a href="exercise-4-test-your-knowledge.html#task-6-1"><i class="fa fa-check"></i><b>12.6</b> Task 6</a></li>
</ul></li>
<li class="chapter" data-level="13" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html"><i class="fa fa-check"></i><b>13</b> Tutorial: Mediation analysis</a>
<ul>
<li class="chapter" data-level="13.1" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#introduction-to-mediation"><i class="fa fa-check"></i><b>13.1</b> Introduction to mediation</a></li>
<li class="chapter" data-level="13.2" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#difference-between-mediation-and-moderation"><i class="fa fa-check"></i><b>13.2</b> Difference between mediation and moderation</a></li>
<li class="chapter" data-level="13.3" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#two-step-process-of-mediation"><i class="fa fa-check"></i><b>13.3</b> Two-step process of mediation</a></li>
<li class="chapter" data-level="13.4" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#statistical-representation-and-equations"><i class="fa fa-check"></i><b>13.4</b> Statistical representation and equations</a>
<ul>
<li class="chapter" data-level="13.4.1" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#direct-effect-c"><i class="fa fa-check"></i><b>13.4.1</b> Direct effect <em>c′</em></a></li>
<li class="chapter" data-level="13.4.2" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#indirect-effect-ab"><i class="fa fa-check"></i><b>13.4.2</b> Indirect effect <em>ab</em></a></li>
<li class="chapter" data-level="13.4.3" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#total-effect"><i class="fa fa-check"></i><b>13.4.3</b> Total effect</a></li>
</ul></li>
<li class="chapter" data-level="13.5" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#example"><i class="fa fa-check"></i><b>13.5</b> Example</a>
<ul>
<li class="chapter" data-level="13.5.1" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#knowing-your-data-1"><i class="fa fa-check"></i><b>13.5.1</b> Knowing your data</a></li>
<li class="chapter" data-level="13.5.2" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#visual-inspection-of-linear-trends-1"><i class="fa fa-check"></i><b>13.5.2</b> Visual inspection of linear trends</a></li>
<li class="chapter" data-level="13.5.3" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#pearsons-r-1"><i class="fa fa-check"></i><b>13.5.3</b> Pearson’s r</a></li>
<li class="chapter" data-level="13.5.4" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#fit-models"><i class="fa fa-check"></i><b>13.5.4</b> Fit models</a></li>
<li class="chapter" data-level="13.5.5" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#using-processr"><i class="fa fa-check"></i><b>13.5.5</b> Using processR</a></li>
</ul></li>
<li class="chapter" data-level="13.6" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#take-aways-8"><i class="fa fa-check"></i><b>13.6</b> Take Aways</a></li>
<li class="chapter" data-level="13.7" data-path="tutorial-mediation-analysis.html"><a href="tutorial-mediation-analysis.html#additional-tutorials-7"><i class="fa fa-check"></i><b>13.7</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="14" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html"><i class="fa fa-check"></i><b>14</b> Exercise 5: Test your knowledge</a>
<ul>
<li class="chapter" data-level="14.1" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html#task-1-4"><i class="fa fa-check"></i><b>14.1</b> Task 1</a></li>
<li class="chapter" data-level="14.2" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html#task-2-4"><i class="fa fa-check"></i><b>14.2</b> Task 2</a></li>
<li class="chapter" data-level="14.3" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html#task-3-4"><i class="fa fa-check"></i><b>14.3</b> Task 3</a></li>
<li class="chapter" data-level="14.4" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html#task-4-3"><i class="fa fa-check"></i><b>14.4</b> Task 4</a></li>
<li class="chapter" data-level="14.5" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html#task-5-3"><i class="fa fa-check"></i><b>14.5</b> Task 5</a></li>
<li class="chapter" data-level="14.6" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html#task-6-2"><i class="fa fa-check"></i><b>14.6</b> Task 6</a></li>
<li class="chapter" data-level="14.7" data-path="exercise-5-test-your-knowledge.html"><a href="exercise-5-test-your-knowledge.html#task-7-1"><i class="fa fa-check"></i><b>14.7</b> Task 7</a></li>
</ul></li>
<li class="chapter" data-level="15" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html"><i class="fa fa-check"></i><b>15</b> Tutorial: Moderation analysis</a>
<ul>
<li class="chapter" data-level="15.1" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#introduction-to-moderation"><i class="fa fa-check"></i><b>15.1</b> Introduction to moderation</a></li>
<li class="chapter" data-level="15.2" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#one-step-process-of-moderation"><i class="fa fa-check"></i><b>15.2</b> One-step process of moderation</a></li>
<li class="chapter" data-level="15.3" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#statistical-representation-and-equations-1"><i class="fa fa-check"></i><b>15.3</b> Statistical representation and equations</a></li>
<li class="chapter" data-level="15.4" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#example-1"><i class="fa fa-check"></i><b>15.4</b> Example</a>
<ul>
<li class="chapter" data-level="15.4.1" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#knowing-your-data-2"><i class="fa fa-check"></i><b>15.4.1</b> Knowing your data</a></li>
<li class="chapter" data-level="15.4.2" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#visual-inspection-of-linear-trends-2"><i class="fa fa-check"></i><b>15.4.2</b> Visual inspection of linear trends</a></li>
<li class="chapter" data-level="15.4.3" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#fit-models-1"><i class="fa fa-check"></i><b>15.4.3</b> Fit models</a></li>
<li class="chapter" data-level="15.4.4" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#standardization-and-mean-centering"><i class="fa fa-check"></i><b>15.4.4</b> Standardization and mean-centering</a></li>
<li class="chapter" data-level="15.4.5" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#follow-up-analysis-pobing-the-interaction"><i class="fa fa-check"></i><b>15.4.5</b> Follow-up analysis: Pobing the interaction</a></li>
<li class="chapter" data-level="15.4.6" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#using-processr-1"><i class="fa fa-check"></i><b>15.4.6</b> Using processR</a></li>
</ul></li>
<li class="chapter" data-level="15.5" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#take-aways-9"><i class="fa fa-check"></i><b>15.5</b> Take Aways</a></li>
<li class="chapter" data-level="15.6" data-path="tutorial-moderation-analysis.html"><a href="tutorial-moderation-analysis.html#additional-tutorials-8"><i class="fa fa-check"></i><b>15.6</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="16" data-path="exercise-6-test-your-knowledge.html"><a href="exercise-6-test-your-knowledge.html"><i class="fa fa-check"></i><b>16</b> Exercise 6: Test your knowledge</a>
<ul>
<li class="chapter" data-level="16.1" data-path="exercise-6-test-your-knowledge.html"><a href="exercise-6-test-your-knowledge.html#task-1-5"><i class="fa fa-check"></i><b>16.1</b> Task 1</a></li>
<li class="chapter" data-level="16.2" data-path="exercise-6-test-your-knowledge.html"><a href="exercise-6-test-your-knowledge.html#task-2-5"><i class="fa fa-check"></i><b>16.2</b> Task 2</a></li>
<li class="chapter" data-level="16.3" data-path="exercise-6-test-your-knowledge.html"><a href="exercise-6-test-your-knowledge.html#task-3-5"><i class="fa fa-check"></i><b>16.3</b> Task 3</a></li>
<li class="chapter" data-level="16.4" data-path="exercise-6-test-your-knowledge.html"><a href="exercise-6-test-your-knowledge.html#task-4-4"><i class="fa fa-check"></i><b>16.4</b> Task 4</a></li>
<li class="chapter" data-level="16.5" data-path="exercise-6-test-your-knowledge.html"><a href="exercise-6-test-your-knowledge.html#task-5-4"><i class="fa fa-check"></i><b>16.5</b> Task 5</a></li>
<li class="chapter" data-level="16.6" data-path="exercise-6-test-your-knowledge.html"><a href="exercise-6-test-your-knowledge.html#task-6-3"><i class="fa fa-check"></i><b>16.6</b> Task 6</a></li>
</ul></li>
<li class="chapter" data-level="17" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html"><i class="fa fa-check"></i><b>17</b> Tutorial: CPA and model fit</a>
<ul>
<li class="chapter" data-level="17.1" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html#what-is-cpa"><i class="fa fa-check"></i><b>17.1</b> What is CPA?</a></li>
<li class="chapter" data-level="17.2" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html#fitting-models-with-lavaan"><i class="fa fa-check"></i><b>17.2</b> Fitting models with lavaan</a></li>
<li class="chapter" data-level="17.3" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html#example-evaluate-model-fit-for-complex-models"><i class="fa fa-check"></i><b>17.3</b> Example: Evaluate model fit for complex models</a>
<ul>
<li class="chapter" data-level="17.3.1" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html#theory-driven-hypotheses"><i class="fa fa-check"></i><b>17.3.1</b> Theory-driven hypotheses</a></li>
<li class="chapter" data-level="17.3.2" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html#model-fit-and-evaluation"><i class="fa fa-check"></i><b>17.3.2</b> Model fit and evaluation</a></li>
</ul></li>
<li class="chapter" data-level="17.4" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html#take-aways-10"><i class="fa fa-check"></i><b>17.4</b> Take-Aways</a></li>
<li class="chapter" data-level="17.5" data-path="tutorial-cpa-and-model-fit.html"><a href="tutorial-cpa-and-model-fit.html#additional-tutorials-9"><i class="fa fa-check"></i><b>17.5</b> Additional tutorials</a></li>
</ul></li>
<li class="chapter" data-level="18" data-path="exercise-7-test-your-knowledge.html"><a href="exercise-7-test-your-knowledge.html"><i class="fa fa-check"></i><b>18</b> Exercise 7: Test your knowledge</a>
<ul>
<li class="chapter" data-level="18.1" data-path="exercise-7-test-your-knowledge.html"><a href="exercise-7-test-your-knowledge.html#task-1-6"><i class="fa fa-check"></i><b>18.1</b> Task 1</a></li>
<li class="chapter" data-level="18.2" data-path="exercise-7-test-your-knowledge.html"><a href="exercise-7-test-your-knowledge.html#task-2-6"><i class="fa fa-check"></i><b>18.2</b> Task 2</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html"><i class="fa fa-check"></i>Solutions</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#solutions-for-exercise-1"><i class="fa fa-check"></i>Solutions for Exercise 1</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-1-7"><i class="fa fa-check"></i>Task 1</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-2-7"><i class="fa fa-check"></i>Task 2</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-3-6"><i class="fa fa-check"></i>Task 3</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-4-5"><i class="fa fa-check"></i>Task 4</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-5-5"><i class="fa fa-check"></i>Task 5</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#solutions-for-exercise-2"><i class="fa fa-check"></i>Solutions for Exercise 2</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-1-8"><i class="fa fa-check"></i>Task 1</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-2-8"><i class="fa fa-check"></i>Task 2</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-3-7"><i class="fa fa-check"></i>Task 3</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-4-6"><i class="fa fa-check"></i>Task 4</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-5-6"><i class="fa fa-check"></i>Task 5</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-6-4"><i class="fa fa-check"></i>Task 6</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-7-2"><i class="fa fa-check"></i>Task 7</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#solutions-for-exercise-3"><i class="fa fa-check"></i>Solutions for Exercise 3</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-1-9"><i class="fa fa-check"></i>Task 1</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-2-9"><i class="fa fa-check"></i>Task 2</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-3-8"><i class="fa fa-check"></i>Task 3</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#solutions-for-exercise-4"><i class="fa fa-check"></i>Solutions for Exercise 4</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-1-10"><i class="fa fa-check"></i>Task 1</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-2-10"><i class="fa fa-check"></i>Task 2</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-3-9"><i class="fa fa-check"></i>Task 3</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-4-7"><i class="fa fa-check"></i>Task 4</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-5-7"><i class="fa fa-check"></i>Task 5</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-6-5"><i class="fa fa-check"></i>Task 6</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#solutions-for-exercise-5"><i class="fa fa-check"></i>Solutions for Exercise 5</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-1-11"><i class="fa fa-check"></i>Task 1</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-2-11"><i class="fa fa-check"></i>Task 2</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-3-10"><i class="fa fa-check"></i>Task 3</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-4-8"><i class="fa fa-check"></i>Task 4</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-5-8"><i class="fa fa-check"></i>Task 5</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-6-6"><i class="fa fa-check"></i>Task 6</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-7-3"><i class="fa fa-check"></i>Task 7</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#solutions-for-exercise-6"><i class="fa fa-check"></i>Solutions for Exercise 6</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-1-12"><i class="fa fa-check"></i>Task 1</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-2-12"><i class="fa fa-check"></i>Task 2</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-3-11"><i class="fa fa-check"></i>Task 3</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-4-9"><i class="fa fa-check"></i>Task 4</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-5-9"><i class="fa fa-check"></i>Task 5</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-6-7"><i class="fa fa-check"></i>Task 6</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#solutions-for-exercise-7"><i class="fa fa-check"></i>Solutions for Exercise 7</a>
<ul>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-1-13"><i class="fa fa-check"></i>Task 1</a></li>
<li class="chapter" data-level="" data-path="solutions.html"><a href="solutions.html#task-2-13"><i class="fa fa-check"></i>Task 2</a></li>
</ul></li>
</ul></li>
<li class="divider"></li>
<li><a href="https://github.com/LKobilke/CPA-Seminar" target="blank">Published with bookdown</a></li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">R for Conditional Process Analysis</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<div id="exercise-4-test-your-knowledge" class="section level1" number="12">
<h1><span class="header-section-number"> 12</span> Exercise 4: Test your knowledge</h1>
<p><strong>After working through Exercise 4, you’ll…</strong></p>
<ul>
<li>have practiced to run simple and multiple linear regression models in R</li>
<li>know how to use coefficient standardization to compare effect sizes</li>
<li>know how to interpret the results of these models</li>
</ul>
<div id="task-1-3" class="section level2" number="12.1">
<h2><span class="header-section-number">12.1</span> Task 1</h2>
<p>Let’s use the data set <em>glbwarm</em> again, which you should know well by now. Install / activate the <code>processR</code> package and assign the <em>glbwarm</em> data to a source object.</p>
<div class="sourceCode" id="cb254"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb254-1"><a href="exercise-4-test-your-knowledge.html#cb254-1" aria-hidden="true" tabindex="-1"></a><span class="co"># installing/loading the package:</span></span>
<span id="cb254-2"><a href="exercise-4-test-your-knowledge.html#cb254-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span>(<span class="sc">!</span><span class="fu">require</span>(processR)) {</span>
<span id="cb254-3"><a href="exercise-4-test-your-knowledge.html#cb254-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">install.packages</span>(<span class="st">"processR"</span>); </span>
<span id="cb254-4"><a href="exercise-4-test-your-knowledge.html#cb254-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">require</span>(processR)</span>
<span id="cb254-5"><a href="exercise-4-test-your-knowledge.html#cb254-5" aria-hidden="true" tabindex="-1"></a>} <span class="co">#load / install+load processR</span></span>
<span id="cb254-6"><a href="exercise-4-test-your-knowledge.html#cb254-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb254-7"><a href="exercise-4-test-your-knowledge.html#cb254-7" aria-hidden="true" tabindex="-1"></a>data <span class="ot"><-</span> processR<span class="sc">::</span>glbwarm</span></code></pre></div>
<p>In this task, we want to tackle simple linear regression. More specifically, we want to predict the <em>ideology</em> of our respondents by their <em>age</em> because we assume that older respondents will hold more conservative viewpoints. The higher the values of the <em>ideology</em> variable, the more conservative the respondents are (coded from 1 ‘very liberal’ to 7 ‘very conservative’).</p>
<p><strong>Research question:</strong> Do older U.S. Americans hold more conservative viewpoints than younger U.S. Americans?</p>
<p>To answer this question, prepare a visual inspection of this relationship without fitting a regression line. Can you recognize a relationship? What is its nature?</p>
</div>
<div id="task-2-3" class="section level2" number="12.2">
<h2><span class="header-section-number">12.2</span> Task 2</h2>
<p>Next, try to quantify the association using Pearson’s r. Interpret the result.</p>
</div>
<div id="task-3-3" class="section level2" number="12.3">
<h2><span class="header-section-number">12.3</span> Task 3</h2>
<p>Using your graph from Task 1, fit a regression line to your data points (<strong>Hint:</strong> You will need to load the <code>ggpubr</code> package). Interpret the parameters of the regression line.</p>
</div>
<div id="task-4-2" class="section level2" number="12.4">
<h2><span class="header-section-number">12.4</span> Task 4</h2>
<p>Run a linear model in R using the <em>ideology</em> and <em>age</em> variables. Interpret the results.</p>
</div>
<div id="task-5-2" class="section level2" number="12.5">
<h2><span class="header-section-number">12.5</span> Task 5</h2>
<p>Since age alone does not seem to be a good predictor of conservatism, we want to introduce other predictors into the model and run a Multiple Linear Regression. This means that we will predict the effect of age on conservatism while controlling for the effect of third variables. For example, the respondents’ gender (<em>sex</em>, 0 = female, 1 = male) and their party preference (<em>partyid</em>, 1 = Democrat, 2 = Independent, 3 = Republican) might be great predictors of conservatism.</p>
<p><strong>Note:</strong> In a linear regression model, we can only include metric variables and variables that are binary coded (0/1). However, <em>partyid</em> is a categorical, i.e. factor variable, since Democrats are coded 1, Independents 2, and Republicans 3. Therefore, you need to mutate <em>partyid</em> and create two new binary variables <em>democrat</em> (0/1) and <em>republican</em> (0/1), where 1 indicates that the respondent identifies with that political party. (You don’t need to create a variable <em>independent</em>, since that information would be redundant: someone who has a value of 0 for both <em>republican</em> AND <em>democrat</em> MUST be an independent, so you can derive party preference with just two variables).</p>
<p>Then, run a multiple linear model that predicts <em>ideology</em> by <em>sex</em>, <em>democrat</em>, <em>republican</em>, and <em>age</em>. Interpret the results and the meaning of the age coefficient.</p>
</div>
<div id="task-6-1" class="section level2" number="12.6">
<h2><span class="header-section-number">12.6</span> Task 6</h2>
<p>Standardize all relevant variables and run the model again (note that binary variables shouldn’t be standardized). How does the interpretation of the age coefficient change?</p>
</div>
</div>
</section>
</div>
</div>
</div>
<a href="tutorial-linear-regression.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="tutorial-mediation-analysis.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"whatsapp": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/LKobilke/CPA-Seminar/edit/main/index.Rmd",
"text": "Edit"
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": ["CPA Seminar.pdf"],
"search": {
"engine": "fuse",
"options": null
},
"toc": {
"collapse": "subsection"
}
});
});
</script>
</body>
</html>