Created
May 10, 2018 21:14
-
-
Save JimGrange/c37273af61fc7c0216aeb2174922da77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(metafor) | |
library(dplyr) | |
# sample size per study | |
n <- 10 | |
# population effect size | |
true_d <- 0.2 | |
# generate studies | |
data <- data.frame( | |
study = rep(c("a", "b", "c", "d", "e", "f", "g"), | |
each = n), | |
dv = rnorm(n = n * 7, mean = true_d) | |
) | |
# calculate summary statstics | |
data <- data %>% | |
group_by(study) %>% | |
summarise(mean = mean(dv), se = sd(dv) / sqrt(n)) | |
# conduct and plot the meta analysis | |
ma_out <- rma(data = data, yi = mean, sei = se, slab = data$study) | |
forest(ma_out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment