SimulateSMD {metaforest} | R Documentation |
Simulates a meta-analytic dataset
Description
This function simulates a meta-analytic dataset based on the random-effects model. The simulated effect size is Hedges' G, an estimator of the Standardized Mean Difference. The functional form of the model can be specified, and moderators can be either normally distributed or Bernoulli-distributed. See Van Lissa, 2018, for a detailed explanation of the simulation procedure.
Usage
SimulateSMD(
k_train = 20,
k_test = 100,
mean_n = 40,
es = 0.5,
tau2 = 0.04,
moderators = 5,
distribution = "normal",
model = es * x[, 1]
)
Arguments
k_train |
Atomic integer. The number of studies in the training dataset. Defaults to 20. |
k_test |
Atomic integer. The number of studies in the testing dataset. Defaults to 100. |
mean_n |
Atomic integer. The mean sample size of each simulated study in the meta-analytic dataset. Defaults to 40. For each simulated study, the sample size n is randomly drawn from a normal distribution with mean mean_n, and sd mean_n/3. |
es |
Atomic numeric vector. The effect size, also known as beta, used in the model statement. Defaults to .5. |
tau2 |
Atomic numeric vector. The residual heterogeneity. Defaults to 0.04. |
moderators |
Atomic integer. The number of moderators to simulate for each study. Make sure that the number of moderators to be simulated is at least as large as the number of moderators referred to in the model parameter. Internally, the matrix of moderators is referred to as "x". Defaults to 5. |
distribution |
Atomic character. The distribution of the moderators. Can be set to either "normal" or "bernoulli". Defaults to "normal". |
model |
Expression. An expression to specify the model from which to
simulate the mean true effect size, mu. This formula may use the terms "es"
(referring to the es parameter of the call to SimulateSMD), and "x[, ]"
(referring to the matrix of moderators, x). Thus, to specify that the mean
effect size, mu, is a function of the effect size and the first moderator,
one would pass the value |
Value
List of length 4. The "training" element of this list is a data.frame with k_train rows. The columns are the variance of the effect size, vi; the effect size, yi, and the moderators, X. The "testing" element of this list is a data.frame with k_test rows. The columns are the effect size, yi, and the moderators, X. The "housekeeping" element of this list is a data.frame with k_train + k_test rows. The columns are n, the sample size n for each simulated study; mu_i, the mean true effect size for each simulated study; and theta_i, the true effect size for each simulated study.
References
Van Lissa, C. J. (2020). Small sample meta-analyses: exploring heterogeneity using metaForest. In R. Van De Schoot & M. Miočević (Eds.), Small sample size solutions (open access): A guide for applied researchers and practitioners. CRC Press (pp.186–202). doi:10.4324/9780429273872-16 Van Lissa, C. J. (2018). MetaForest: Exploring heterogeneity in meta-analysis using random forests. PsyArxiv. doi:10.31234/osf.io/myg6s
Examples
set.seed(8)
SimulateSMD()
SimulateSMD(k_train = 50, distribution = "bernoulli")
SimulateSMD(distribution = "bernoulli", model = es * x[ ,1] * x[ ,2])