-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiverse_5_GOSH-plot.Rmd
74 lines (63 loc) · 1.69 KB
/
multiverse_5_GOSH-plot.Rmd
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
---
title: "Multiverse Meta-Analysis Exploring the Efficacy of Psychological Interventions for Depression"
subtitle: "5. Multiverse GOSH Plot"
author: "Constantin Yves Plessen"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
html_document:
toc: true
toc_depth: 3
toc_float: true
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(metafor)
library(metaviz)
library(ggpubr)
library(grid)
library(gridExtra)
set.seed(42)
source("helper-functions/sca_gosh_rem.R")
library(readxl)
require(tictoc)
```
<br>
# Load and clean data
```{r}
data_rem <- read_csv("data/tidy/data_cleaned.csv")
data_avg <- data_rem %>%
escalc(yi=yi, vi=vi, data=.)
data_avg <- as.data.frame(aggregate(data_avg, cluster = study,
struct="CS" , #compound symmetric structure as nested are not indpendent
rho = 0.5))
reml_avg <- rma(yi = data_avg$yi, vi = data_avg$vi,
method = "REML",
control = list(stepadj = 0.5,
maxiter = 2000))
reml_avg
```
## Create GOSH Plot (parallelized)
```{r}
tic()
gosh_reml <- gosh(subsets = 100000,
parallel = "snow",
ncpus = 9,
reml_avg)
toc()
```
## Inspect Plot
```{r}
gosh_plot <- plot(gosh_reml, breaks = 100)
gosh_plot
```
## Save Plot
```{r}
#pdf(file = "figures/gosh_dl.pdf", # The directory you want to save the file in
# width = 15, # The width of the plot in inches
# height = 10) # The height of the plot in inches
plot(gosh_reml, breaks = 100)
#dev.off()
```