## Code

```
<- function(pi_i, T_i, n_i) {
sim_binom_summary <- rbinom(n_i, size = T_i, prob = pi_i) / T_i
y data.frame(M = mean(y), SD = sd(y))
}
<- function(
sim_props # number of studies
k, # parameters of pi_Ai distribution,
alpha, beta, # parameters of lambda_i distribution
Lambda, tau, # parameters of T_i distribution
t_min, t_max, # parameters of the sample size distribution
n_min, n_max
) {
# simulate parameters
<- rbeta(k, shape1 = alpha, shape2 = beta)
pi_Ai <- exp(rnorm(k, mean = log(Lambda), sd = tau))
lambda_i <- lambda_i * pi_Ai
pi_Bi <- sample(t_min:t_max, size = k, replace = TRUE)
T_i <- (pi_Bi - pi_Ai) * T_i / sqrt(pi_Ai * (1 - pi_Ai) * T_i)
delta_i <- sample(n_min:n_max, size = k, replace = TRUE)
n_i
# simulate data
<- purrr::pmap_dfr(list(pi_i = pi_Ai, T_i = T_i, n_i = n_i),
stats_A
sim_binom_summary)
<- purrr::pmap_dfr(list(pi_i = pi_Bi, T_i = T_i, n_i = n_i),
stats_B
sim_binom_summary)
# compile
<- data.frame(
res pi_Ai = pi_Ai, pi_Bi = pi_Bi,
lambda_i = lambda_i, T_i = T_i,
delta_i = delta_i, n_i = n_i,
mA = stats_A$M, sdA = stats_A$SD,
mB = stats_B$M, sdB = stats_B$SD
)
# effect size calculations
<- metafor::escalc(
res data = res, measure = "ROM", var.names = c("lRR", "V_lRR"),
m1i = mB, m2i = mA,
sd1i = sdB, sd2i = sdA,
n1i = n_i, n2i = n_i
)<- metafor::escalc(
res data = res, measure = "SMD", var.names = c("d", "V_d"),
m1i = mB, m2i = mA,
sd1i = sdB, sd2i = sdA,
n1i = n_i, n2i = n_i
)
res
}
set.seed(20211024)
<- sim_props(k = 60, alpha = 12, beta = 4,
dat Lambda = 0.7, tau = .05,
t_min = 5, t_max = 18,
n_min = 10, n_max = 40)
head(dat)
```

```
pi_Ai pi_Bi lambda_i T_i delta_i n_i mA sdA
1 0.7584480 0.5836965 0.7695933 11 -1.3540950 24 0.7500000 0.1080650
2 0.7359047 0.4950740 0.6727420 16 -2.1851474 24 0.7786458 0.1222235
3 0.7132014 0.4773027 0.6692398 12 -1.8068471 10 0.7333333 0.1097134
4 0.6223653 0.4627406 0.7435193 9 -0.9877857 30 0.6666667 0.1399386
5 0.5916619 0.4205407 0.7107787 6 -0.8527716 28 0.5833333 0.2103299
6 0.7266748 0.5014601 0.6900751 9 -1.5160305 35 0.7619048 0.1209466
mB sdB lRR V_lRR d V_d
1 0.6174242 0.1285066 -0.1945 0.0027 -1.0983 0.0959
2 0.5260417 0.1275776 -0.3922 0.0035 -1.9888 0.1245
3 0.3583333 0.1622089 -0.7161 0.0227 -2.5934 0.3681
4 0.4555556 0.1943213 -0.3808 0.0075 -1.2306 0.0793
5 0.4583333 0.2060055 -0.2412 0.0119 -0.5921 0.0746
6 0.4920635 0.1793349 -0.4372 0.0045 -1.7447 0.0789
```