forked from giordanon/Systematic-reviews-in-R
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSystematic_reviews_in_R.html
1012 lines (979 loc) · 89 KB
/
Systematic_reviews_in_R.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.2.269">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Nicolas Giordano">
<meta name="dcterms.date" content="2023-03-23">
<title>Systematic reviews procedures in R</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@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 { color: #008000; } /* 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 { color: #008000; font-weight: bold; } /* 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>
<script src="Systematic_reviews_in_R_files/libs/clipboard/clipboard.min.js"></script>
<script src="Systematic_reviews_in_R_files/libs/quarto-html/quarto.js"></script>
<script src="Systematic_reviews_in_R_files/libs/quarto-html/popper.min.js"></script>
<script src="Systematic_reviews_in_R_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="Systematic_reviews_in_R_files/libs/quarto-html/anchor.min.js"></script>
<link href="Systematic_reviews_in_R_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="Systematic_reviews_in_R_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="Systematic_reviews_in_R_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="Systematic_reviews_in_R_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="Systematic_reviews_in_R_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<style>html{ scroll-behavior: smooth; }</style>
</head>
<body>
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article toc-left">
<div id="quarto-sidebar-toc-left" class="sidebar toc-left">
<nav id="TOC" role="doc-toc" class="toc-active">
<h2 id="toc-title">Contents</h2>
<ul>
<li><a href="#data-collection" id="toc-data-collection" class="nav-link active" data-scroll-target="#data-collection">Data Collection</a>
<ul>
<li><a href="#scopus-querys" id="toc-scopus-querys" class="nav-link" data-scroll-target="#scopus-querys">SCOPUS QUERYS</a></li>
<li><a href="#how-we-download-a-list-of-abstracts-all-at-once" id="toc-how-we-download-a-list-of-abstracts-all-at-once" class="nav-link" data-scroll-target="#how-we-download-a-list-of-abstracts-all-at-once">How we download a list of abstracts all at once?</a></li>
<li><a href="#first-article-screening" id="toc-first-article-screening" class="nav-link" data-scroll-target="#first-article-screening">1. First article screening</a></li>
<li><a href="#section" id="toc-section" class="nav-link" data-scroll-target="#section">2.</a>
<ul class="collapse">
<li><a href="#second-article-screening" id="toc-second-article-screening" class="nav-link" data-scroll-target="#second-article-screening">Second article screening</a></li>
</ul></li>
<li><a href="#section-1" id="toc-section-1" class="nav-link" data-scroll-target="#section-1">3.</a>
<ul class="collapse">
<li><a href="#merge-the-first-and-second-screenings-and-get-only-the-articles-that-were-not-screened-yet." id="toc-merge-the-first-and-second-screenings-and-get-only-the-articles-that-were-not-screened-yet." class="nav-link" data-scroll-target="#merge-the-first-and-second-screenings-and-get-only-the-articles-that-were-not-screened-yet.">Merge the first and second screenings and get only the articles that WERE NOT SCREENED YET.</a></li>
</ul></li>
<li><a href="#run-revtools-shiny-app" id="toc-run-revtools-shiny-app" class="nav-link" data-scroll-target="#run-revtools-shiny-app">4. Run revtools shiny app</a></li>
</ul></li>
<li><a href="#hands-on" id="toc-hands-on" class="nav-link" data-scroll-target="#hands-on">HANDS ON</a>
<ul>
<li><a href="#meta-analytic-data" id="toc-meta-analytic-data" class="nav-link" data-scroll-target="#meta-analytic-data">Meta-analytic data</a>
<ul class="collapse">
<li><a href="#load-data-and-wrangling" id="toc-load-data-and-wrangling" class="nav-link" data-scroll-target="#load-data-and-wrangling">Load data and wrangling</a></li>
<li><a href="#imputation-of-missing-data" id="toc-imputation-of-missing-data" class="nav-link" data-scroll-target="#imputation-of-missing-data">1. Imputation of missing data</a>
<ul class="collapse">
<li><a href="#run-multiple.imputation" id="toc-run-multiple.imputation" class="nav-link" data-scroll-target="#run-multiple.imputation">1.1) Run multiple.imputation()</a></li>
</ul></li>
<li><a href="#calculate-effect-sizes-pooled-sample-variance" id="toc-calculate-effect-sizes-pooled-sample-variance" class="nav-link" data-scroll-target="#calculate-effect-sizes-pooled-sample-variance">2. Calculate effect sizes & pooled sample variance</a></li>
<li><a href="#run-pooled-model---intercept-only" id="toc-run-pooled-model---intercept-only" class="nav-link" data-scroll-target="#run-pooled-model---intercept-only">3. Run pooled model - intercept only</a></li>
<li><a href="#influential-studies-diagnosis" id="toc-influential-studies-diagnosis" class="nav-link" data-scroll-target="#influential-studies-diagnosis">4. Influential Studies Diagnosis</a></li>
<li><a href="#run-unbootstrapped-model" id="toc-run-unbootstrapped-model" class="nav-link" data-scroll-target="#run-unbootstrapped-model">5. Run unbootstrapped model</a></li>
<li><a href="#run-bootstrapped-models" id="toc-run-bootstrapped-models" class="nav-link" data-scroll-target="#run-bootstrapped-models">6. Run bootstrapped models</a>
<ul class="collapse">
<li><a href="#pooled-effects-intercept-only-model" id="toc-pooled-effects-intercept-only-model" class="nav-link" data-scroll-target="#pooled-effects-intercept-only-model">6.1) Pooled effects, intercept only model</a></li>
<li><a href="#test-potential-moderators" id="toc-test-potential-moderators" class="nav-link" data-scroll-target="#test-potential-moderators">6.2) Test potential moderators</a></li>
<li><a href="#summarize-bootstraps" id="toc-summarize-bootstraps" class="nav-link" data-scroll-target="#summarize-bootstraps">6.3) Summarize bootstraps</a></li>
<li><a href="#plot" id="toc-plot" class="nav-link" data-scroll-target="#plot">6.4) Plot</a></li>
</ul></li>
</ul></li>
</ul></li>
</ul>
</nav>
</div>
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
</div>
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<div class="quarto-title-block"><div><h1 class="title">Systematic reviews procedures in R</h1><button type="button" class="btn code-tools-button dropdown-toggle" id="quarto-code-tools-menu" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi"></i> Code</button><ul class="dropdown-menu dropdown-menu-end" aria-labelelledby="quarto-code-tools-menu"><li><a id="quarto-show-all-code" class="dropdown-item" href="javascript:void(0)" role="button">Show All Code</a></li><li><a id="quarto-hide-all-code" class="dropdown-item" href="javascript:void(0)" role="button">Hide All Code</a></li><li><hr class="dropdown-divider"></li><li><a id="quarto-view-source" class="dropdown-item" href="javascript:void(0)" role="button">View Source</a></li></ul></div></div>
<p class="subtitle lead">A compilation of methods and funtions for meta-analytic data in R</p>
</div>
<div class="quarto-title-meta">
<div>
<div class="quarto-title-meta-heading">Author</div>
<div class="quarto-title-meta-contents">
<p>Nicolas Giordano </p>
</div>
</div>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">March 23, 2023</p>
</div>
</div>
</div>
<div>
<div class="abstract">
<div class="abstract-title">Summary</div>
Lack of agreement in scientific findings derives in the need of exploring meta-analytic techniques. Systematic reviews tend to provide an UNBIASED method for answering specific questions. This code glimpses my personal experience while conducting a meta-analysis. I expect to help by sharing my own mistakes but also interesting functions to make meta-analytic research more friendly and approachable.
</div>
</div>
</header>
<section id="data-collection" class="level2">
<h2 class="anchored" data-anchor-id="data-collection">Data Collection</h2>
<section id="scopus-querys" class="level3">
<h3 class="anchored" data-anchor-id="scopus-querys">SCOPUS QUERYS</h3>
<p>Lining out the search query one step at a time for REPLICABILITY</p>
<p><a href="https://www.scopus.com/search/form.uri?display=advanced">SCOPUS advanced search</a></p>
<p>SOURCE-ID (78796 OR 59988 OR 38753 OR 15639) AND</p>
<p>TITLE( (wheat OR nitrogen) AND (protein OR yield) ) AND</p>
<p>PUBYEAR > 1980</p>
</section>
<section id="how-we-download-a-list-of-abstracts-all-at-once" class="level3">
<h3 class="anchored" data-anchor-id="how-we-download-a-list-of-abstracts-all-at-once">How we download a list of abstracts all at once?</h3>
<ol type="1">
<li><p>Select all articles</p></li>
<li><p>Click on “Export CSV”</p></li>
<li><p>From the bulleted list select all those features you will need for further exploration of articles (Title, authors, publication year, abstract, etc)</p></li>
<li><p>Download files with the extension <em>.ris</em>, which can be handled by <em>revtools</em> package.</p></li>
</ol>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span>opts_chunk<span class="sc">$</span><span class="fu">set</span>(<span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">message =</span> <span class="cn">FALSE</span>, <span class="at">warning =</span> <span class="cn">FALSE</span>, <span class="at">tidy =</span> <span class="cn">TRUE</span>)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Required packages</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="co">#install.packages("pacman")</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(pacman)</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="fu">p_load</span>(<span class="st">"tidyverse"</span>, <span class="co">#data wrangling </span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"revtools"</span>, <span class="co"># article handling</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"readxl"</span>, <span class="co"># readl excel files</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"janitor"</span>, <span class="co"># column names</span></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> <span class="st">"bayestestR"</span>, <span class="co"># bootstrap summaries</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> <span class="st">"mi"</span>, <span class="co"># multiple imputation</span></span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a> <span class="st">"metafor"</span>, <span class="co"># meta-analytic model</span></span>
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> <span class="st">"multidplyr"</span>, <span class="st">"parallel"</span>) <span class="co"># parallel processing</span></span>
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a><span class="co"># Custom functions</span></span>
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"functions_sys_reviews.R"</span>)</span>
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a><span class="st">`</span><span class="at">%nin%</span><span class="st">`</span> <span class="ot"><-</span> <span class="fu">Negate</span>(<span class="st">`</span><span class="at">%in%</span><span class="st">`</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="first-article-screening" class="level3">
<h3 class="anchored" data-anchor-id="first-article-screening">1. First article screening</h3>
<p>Query -</p>
<p>SOURCE-ID (78796 OR 59988 OR 38753 OR 15639) AND</p>
<p><strong>TITLE</strong>( (wheat OR nitrogen) AND (protein OR yield) ) AND</p>
<p>PUBYEAR > 1980</p>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>path <span class="ot"><-</span> <span class="st">"articles/articles already searched/"</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>files <span class="ot"><-</span> <span class="fu">list.files</span>(<span class="at">path =</span> path, <span class="at">pattern =</span> <span class="st">"*.ris"</span>)</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a>first_search <span class="ot">=</span> <span class="fu">load_bibliography</span>(<span class="at">path =</span> path, <span class="at">files =</span> files)</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="fu">View</span>(first_search[,<span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>])</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="section" class="level3">
<h3 class="anchored" data-anchor-id="section">2.</h3>
<section id="second-article-screening" class="level4">
<h4 class="anchored" data-anchor-id="second-article-screening">Second article screening</h4>
<p>Query -</p>
<p>SOURCE-ID (78796 OR 59988 OR 38753 OR 15639) AND</p>
<p><strong>TITLE-ABS-KEY</strong>( (wheat OR nitrogen) AND (protein OR yield) ) AND</p>
<p>PUBYEAR > 1980</p>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>path2 <span class="ot"><-</span> <span class="st">"articles/new search/"</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>files2 <span class="ot"><-</span> <span class="fu">list.files</span>(<span class="at">path =</span> path2, <span class="at">pattern =</span> <span class="st">"*.ris"</span>)</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a>second_search <span class="ot"><-</span> <span class="fu">load_bibliography</span>(<span class="at">path =</span> path2, <span class="at">files =</span> files2)</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="fu">View</span>(second_search)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
</section>
<section id="section-1" class="level3">
<h3 class="anchored" data-anchor-id="section-1">3.</h3>
<section id="merge-the-first-and-second-screenings-and-get-only-the-articles-that-were-not-screened-yet." class="level4">
<h4 class="anchored" data-anchor-id="merge-the-first-and-second-screenings-and-get-only-the-articles-that-were-not-screened-yet.">Merge the first and second screenings and get only the articles that WERE NOT SCREENED YET.</h4>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>df_final <span class="ot"><-</span> <span class="fu">anti_join</span>(second_search, first_search)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(<span class="at">x =</span> df_final, <span class="at">file =</span> <span class="st">"articles_search_final.csv"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
</section>
<section id="run-revtools-shiny-app" class="level3">
<h3 class="anchored" data-anchor-id="run-revtools-shiny-app">4. Run revtools shiny app</h3>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co">#screen_abstracts(max_file_size = 10)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
</section>
<section id="hands-on" class="level1">
<h1>HANDS ON</h1>
<p>In this section we will:</p>
<ol type="1">
<li><p>Impute missing data using <em>mi</em> package</p></li>
<li><p>Calculate effect sizes</p></li>
<li><p>Run a pooled effects model</p></li>
<li><p>Test potential factor driving the size of the observed effects .</p></li>
<li><p>We will utilize bootstrapping techniques and parallel processing for making the code run faster.</p></li>
<li><p>Produce a forest plot.</p></li>
</ol>
<section id="meta-analytic-data" class="level2">
<h2 class="anchored" data-anchor-id="meta-analytic-data">Meta-analytic data</h2>
<p>As an example we will use data from split N application in with crops. This meta analysis is comparing whether applying N on a single dose or splitting(2 splits, 3 splits or just split, regardless or number of splits) has any effect on wheat yields.</p>
<p>It does also compared how different factors (called moderators if categorical) affect the size of the observed effects.</p>
<p>The article can be find here <a href="https://www.sciencedirect.com/science/article/pii/S0167198721001847">Hu et al 2021</a></p>
<section id="load-data-and-wrangling" class="level3">
<h3 class="anchored" data-anchor-id="load-data-and-wrangling">Load data and wrangling</h3>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>data <span class="ot"><-</span> <span class="fu">read_excel</span>(<span class="st">"example_data.xlsx"</span>, <span class="at">skip =</span> <span class="dv">2</span>) <span class="sc">%>%</span> </span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> janitor<span class="sc">::</span><span class="fu">clean_names</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="imputation-of-missing-data" class="level3">
<h3 class="anchored" data-anchor-id="imputation-of-missing-data">1. Imputation of missing data</h3>
<section id="run-multiple.imputation" class="level4">
<h4 class="anchored" data-anchor-id="run-multiple.imputation">1.1) Run multiple.imputation()</h4>
</section>
</section>
<section id="calculate-effect-sizes-pooled-sample-variance" class="level3">
<h3 class="anchored" data-anchor-id="calculate-effect-sizes-pooled-sample-variance">2. Calculate effect sizes & pooled sample variance</h3>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>data.imp_es <span class="ot"><-</span> </span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> data.imp <span class="sc">%>%</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">drop_na</span>(yield_kg_ha_1,reps_1, reps_2, sd1_imp, sd2_imp, yield_kg_ha_2 ) <span class="sc">%>%</span> </span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">transmute</span>(</span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> <span class="at">PAPER_ID =</span> no, </span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> <span class="at">TEXTURE =</span> soil_texture, </span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> <span class="at">AI =</span> aridity_index, </span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a> <span class="at">WHEAT_TYPE =</span> whea_type, </span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a> <span class="at">TILLAGE =</span> tillage,</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a> <span class="co"># Response Ratio</span></span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a> <span class="at">RR =</span> <span class="fu">log</span>(yield_kg_ha_2<span class="sc">/</span>yield_kg_ha_1),</span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a> <span class="co"># Calculate pooled sampling variance</span></span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a> <span class="at">VAR =</span> <span class="fu">pooled.var</span>(<span class="at">sd.treated =</span> sd2_imp, <span class="at">sd.control =</span> sd1_imp,</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a> <span class="at">n.control =</span> reps_1, <span class="at">n.treated =</span> reps_2,</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a> <span class="at">m.treated =</span> yield_kg_ha_1, <span class="at">m.control =</span> yield_kg_ha_2),</span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a> <span class="co"># Weights</span></span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a> <span class="at">W =</span> <span class="dv">1</span><span class="sc">/</span>VAR</span>
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a> )</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="run-pooled-model---intercept-only" class="level3">
<h3 class="anchored" data-anchor-id="run-pooled-model---intercept-only">3. Run pooled model - intercept only</h3>
<p>You can find more info about I2 statistic here: <a href="https://onlinelibrary.wiley.com/doi/full/10.1002/jrsm.1230">Borenstein 2015</a>, <a href="https://onlinelibrary.wiley.com/doi/abs/10.1002/sim.1186">Higgins and Thompson 2002</a></p>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Run pooled model</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>mod <span class="ot"><-</span> <span class="fu">rma</span>(<span class="at">yi =</span> RR,</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <span class="at">vi =</span> VAR,</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <span class="at">weights =</span> W,</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a> <span class="co">#control = list(optimizer="optimParallel", ncpus=3),</span></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> data.imp_es)</span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a><span class="fu">summary</span>(mod)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>
Random-Effects Model (k = 1311; tau^2 estimator: REML)
logLik deviance AIC BIC AICc
1065.9618 -2131.9236 -2127.9236 -2117.5680 -2127.9144
tau^2 (estimated amount of total heterogeneity): 0.0081 (SE = 0.0004)
tau (square root of estimated tau^2 value): 0.0901
I^2 (total heterogeneity / total variability): 91.80%
H^2 (total variability / sampling variability): 12.19
Test for Heterogeneity:
Q(df = 1310) = 13323.5324, p-val < .0001
Model Results:
estimate se zval pval ci.lb ci.ub
0.0200 0.0044 4.5446 <.0001 0.0114 0.0286 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Back transformation</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="fu">trans</span>(<span class="fu">coef</span>(mod))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code> intrcpt
2.021292 </code></pre>
</div>
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>mod<span class="sc">$</span>ci.lb <span class="sc">%>%</span> <span class="fu">trans</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 1.144606</code></pre>
</div>
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>mod<span class="sc">$</span>ci.ub <span class="sc">%>%</span> <span class="fu">trans</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2.905577</code></pre>
</div>
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co"># I squared statistic</span></span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a>mod<span class="sc">$</span>I2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 91.79902</code></pre>
</div>
</div>
</section>
<section id="influential-studies-diagnosis" class="level3">
<h3 class="anchored" data-anchor-id="influential-studies-diagnosis">4. Influential Studies Diagnosis</h3>
<p>When certain studies excert a strong influence in the model output they are consider influential. An influential case can be diagnosed when the cook’s D value for a given study is x 3 times greater than the average Cook’s D of the whole data. Use this citation for the this procedure: <a href="https://www.tandfonline.com/doi/abs/10.1080/01621459.1979.10481634">Cook 1977</a>, <a href="https://www.statisticshowto.com/cooks-distance/">Stephanie 2016</a></p>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="co"># cooks.distance.rma.uni(model = mod, progbar = T) %>% </span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a><span class="co"># saveRDS("output/cooksD_diagnosis.RData")</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a><span class="co"># plot(readRDS("output/cooksD_diagnosis.RData"))</span></span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb18-6"><a href="#cb18-6" aria-hidden="true" tabindex="-1"></a>influential_cases <span class="ot"><-</span> <span class="fu">c</span>(<span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>)</span>
<span id="cb18-7"><a href="#cb18-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb18-8"><a href="#cb18-8" aria-hidden="true" tabindex="-1"></a>data.imp_es_ic <span class="ot"><-</span> </span>
<span id="cb18-9"><a href="#cb18-9" aria-hidden="true" tabindex="-1"></a> data.imp_es <span class="sc">%>%</span> </span>
<span id="cb18-10"><a href="#cb18-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">W =</span> <span class="fu">case_when</span>(PAPER_ID <span class="sc">%in%</span> influential_cases <span class="sc">~</span> <span class="dv">0</span>, T<span class="sc">~</span>W))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="run-unbootstrapped-model" class="level3">
<h3 class="anchored" data-anchor-id="run-unbootstrapped-model">5. Run unbootstrapped model</h3>
<p>Weight of influential studies is set to zero</p>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>mod2 <span class="ot"><-</span> <span class="fu">rma</span>(<span class="at">yi =</span> RR,</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a> <span class="at">vi =</span> VAR,</span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a> <span class="at">weights =</span> W,</span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a> <span class="at">mods =</span> <span class="sc">~</span> <span class="dv">0</span> <span class="sc">+</span> TEXTURE,</span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a> <span class="co">#control = list(optimizer="optimParallel", ncpus=3),</span></span>
<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> data.imp_es_ic)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="run-bootstrapped-models" class="level3">
<h3 class="anchored" data-anchor-id="run-bootstrapped-models">6. Run bootstrapped models</h3>
<p>Citation: <a href="https://www.scopus.com/record/display.uri?eid=2-s2.0-0030613897&origin=inward">Adams et al 1997</a></p>
<section id="pooled-effects-intercept-only-model" class="level4">
<h4 class="anchored" data-anchor-id="pooled-effects-intercept-only-model">6.1) Pooled effects, intercept only model</h4>
</section>
<section id="test-potential-moderators" class="level4">
<h4 class="anchored" data-anchor-id="test-potential-moderators">6.2) Test potential moderators</h4>
</section>
<section id="summarize-bootstraps" class="level4">
<h4 class="anchored" data-anchor-id="summarize-bootstraps">6.3) Summarize bootstraps</h4>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>df.plot <span class="ot"><-</span> <span class="fu">summarise_bootstraps</span>(<span class="fu">readRDS</span>(<span class="st">"output/RR_TEXTURE_mod.RData"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="plot" class="level4">
<h4 class="anchored" data-anchor-id="plot">6.4) Plot</h4>
<div class="cell">
<details>
<summary>Show code</summary>
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a>df.plot <span class="sc">%>%</span> </span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>()<span class="sc">+</span></span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_linerange</span>(<span class="fu">aes</span>(<span class="at">ymin =</span> <span class="fu">trans</span>(ESTIM_q975), <span class="at">ymax =</span> <span class="fu">trans</span>(ESTIM_q025), <span class="at">x =</span> MOD), <span class="at">linewidth =</span> <span class="dv">1</span>)<span class="sc">+</span></span>
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="fu">aes</span>(<span class="at">x =</span> MOD, <span class="at">y =</span> <span class="fu">trans</span>(ESTIM_q500), <span class="at">fill =</span> MOD), <span class="at">shape =</span> <span class="dv">21</span>, <span class="at">size =</span> <span class="dv">6</span>, <span class="at">stroke =</span> <span class="fl">1.2</span>)<span class="sc">+</span></span>
<span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_flip</span>()<span class="sc">+</span> </span>
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">x =</span> <span class="st">"Soil Texture"</span>, <span class="at">y =</span> <span class="st">"Effect Size (%)"</span>)<span class="sc">+</span></span>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">guides</span>(<span class="at">fill =</span> <span class="st">"none"</span>)<span class="sc">+</span></span>
<span id="cb21-8"><a href="#cb21-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_bw</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<p><img src="Systematic_reviews_in_R_files/figure-html/plot-1.png" class="img-fluid" width="672"></p>
</div>
</div>
<!-- -->
</section>
</section>
</section>
</section>
</main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const clipboard = new window.ClipboardJS('.code-copy-button', {
target: function(trigger) {
return trigger.previousElementSibling;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
const viewSource = window.document.getElementById('quarto-view-source') ||
window.document.getElementById('quarto-code-tools-source');
if (viewSource) {
const sourceUrl = viewSource.getAttribute("data-quarto-source-url");
viewSource.addEventListener("click", function(e) {
if (sourceUrl) {
// rstudio viewer pane
if (/\bcapabilities=\b/.test(window.location)) {
window.open(sourceUrl);
} else {
window.location.href = sourceUrl;
}
} else {
const modal = new bootstrap.Modal(document.getElementById('quarto-embedded-source-code-modal'));
modal.show();
}
return false;
});
}
function toggleCodeHandler(show) {
return function(e) {
const detailsSrc = window.document.querySelectorAll(".cell > details > .sourceCode");
for (let i=0; i<detailsSrc.length; i++) {
const details = detailsSrc[i].parentElement;
if (show) {
details.open = true;
} else {
details.removeAttribute("open");
}
}
const cellCodeDivs = window.document.querySelectorAll(".cell > .sourceCode");
const fromCls = show ? "hidden" : "unhidden";
const toCls = show ? "unhidden" : "hidden";
for (let i=0; i<cellCodeDivs.length; i++) {
const codeDiv = cellCodeDivs[i];
if (codeDiv.classList.contains(fromCls)) {
codeDiv.classList.remove(fromCls);
codeDiv.classList.add(toCls);
}
}
return false;
}
}
const hideAllCode = window.document.getElementById("quarto-hide-all-code");
if (hideAllCode) {
hideAllCode.addEventListener("click", toggleCodeHandler(false));
}
const showAllCode = window.document.getElementById("quarto-show-all-code");
if (showAllCode) {
showAllCode.addEventListener("click", toggleCodeHandler(true));
}
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
const cites = parentEl.dataset.cites;
if (cites) {
return {
el,
cites: cites.split(' ')
};
} else {
return findCites(el.parentElement)
}
} else {
return undefined;
}
};
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const citeInfo = findCites(ref);
if (citeInfo) {
tippyHover(citeInfo.el, function() {
var popup = window.document.createElement('div');
citeInfo.cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
}
});
</script><div class="modal fade" id="quarto-embedded-source-code-modal" tabindex="-1" aria-labelledby="quarto-embedded-source-code-modal-label" aria-hidden="true"><div class="modal-dialog modal-dialog-scrollable"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="quarto-embedded-source-code-modal-label">Source Code</h5><button class="btn-close" data-bs-dismiss="modal"></button></div><div class="modal-body"><div class="">
<div class="sourceCode" id="cb22" data-shortcodes="false"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a><span class="an">title:</span><span class="co"> "Systematic reviews procedures in R"</span></span>
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a><span class="an">subtitle:</span><span class="co"> "A compilation of methods and funtions for meta-analytic data in R"</span></span>
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true" tabindex="-1"></a><span class="an">author:</span><span class="co"> "Nicolas Giordano"</span></span>
<span id="cb22-5"><a href="#cb22-5" aria-hidden="true" tabindex="-1"></a><span class="an">date:</span><span class="co"> 03-23-2023</span></span>
<span id="cb22-6"><a href="#cb22-6" aria-hidden="true" tabindex="-1"></a><span class="an">abstract-title:</span><span class="co"> 'Summary'</span></span>
<span id="cb22-7"><a href="#cb22-7" aria-hidden="true" tabindex="-1"></a><span class="an">abstract:</span><span class="co"> 'Lack of agreement in scientific findings derives in the need of exploring meta-analytic techniques. Systematic reviews tend to provide an UNBIASED method for answering specific questions. This code glimpses my personal experience while conducting a meta-analysis. I expect to help by sharing my own mistakes but also interesting functions to make meta-analytic research more friendly and approachable.'</span></span>
<span id="cb22-8"><a href="#cb22-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-9"><a href="#cb22-9" aria-hidden="true" tabindex="-1"></a><span class="an">format:</span></span>
<span id="cb22-10"><a href="#cb22-10" aria-hidden="true" tabindex="-1"></a><span class="co"> html:</span></span>
<span id="cb22-11"><a href="#cb22-11" aria-hidden="true" tabindex="-1"></a><span class="co"> code-tools: true</span></span>
<span id="cb22-12"><a href="#cb22-12" aria-hidden="true" tabindex="-1"></a><span class="co"> code-fold: true</span></span>
<span id="cb22-13"><a href="#cb22-13" aria-hidden="true" tabindex="-1"></a><span class="co"> code-summary: 'Show code'</span></span>
<span id="cb22-14"><a href="#cb22-14" aria-hidden="true" tabindex="-1"></a><span class="co"> code-link: true</span></span>
<span id="cb22-15"><a href="#cb22-15" aria-hidden="true" tabindex="-1"></a><span class="co"> theme: united</span></span>
<span id="cb22-16"><a href="#cb22-16" aria-hidden="true" tabindex="-1"></a><span class="an">toc:</span><span class="co"> true</span></span>
<span id="cb22-17"><a href="#cb22-17" aria-hidden="true" tabindex="-1"></a><span class="an">toc-title:</span><span class="co"> 'Contents'</span></span>
<span id="cb22-18"><a href="#cb22-18" aria-hidden="true" tabindex="-1"></a><span class="an">toc-depth:</span><span class="co"> 4</span></span>
<span id="cb22-19"><a href="#cb22-19" aria-hidden="true" tabindex="-1"></a><span class="an">toc-location:</span><span class="co"> left</span></span>
<span id="cb22-20"><a href="#cb22-20" aria-hidden="true" tabindex="-1"></a><span class="an">number-sections:</span><span class="co"> false</span></span>
<span id="cb22-21"><a href="#cb22-21" aria-hidden="true" tabindex="-1"></a><span class="an">highlight-style:</span><span class="co"> pygments</span></span>
<span id="cb22-22"><a href="#cb22-22" aria-hidden="true" tabindex="-1"></a><span class="an">smooth-scroll:</span><span class="co"> true</span></span>
<span id="cb22-23"><a href="#cb22-23" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
<span id="cb22-24"><a href="#cb22-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-25"><a href="#cb22-25" aria-hidden="true" tabindex="-1"></a><span class="fu">## Data Collection</span></span>
<span id="cb22-26"><a href="#cb22-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-27"><a href="#cb22-27" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-28"><a href="#cb22-28" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-29"><a href="#cb22-29" aria-hidden="true" tabindex="-1"></a><span class="fu">### SCOPUS QUERYS</span></span>
<span id="cb22-30"><a href="#cb22-30" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-31"><a href="#cb22-31" aria-hidden="true" tabindex="-1"></a>Lining out the search query one step at a time for REPLICABILITY</span>
<span id="cb22-32"><a href="#cb22-32" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-33"><a href="#cb22-33" aria-hidden="true" tabindex="-1"></a><span class="co">[</span><span class="ot">SCOPUS advanced search</span><span class="co">](https://www.scopus.com/search/form.uri?display=advanced)</span></span>
<span id="cb22-34"><a href="#cb22-34" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-35"><a href="#cb22-35" aria-hidden="true" tabindex="-1"></a>SOURCE-ID (78796 OR 59988 OR 38753 OR 15639) AND</span>
<span id="cb22-36"><a href="#cb22-36" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-37"><a href="#cb22-37" aria-hidden="true" tabindex="-1"></a>TITLE( (wheat OR nitrogen) AND (protein OR yield) ) AND</span>
<span id="cb22-38"><a href="#cb22-38" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-39"><a href="#cb22-39" aria-hidden="true" tabindex="-1"></a>PUBYEAR <span class="sc">\></span> 1980</span>
<span id="cb22-40"><a href="#cb22-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-41"><a href="#cb22-41" aria-hidden="true" tabindex="-1"></a><span class="fu">### How we download a list of abstracts all at once?</span></span>
<span id="cb22-42"><a href="#cb22-42" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-43"><a href="#cb22-43" aria-hidden="true" tabindex="-1"></a><span class="ss">1. </span>Select all articles</span>
<span id="cb22-44"><a href="#cb22-44" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-45"><a href="#cb22-45" aria-hidden="true" tabindex="-1"></a><span class="ss">2. </span>Click on "Export CSV"</span>
<span id="cb22-46"><a href="#cb22-46" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-47"><a href="#cb22-47" aria-hidden="true" tabindex="-1"></a><span class="ss">3. </span>From the bulleted list select all those features you will need for further exploration of articles (Title, authors, publication year, abstract, etc)</span>
<span id="cb22-48"><a href="#cb22-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-49"><a href="#cb22-49" aria-hidden="true" tabindex="-1"></a><span class="ss">4. </span>Download files with the extension *.ris*, which can be handled by *revtools* package.</span>
<span id="cb22-50"><a href="#cb22-50" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-51"><a href="#cb22-51" aria-hidden="true" tabindex="-1"></a><span class="in">```{r packages, message = FALSE, warning = F}</span></span>
<span id="cb22-52"><a href="#cb22-52" aria-hidden="true" tabindex="-1"></a>knitr<span class="sc">::</span>opts_chunk<span class="sc">$</span><span class="fu">set</span>(<span class="at">echo =</span> <span class="cn">TRUE</span>, <span class="at">message =</span> <span class="cn">FALSE</span>, <span class="at">warning =</span> <span class="cn">FALSE</span>, <span class="at">tidy =</span> <span class="cn">TRUE</span>)</span>
<span id="cb22-53"><a href="#cb22-53" aria-hidden="true" tabindex="-1"></a><span class="co"># Required packages</span></span>
<span id="cb22-54"><a href="#cb22-54" aria-hidden="true" tabindex="-1"></a><span class="co">#install.packages("pacman")</span></span>
<span id="cb22-55"><a href="#cb22-55" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(pacman)</span>
<span id="cb22-56"><a href="#cb22-56" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-57"><a href="#cb22-57" aria-hidden="true" tabindex="-1"></a><span class="fu">p_load</span>(<span class="st">"tidyverse"</span>, <span class="co">#data wrangling </span></span>
<span id="cb22-58"><a href="#cb22-58" aria-hidden="true" tabindex="-1"></a> <span class="st">"revtools"</span>, <span class="co"># article handling</span></span>
<span id="cb22-59"><a href="#cb22-59" aria-hidden="true" tabindex="-1"></a> <span class="st">"readxl"</span>, <span class="co"># readl excel files</span></span>
<span id="cb22-60"><a href="#cb22-60" aria-hidden="true" tabindex="-1"></a> <span class="st">"janitor"</span>, <span class="co"># column names</span></span>
<span id="cb22-61"><a href="#cb22-61" aria-hidden="true" tabindex="-1"></a> <span class="st">"bayestestR"</span>, <span class="co"># bootstrap summaries</span></span>
<span id="cb22-62"><a href="#cb22-62" aria-hidden="true" tabindex="-1"></a> <span class="st">"mi"</span>, <span class="co"># multiple imputation</span></span>
<span id="cb22-63"><a href="#cb22-63" aria-hidden="true" tabindex="-1"></a> <span class="st">"metafor"</span>, <span class="co"># meta-analytic model</span></span>
<span id="cb22-64"><a href="#cb22-64" aria-hidden="true" tabindex="-1"></a> <span class="st">"multidplyr"</span>, <span class="st">"parallel"</span>) <span class="co"># parallel processing</span></span>
<span id="cb22-65"><a href="#cb22-65" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-66"><a href="#cb22-66" aria-hidden="true" tabindex="-1"></a><span class="co"># Custom functions</span></span>
<span id="cb22-67"><a href="#cb22-67" aria-hidden="true" tabindex="-1"></a><span class="fu">source</span>(<span class="st">"functions_sys_reviews.R"</span>)</span>
<span id="cb22-68"><a href="#cb22-68" aria-hidden="true" tabindex="-1"></a><span class="st">`</span><span class="at">%nin%</span><span class="st">`</span> <span class="ot"><-</span> <span class="fu">Negate</span>(<span class="st">`</span><span class="at">%in%</span><span class="st">`</span>)</span>
<span id="cb22-69"><a href="#cb22-69" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-70"><a href="#cb22-70" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-71"><a href="#cb22-71" aria-hidden="true" tabindex="-1"></a><span class="fu">### 1. First article screening</span></span>
<span id="cb22-72"><a href="#cb22-72" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-73"><a href="#cb22-73" aria-hidden="true" tabindex="-1"></a>Query -</span>
<span id="cb22-74"><a href="#cb22-74" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-75"><a href="#cb22-75" aria-hidden="true" tabindex="-1"></a>SOURCE-ID (78796 OR 59988 OR 38753 OR 15639) AND</span>
<span id="cb22-76"><a href="#cb22-76" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-77"><a href="#cb22-77" aria-hidden="true" tabindex="-1"></a>**TITLE**( (wheat OR nitrogen) AND (protein OR yield) ) AND</span>
<span id="cb22-78"><a href="#cb22-78" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-79"><a href="#cb22-79" aria-hidden="true" tabindex="-1"></a>PUBYEAR <span class="sc">\></span> 1980</span>
<span id="cb22-80"><a href="#cb22-80" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-81"><a href="#cb22-81" aria-hidden="true" tabindex="-1"></a><span class="in">```{r search 1, warning=FALSE}</span></span>
<span id="cb22-82"><a href="#cb22-82" aria-hidden="true" tabindex="-1"></a>path <span class="ot"><-</span> <span class="st">"articles/articles already searched/"</span></span>
<span id="cb22-83"><a href="#cb22-83" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-84"><a href="#cb22-84" aria-hidden="true" tabindex="-1"></a>files <span class="ot"><-</span> <span class="fu">list.files</span>(<span class="at">path =</span> path, <span class="at">pattern =</span> <span class="st">"*.ris"</span>)</span>
<span id="cb22-85"><a href="#cb22-85" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-86"><a href="#cb22-86" aria-hidden="true" tabindex="-1"></a>first_search <span class="ot">=</span> <span class="fu">load_bibliography</span>(<span class="at">path =</span> path, <span class="at">files =</span> files)</span>
<span id="cb22-87"><a href="#cb22-87" aria-hidden="true" tabindex="-1"></a><span class="fu">View</span>(first_search[,<span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>])</span>
<span id="cb22-88"><a href="#cb22-88" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-89"><a href="#cb22-89" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-90"><a href="#cb22-90" aria-hidden="true" tabindex="-1"></a><span class="fu">### 2. </span></span>
<span id="cb22-91"><a href="#cb22-91" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-92"><a href="#cb22-92" aria-hidden="true" tabindex="-1"></a><span class="fu">#### Second article screening</span></span>
<span id="cb22-93"><a href="#cb22-93" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-94"><a href="#cb22-94" aria-hidden="true" tabindex="-1"></a>Query -</span>
<span id="cb22-95"><a href="#cb22-95" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-96"><a href="#cb22-96" aria-hidden="true" tabindex="-1"></a>SOURCE-ID (78796 OR 59988 OR 38753 OR 15639) AND</span>
<span id="cb22-97"><a href="#cb22-97" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-98"><a href="#cb22-98" aria-hidden="true" tabindex="-1"></a>**TITLE-ABS-KEY**( (wheat OR nitrogen) AND (protein OR yield) ) AND</span>
<span id="cb22-99"><a href="#cb22-99" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-100"><a href="#cb22-100" aria-hidden="true" tabindex="-1"></a>PUBYEAR <span class="sc">\></span> 1980</span>
<span id="cb22-101"><a href="#cb22-101" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-102"><a href="#cb22-102" aria-hidden="true" tabindex="-1"></a><span class="in">```{r search 2, warning=FALSE}</span></span>
<span id="cb22-103"><a href="#cb22-103" aria-hidden="true" tabindex="-1"></a>path2 <span class="ot"><-</span> <span class="st">"articles/new search/"</span></span>
<span id="cb22-104"><a href="#cb22-104" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-105"><a href="#cb22-105" aria-hidden="true" tabindex="-1"></a>files2 <span class="ot"><-</span> <span class="fu">list.files</span>(<span class="at">path =</span> path2, <span class="at">pattern =</span> <span class="st">"*.ris"</span>)</span>
<span id="cb22-106"><a href="#cb22-106" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-107"><a href="#cb22-107" aria-hidden="true" tabindex="-1"></a>second_search <span class="ot"><-</span> <span class="fu">load_bibliography</span>(<span class="at">path =</span> path2, <span class="at">files =</span> files2)</span>
<span id="cb22-108"><a href="#cb22-108" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-109"><a href="#cb22-109" aria-hidden="true" tabindex="-1"></a><span class="fu">View</span>(second_search)</span>
<span id="cb22-110"><a href="#cb22-110" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-111"><a href="#cb22-111" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-112"><a href="#cb22-112" aria-hidden="true" tabindex="-1"></a><span class="fu">### 3. </span></span>
<span id="cb22-113"><a href="#cb22-113" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-114"><a href="#cb22-114" aria-hidden="true" tabindex="-1"></a><span class="fu">#### Merge the first and second screenings and get only the articles that WERE NOT SCREENED YET.</span></span>
<span id="cb22-115"><a href="#cb22-115" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-116"><a href="#cb22-116" aria-hidden="true" tabindex="-1"></a><span class="in">```{r anti_join}</span></span>
<span id="cb22-117"><a href="#cb22-117" aria-hidden="true" tabindex="-1"></a>df_final <span class="ot"><-</span> <span class="fu">anti_join</span>(second_search, first_search)</span>
<span id="cb22-118"><a href="#cb22-118" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-119"><a href="#cb22-119" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(<span class="at">x =</span> df_final, <span class="at">file =</span> <span class="st">"articles_search_final.csv"</span>)</span>
<span id="cb22-120"><a href="#cb22-120" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-121"><a href="#cb22-121" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-122"><a href="#cb22-122" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-123"><a href="#cb22-123" aria-hidden="true" tabindex="-1"></a><span class="fu">### 4. Run revtools shiny app</span></span>
<span id="cb22-124"><a href="#cb22-124" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-125"><a href="#cb22-125" aria-hidden="true" tabindex="-1"></a><span class="in">```{r revtools app}</span></span>
<span id="cb22-126"><a href="#cb22-126" aria-hidden="true" tabindex="-1"></a><span class="co">#screen_abstracts(max_file_size = 10)</span></span>
<span id="cb22-127"><a href="#cb22-127" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-128"><a href="#cb22-128" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-129"><a href="#cb22-129" aria-hidden="true" tabindex="-1"></a><span class="fu"># HANDS ON</span></span>
<span id="cb22-130"><a href="#cb22-130" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-131"><a href="#cb22-131" aria-hidden="true" tabindex="-1"></a>In this section we will:</span>
<span id="cb22-132"><a href="#cb22-132" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-133"><a href="#cb22-133" aria-hidden="true" tabindex="-1"></a><span class="ss">1. </span>Impute missing data using *mi* package</span>
<span id="cb22-134"><a href="#cb22-134" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-135"><a href="#cb22-135" aria-hidden="true" tabindex="-1"></a><span class="ss">2. </span>Calculate effect sizes</span>
<span id="cb22-136"><a href="#cb22-136" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-137"><a href="#cb22-137" aria-hidden="true" tabindex="-1"></a><span class="ss">3. </span>Run a pooled effects model</span>
<span id="cb22-138"><a href="#cb22-138" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-139"><a href="#cb22-139" aria-hidden="true" tabindex="-1"></a><span class="ss">4. </span>Test potential factor driving the size of the observed effects .</span>
<span id="cb22-140"><a href="#cb22-140" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-141"><a href="#cb22-141" aria-hidden="true" tabindex="-1"></a><span class="ss">5. </span>We will utilize bootstrapping techniques and parallel processing for making the code run faster.</span>
<span id="cb22-142"><a href="#cb22-142" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-143"><a href="#cb22-143" aria-hidden="true" tabindex="-1"></a><span class="ss">6. </span>Produce a forest plot.</span>
<span id="cb22-144"><a href="#cb22-144" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-145"><a href="#cb22-145" aria-hidden="true" tabindex="-1"></a><span class="fu">## Meta-analytic data</span></span>
<span id="cb22-146"><a href="#cb22-146" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-147"><a href="#cb22-147" aria-hidden="true" tabindex="-1"></a>As an example we will use data from split N application in with crops. This meta analysis is comparing whether applying N on a single dose or splitting(2 splits, 3 splits or just split, regardless or number of splits) has any effect on wheat yields.</span>
<span id="cb22-148"><a href="#cb22-148" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-149"><a href="#cb22-149" aria-hidden="true" tabindex="-1"></a>It does also compared how different factors (called moderators if categorical) affect the size of the observed effects.</span>
<span id="cb22-150"><a href="#cb22-150" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-151"><a href="#cb22-151" aria-hidden="true" tabindex="-1"></a>The article can be find here <span class="co">[</span><span class="ot">Hu et al 2021</span><span class="co">](https://www.sciencedirect.com/science/article/pii/S0167198721001847)</span></span>
<span id="cb22-152"><a href="#cb22-152" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-153"><a href="#cb22-153" aria-hidden="true" tabindex="-1"></a><span class="fu">### Load data and wrangling</span></span>
<span id="cb22-154"><a href="#cb22-154" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-155"><a href="#cb22-155" aria-hidden="true" tabindex="-1"></a><span class="in">```{r data}</span></span>
<span id="cb22-156"><a href="#cb22-156" aria-hidden="true" tabindex="-1"></a>data <span class="ot"><-</span> <span class="fu">read_excel</span>(<span class="st">"example_data.xlsx"</span>, <span class="at">skip =</span> <span class="dv">2</span>) <span class="sc">%>%</span> </span>
<span id="cb22-157"><a href="#cb22-157" aria-hidden="true" tabindex="-1"></a> janitor<span class="sc">::</span><span class="fu">clean_names</span>()</span>
<span id="cb22-158"><a href="#cb22-158" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-159"><a href="#cb22-159" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-160"><a href="#cb22-160" aria-hidden="true" tabindex="-1"></a><span class="fu">### 1. Imputation of missing data</span></span>
<span id="cb22-161"><a href="#cb22-161" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-162"><a href="#cb22-162" aria-hidden="true" tabindex="-1"></a><span class="fu">#### 1.1) Run multiple.imputation()</span></span>
<span id="cb22-163"><a href="#cb22-163" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-164"><a href="#cb22-164" aria-hidden="true" tabindex="-1"></a><span class="in">```{r imputation, warning=FALSE, message = FALSE ,include = F}</span></span>
<span id="cb22-165"><a href="#cb22-165" aria-hidden="true" tabindex="-1"></a>n.imp <span class="ot"><-</span> <span class="dv">10</span></span>
<span id="cb22-166"><a href="#cb22-166" aria-hidden="true" tabindex="-1"></a>df.for.imp <span class="ot"><-</span> data <span class="sc">%>%</span> </span>
<span id="cb22-167"><a href="#cb22-167" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="fu">contains</span>(<span class="fu">c</span>(<span class="st">"yield"</span>, <span class="st">"sd_"</span>)))</span>
<span id="cb22-168"><a href="#cb22-168" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-169"><a href="#cb22-169" aria-hidden="true" tabindex="-1"></a>data.imp <span class="ot"><-</span> data <span class="sc">%>%</span> </span>
<span id="cb22-170"><a href="#cb22-170" aria-hidden="true" tabindex="-1"></a> <span class="fu">cbind</span>(<span class="co"># Imputation of SD of grain yield when applying N all at once</span></span>
<span id="cb22-171"><a href="#cb22-171" aria-hidden="true" tabindex="-1"></a> <span class="fu">multiple.imputation</span>(<span class="at">n.imp =</span> n.imp, <span class="co"># number of imputations</span></span>
<span id="cb22-172"><a href="#cb22-172" aria-hidden="true" tabindex="-1"></a> <span class="at">df.variables =</span> df.for.imp, <span class="co"># data frame containing columns with the mean and standard deviation of the response variable</span></span>
<span id="cb22-173"><a href="#cb22-173" aria-hidden="true" tabindex="-1"></a> <span class="at">impute.var =</span> <span class="st">"sd_1"</span>, <span class="co"># name of the columns we want to imputate</span></span>
<span id="cb22-174"><a href="#cb22-174" aria-hidden="true" tabindex="-1"></a> <span class="at">var.name =</span> <span class="st">"sd1_imp"</span>), <span class="co"># name of new column with imputation of missing values</span></span>
<span id="cb22-175"><a href="#cb22-175" aria-hidden="true" tabindex="-1"></a> <span class="co"># Imputation of SD of grain yield when splitting N twice</span></span>
<span id="cb22-176"><a href="#cb22-176" aria-hidden="true" tabindex="-1"></a> <span class="fu">multiple.imputation</span>(<span class="at">n.imp =</span> n.imp, <span class="at">df.variables =</span> df.for.imp, <span class="at">impute.var =</span> <span class="st">"sd_2"</span>, <span class="at">var.name =</span> <span class="st">"sd2_imp"</span>)</span>
<span id="cb22-177"><a href="#cb22-177" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb22-178"><a href="#cb22-178" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-179"><a href="#cb22-179" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-180"><a href="#cb22-180" aria-hidden="true" tabindex="-1"></a><span class="fu">### 2. Calculate effect sizes & pooled sample variance</span></span>
<span id="cb22-181"><a href="#cb22-181" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-182"><a href="#cb22-182" aria-hidden="true" tabindex="-1"></a><span class="in">```{r effect_sizes}</span></span>
<span id="cb22-183"><a href="#cb22-183" aria-hidden="true" tabindex="-1"></a>data.imp_es <span class="ot"><-</span> </span>
<span id="cb22-184"><a href="#cb22-184" aria-hidden="true" tabindex="-1"></a> data.imp <span class="sc">%>%</span></span>
<span id="cb22-185"><a href="#cb22-185" aria-hidden="true" tabindex="-1"></a> <span class="fu">drop_na</span>(yield_kg_ha_1,reps_1, reps_2, sd1_imp, sd2_imp, yield_kg_ha_2 ) <span class="sc">%>%</span> </span>
<span id="cb22-186"><a href="#cb22-186" aria-hidden="true" tabindex="-1"></a> <span class="fu">transmute</span>(</span>
<span id="cb22-187"><a href="#cb22-187" aria-hidden="true" tabindex="-1"></a> <span class="at">PAPER_ID =</span> no, </span>
<span id="cb22-188"><a href="#cb22-188" aria-hidden="true" tabindex="-1"></a> <span class="at">TEXTURE =</span> soil_texture, </span>
<span id="cb22-189"><a href="#cb22-189" aria-hidden="true" tabindex="-1"></a> <span class="at">AI =</span> aridity_index, </span>
<span id="cb22-190"><a href="#cb22-190" aria-hidden="true" tabindex="-1"></a> <span class="at">WHEAT_TYPE =</span> whea_type, </span>
<span id="cb22-191"><a href="#cb22-191" aria-hidden="true" tabindex="-1"></a> <span class="at">TILLAGE =</span> tillage,</span>
<span id="cb22-192"><a href="#cb22-192" aria-hidden="true" tabindex="-1"></a> <span class="co"># Response Ratio</span></span>
<span id="cb22-193"><a href="#cb22-193" aria-hidden="true" tabindex="-1"></a> <span class="at">RR =</span> <span class="fu">log</span>(yield_kg_ha_2<span class="sc">/</span>yield_kg_ha_1),</span>
<span id="cb22-194"><a href="#cb22-194" aria-hidden="true" tabindex="-1"></a> <span class="co"># Calculate pooled sampling variance</span></span>
<span id="cb22-195"><a href="#cb22-195" aria-hidden="true" tabindex="-1"></a> <span class="at">VAR =</span> <span class="fu">pooled.var</span>(<span class="at">sd.treated =</span> sd2_imp, <span class="at">sd.control =</span> sd1_imp,</span>
<span id="cb22-196"><a href="#cb22-196" aria-hidden="true" tabindex="-1"></a> <span class="at">n.control =</span> reps_1, <span class="at">n.treated =</span> reps_2,</span>
<span id="cb22-197"><a href="#cb22-197" aria-hidden="true" tabindex="-1"></a> <span class="at">m.treated =</span> yield_kg_ha_1, <span class="at">m.control =</span> yield_kg_ha_2),</span>
<span id="cb22-198"><a href="#cb22-198" aria-hidden="true" tabindex="-1"></a> <span class="co"># Weights</span></span>
<span id="cb22-199"><a href="#cb22-199" aria-hidden="true" tabindex="-1"></a> <span class="at">W =</span> <span class="dv">1</span><span class="sc">/</span>VAR</span>
<span id="cb22-200"><a href="#cb22-200" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb22-201"><a href="#cb22-201" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-202"><a href="#cb22-202" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-203"><a href="#cb22-203" aria-hidden="true" tabindex="-1"></a><span class="fu">### 3. Run pooled model - intercept only</span></span>
<span id="cb22-204"><a href="#cb22-204" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-205"><a href="#cb22-205" aria-hidden="true" tabindex="-1"></a>You can find more info about I2 statistic here: <span class="co">[</span><span class="ot">Borenstein 2015</span><span class="co">](https://onlinelibrary.wiley.com/doi/full/10.1002/jrsm.1230)</span>, <span class="co">[</span><span class="ot">Higgins and Thompson 2002</span><span class="co">](https://onlinelibrary.wiley.com/doi/abs/10.1002/sim.1186)</span></span>
<span id="cb22-206"><a href="#cb22-206" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-207"><a href="#cb22-207" aria-hidden="true" tabindex="-1"></a><span class="in">```{r model}</span></span>
<span id="cb22-208"><a href="#cb22-208" aria-hidden="true" tabindex="-1"></a><span class="co"># Run pooled model</span></span>
<span id="cb22-209"><a href="#cb22-209" aria-hidden="true" tabindex="-1"></a>mod <span class="ot"><-</span> <span class="fu">rma</span>(<span class="at">yi =</span> RR,</span>
<span id="cb22-210"><a href="#cb22-210" aria-hidden="true" tabindex="-1"></a> <span class="at">vi =</span> VAR,</span>
<span id="cb22-211"><a href="#cb22-211" aria-hidden="true" tabindex="-1"></a> <span class="at">weights =</span> W,</span>
<span id="cb22-212"><a href="#cb22-212" aria-hidden="true" tabindex="-1"></a> <span class="co">#control = list(optimizer="optimParallel", ncpus=3),</span></span>
<span id="cb22-213"><a href="#cb22-213" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> data.imp_es)</span>
<span id="cb22-214"><a href="#cb22-214" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-215"><a href="#cb22-215" aria-hidden="true" tabindex="-1"></a><span class="fu">summary</span>(mod)</span>
<span id="cb22-216"><a href="#cb22-216" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-217"><a href="#cb22-217" aria-hidden="true" tabindex="-1"></a><span class="co"># Back transformation</span></span>
<span id="cb22-218"><a href="#cb22-218" aria-hidden="true" tabindex="-1"></a><span class="fu">trans</span>(<span class="fu">coef</span>(mod))</span>
<span id="cb22-219"><a href="#cb22-219" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-220"><a href="#cb22-220" aria-hidden="true" tabindex="-1"></a>mod<span class="sc">$</span>ci.lb <span class="sc">%>%</span> <span class="fu">trans</span>()</span>
<span id="cb22-221"><a href="#cb22-221" aria-hidden="true" tabindex="-1"></a>mod<span class="sc">$</span>ci.ub <span class="sc">%>%</span> <span class="fu">trans</span>()</span>
<span id="cb22-222"><a href="#cb22-222" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-223"><a href="#cb22-223" aria-hidden="true" tabindex="-1"></a><span class="co"># I squared statistic</span></span>
<span id="cb22-224"><a href="#cb22-224" aria-hidden="true" tabindex="-1"></a>mod<span class="sc">$</span>I2</span>
<span id="cb22-225"><a href="#cb22-225" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-226"><a href="#cb22-226" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-227"><a href="#cb22-227" aria-hidden="true" tabindex="-1"></a><span class="fu">### 4. Influential Studies Diagnosis</span></span>
<span id="cb22-228"><a href="#cb22-228" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-229"><a href="#cb22-229" aria-hidden="true" tabindex="-1"></a>When certain studies excert a strong influence in the model output they are consider influential. An influential case can be diagnosed when the cook's D value for a given study is x 3 times greater than the average Cook's D of the whole data. Use this citation for the this procedure: <span class="co">[</span><span class="ot">Cook 1977</span><span class="co">](https://www.tandfonline.com/doi/abs/10.1080/01621459.1979.10481634)</span>, <span class="co">[</span><span class="ot">Stephanie 2016</span><span class="co">](https://www.statisticshowto.com/cooks-distance/)</span></span>
<span id="cb22-230"><a href="#cb22-230" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-231"><a href="#cb22-231" aria-hidden="true" tabindex="-1"></a><span class="in">```{r influential_cases}</span></span>
<span id="cb22-232"><a href="#cb22-232" aria-hidden="true" tabindex="-1"></a><span class="co"># cooks.distance.rma.uni(model = mod, progbar = T) %>% </span></span>
<span id="cb22-233"><a href="#cb22-233" aria-hidden="true" tabindex="-1"></a><span class="co"># saveRDS("output/cooksD_diagnosis.RData")</span></span>
<span id="cb22-234"><a href="#cb22-234" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-235"><a href="#cb22-235" aria-hidden="true" tabindex="-1"></a><span class="co"># plot(readRDS("output/cooksD_diagnosis.RData"))</span></span>
<span id="cb22-236"><a href="#cb22-236" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-237"><a href="#cb22-237" aria-hidden="true" tabindex="-1"></a>influential_cases <span class="ot"><-</span> <span class="fu">c</span>(<span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>)</span>
<span id="cb22-238"><a href="#cb22-238" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-239"><a href="#cb22-239" aria-hidden="true" tabindex="-1"></a>data.imp_es_ic <span class="ot"><-</span> </span>
<span id="cb22-240"><a href="#cb22-240" aria-hidden="true" tabindex="-1"></a> data.imp_es <span class="sc">%>%</span> </span>
<span id="cb22-241"><a href="#cb22-241" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">W =</span> <span class="fu">case_when</span>(PAPER_ID <span class="sc">%in%</span> influential_cases <span class="sc">~</span> <span class="dv">0</span>, T<span class="sc">~</span>W))</span>
<span id="cb22-242"><a href="#cb22-242" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-243"><a href="#cb22-243" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-244"><a href="#cb22-244" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-245"><a href="#cb22-245" aria-hidden="true" tabindex="-1"></a><span class="fu">### 5. Run unbootstrapped model</span></span>
<span id="cb22-246"><a href="#cb22-246" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-247"><a href="#cb22-247" aria-hidden="true" tabindex="-1"></a>Weight of influential studies is set to zero</span>
<span id="cb22-248"><a href="#cb22-248" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-249"><a href="#cb22-249" aria-hidden="true" tabindex="-1"></a><span class="in">```{r model 2}</span></span>
<span id="cb22-250"><a href="#cb22-250" aria-hidden="true" tabindex="-1"></a>mod2 <span class="ot"><-</span> <span class="fu">rma</span>(<span class="at">yi =</span> RR,</span>
<span id="cb22-251"><a href="#cb22-251" aria-hidden="true" tabindex="-1"></a> <span class="at">vi =</span> VAR,</span>
<span id="cb22-252"><a href="#cb22-252" aria-hidden="true" tabindex="-1"></a> <span class="at">weights =</span> W,</span>
<span id="cb22-253"><a href="#cb22-253" aria-hidden="true" tabindex="-1"></a> <span class="at">mods =</span> <span class="sc">~</span> <span class="dv">0</span> <span class="sc">+</span> TEXTURE,</span>
<span id="cb22-254"><a href="#cb22-254" aria-hidden="true" tabindex="-1"></a> <span class="co">#control = list(optimizer="optimParallel", ncpus=3),</span></span>
<span id="cb22-255"><a href="#cb22-255" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> data.imp_es_ic)</span>
<span id="cb22-256"><a href="#cb22-256" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-257"><a href="#cb22-257" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-258"><a href="#cb22-258" aria-hidden="true" tabindex="-1"></a><span class="fu">### 6. Run bootstrapped models</span></span>
<span id="cb22-259"><a href="#cb22-259" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-260"><a href="#cb22-260" aria-hidden="true" tabindex="-1"></a>Citation: <span class="co">[</span><span class="ot">Adams et al 1997</span><span class="co">](https://www.scopus.com/record/display.uri?eid=2-s2.0-0030613897&origin=inward)</span></span>
<span id="cb22-261"><a href="#cb22-261" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-262"><a href="#cb22-262" aria-hidden="true" tabindex="-1"></a><span class="fu">#### 6.1) Pooled effects, intercept only model</span></span>
<span id="cb22-263"><a href="#cb22-263" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-264"><a href="#cb22-264" aria-hidden="true" tabindex="-1"></a><span class="in">```{r bootstrap ,include = F}</span></span>
<span id="cb22-265"><a href="#cb22-265" aria-hidden="true" tabindex="-1"></a><span class="co"># Find the number of cores your computer has</span></span>
<span id="cb22-266"><a href="#cb22-266" aria-hidden="true" tabindex="-1"></a>ncores <span class="ot"><-</span> <span class="fu">detectCores</span>()</span>
<span id="cb22-267"><a href="#cb22-267" aria-hidden="true" tabindex="-1"></a>boot_num <span class="ot"><-</span> <span class="dv">16</span> <span class="co"># should be at least 1000</span></span>
<span id="cb22-268"><a href="#cb22-268" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-269"><a href="#cb22-269" aria-hidden="true" tabindex="-1"></a><span class="fu">bootstrap_rma</span>(<span class="at">data =</span> data.imp_es_ic, </span>
<span id="cb22-270"><a href="#cb22-270" aria-hidden="true" tabindex="-1"></a> <span class="at">response_variable =</span> <span class="st">"RR"</span>,</span>
<span id="cb22-271"><a href="#cb22-271" aria-hidden="true" tabindex="-1"></a> <span class="at">moderator =</span> <span class="cn">NA</span>, </span>
<span id="cb22-272"><a href="#cb22-272" aria-hidden="true" tabindex="-1"></a> <span class="at">boot_num =</span> <span class="dv">16</span>, </span>
<span id="cb22-273"><a href="#cb22-273" aria-hidden="true" tabindex="-1"></a> <span class="at">cores =</span> ncores)</span>
<span id="cb22-274"><a href="#cb22-274" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-275"><a href="#cb22-275" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-276"><a href="#cb22-276" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-277"><a href="#cb22-277" aria-hidden="true" tabindex="-1"></a><span class="fu">readRDS</span>(<span class="st">"output/RR_mod.RData"</span>)</span>
<span id="cb22-278"><a href="#cb22-278" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-279"><a href="#cb22-279" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-280"><a href="#cb22-280" aria-hidden="true" tabindex="-1"></a><span class="fu">#### 6.2) Test potential moderators</span></span>
<span id="cb22-281"><a href="#cb22-281" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-282"><a href="#cb22-282" aria-hidden="true" tabindex="-1"></a><span class="in">```{r moderators ,include = F}</span></span>
<span id="cb22-283"><a href="#cb22-283" aria-hidden="true" tabindex="-1"></a><span class="co"># Find the number of cores your computer has</span></span>
<span id="cb22-284"><a href="#cb22-284" aria-hidden="true" tabindex="-1"></a>ncores <span class="ot"><-</span> <span class="fu">detectCores</span>()</span>
<span id="cb22-285"><a href="#cb22-285" aria-hidden="true" tabindex="-1"></a>boot_num <span class="ot"><-</span> <span class="dv">16</span> <span class="co"># should be at least 1000</span></span>
<span id="cb22-286"><a href="#cb22-286" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-287"><a href="#cb22-287" aria-hidden="true" tabindex="-1"></a><span class="fu">bootstrap_rma</span>(<span class="at">data =</span> data.imp_es_ic, </span>
<span id="cb22-288"><a href="#cb22-288" aria-hidden="true" tabindex="-1"></a> <span class="at">response_variable =</span> <span class="st">"RR"</span>,</span>
<span id="cb22-289"><a href="#cb22-289" aria-hidden="true" tabindex="-1"></a> <span class="at">moderator =</span> <span class="st">"TEXTURE"</span>, </span>
<span id="cb22-290"><a href="#cb22-290" aria-hidden="true" tabindex="-1"></a> <span class="at">boot_num =</span> <span class="dv">16</span>, </span>
<span id="cb22-291"><a href="#cb22-291" aria-hidden="true" tabindex="-1"></a> <span class="at">cores =</span> ncores)</span>
<span id="cb22-292"><a href="#cb22-292" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-293"><a href="#cb22-293" aria-hidden="true" tabindex="-1"></a><span class="fu">readRDS</span>(<span class="st">"output/RR_TEXTURE_mod.RData"</span>)</span>
<span id="cb22-294"><a href="#cb22-294" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-295"><a href="#cb22-295" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-296"><a href="#cb22-296" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-297"><a href="#cb22-297" aria-hidden="true" tabindex="-1"></a><span class="fu">#### 6.3) Summarize bootstraps</span></span>
<span id="cb22-298"><a href="#cb22-298" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-299"><a href="#cb22-299" aria-hidden="true" tabindex="-1"></a><span class="in">```{r summarise_boot}</span></span>
<span id="cb22-300"><a href="#cb22-300" aria-hidden="true" tabindex="-1"></a>df.plot <span class="ot"><-</span> <span class="fu">summarise_bootstraps</span>(<span class="fu">readRDS</span>(<span class="st">"output/RR_TEXTURE_mod.RData"</span>))</span>
<span id="cb22-301"><a href="#cb22-301" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb22-302"><a href="#cb22-302" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-303"><a href="#cb22-303" aria-hidden="true" tabindex="-1"></a><span class="fu">#### 6.4) Plot</span></span>
<span id="cb22-304"><a href="#cb22-304" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-305"><a href="#cb22-305" aria-hidden="true" tabindex="-1"></a><span class="in">```{r plot}</span></span>
<span id="cb22-306"><a href="#cb22-306" aria-hidden="true" tabindex="-1"></a>df.plot <span class="sc">%>%</span> </span>
<span id="cb22-307"><a href="#cb22-307" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>()<span class="sc">+</span></span>
<span id="cb22-308"><a href="#cb22-308" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_linerange</span>(<span class="fu">aes</span>(<span class="at">ymin =</span> <span class="fu">trans</span>(ESTIM_q975), <span class="at">ymax =</span> <span class="fu">trans</span>(ESTIM_q025), <span class="at">x =</span> MOD), <span class="at">linewidth =</span> <span class="dv">1</span>)<span class="sc">+</span></span>
<span id="cb22-309"><a href="#cb22-309" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="fu">aes</span>(<span class="at">x =</span> MOD, <span class="at">y =</span> <span class="fu">trans</span>(ESTIM_q500), <span class="at">fill =</span> MOD), <span class="at">shape =</span> <span class="dv">21</span>, <span class="at">size =</span> <span class="dv">6</span>, <span class="at">stroke =</span> <span class="fl">1.2</span>)<span class="sc">+</span></span>
<span id="cb22-310"><a href="#cb22-310" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_flip</span>()<span class="sc">+</span> </span>