The simulation relied on several distributions to randomly draw values for various settings such as the sample size or random effects. These distributions are visualized here for demonstration.

# Clear workspace
rm(list = ls())

suppressPackageStartupMessages({
  library("here")
  library("openxlsx")
})

1 Random effect (SD)

van Erp et al. (2017) collected between-study heterogeneity estimates of meta-analyses published in Psychological Bulletin between 1990 and 2013. The respective database was provided under a public domain license. Here, the distributions of these estimates are summarized for meta-analyses using correlations as effect sizes.

# Read database
dat <- openxlsx::read.xlsx(
  here::here("data", "Data 1990-2013 with tau values.xlsx"),
  sheet = 1
)

# Select entries with correlations
dat <- dat[!is.na(dat$'tau'), ]
dat <- dat[dat$'Type.of.ES' %in% c("Weighted Pearson's r", 
                                   "Pearson's r", 
                                   "Unweighted Pearson's r"), ]

# Number of estimates
length(dat$tau)
## [1] 202
# Distribution of estimates
hist(dat$tau, main = "Random effects", xlab = "tau", prob = TRUE)

# Distribution used for simulation
tau <- abs(rnorm(100000, 0, .20))
repeat {
  tau[tau > .50] <- tau[tau > .50] / 2
  if (all(tau <= .50)) break
}
lines(density(tau))

# Quantiles of estimates
round(quantile(dat$tau, c(.05, .25, .50, .75, .95)), 2)
##   5%  25%  50%  75%  95% 
## 0.00 0.08 0.16 0.22 0.36
round(quantile(tau, c(.05, .25, .50, .75, .95)), 2)
##   5%  25%  50%  75%  95% 
## 0.01 0.06 0.13 0.23 0.37
range(dat$tau)
## [1] 0.00 0.52
range(tau)
## [1] 4.093092e-07 4.999593e-01
rm(tau)

2 Sample size

# Random draws
n <- rgamma(100000, 1.3, 1 / 250) + 50
repeat {
  n[n > 900] <- n[n > 900] / 2
  if (all(n <= 900)) break
}
n <- round(n)

# Distribution of estimates
hist(n, main = "Sample size", xlab = "Sample size", prob = TRUE)

# Quantiles of estimates
round(quantile(n, c(.05, .25, .50, .75, .95)), 2)
##  5% 25% 50% 75% 95% 
##  80 168 295 483 743
range(n)
## [1]  50 900
rm(n)

3 Number of effects in meta-analysis

# Random draws
k <- round(runif(100000, 5, 50))

# Distribution of estimates
hist(k, main = "Number of effects", xlab = "Number of effects", prob = TRUE)

# Quantiles of estimates
round(quantile(k, c(.05, .25, .50, .75, .95)), 2)
##  5% 25% 50% 75% 95% 
##   7  16  28  39  48
range(k)
## [1]  5 50
rm(k)

4 Reliabilities of measures

# Random draws
rxx <- round(runif(100000, .65, .95), 2)

# Distribution of estimates
hist(rxx, main = "Reliability", xlab = "Reliability", prob = TRUE)

# Quantiles of estimates
round(quantile(rxx, c(.05, .25, .50, .75, .95)), 2)
##   5%  25%  50%  75%  95% 
## 0.67 0.73 0.80 0.87 0.93
range(rxx)
## [1] 0.65 0.95
rm(rxx)