simulate_smd | R Documentation |

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 (Hedges, 1981; Li, Dusseldorp, & Meulman, 2017). The functional form of the model can be specified, and moderators can be either normally distributed or Bernoulli-distributed. See Van Lissa, in preparation, for a detailed explanation of the simulation procedure.

```
simulate_smd(
k_train = 20,
k_test = 100,
mean_n = 40,
es = 0.5,
tau2 = 0.04,
alpha = 0,
moderators = 5,
distribution = "normal",
model = "es * x[, 1]"
)
```

`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 |

`es` |
Atomic numeric vector. The effect size, also known as beta, used in
the model statement. Defaults to |

`tau2` |
Atomic numeric vector. The residual heterogeneity. For a range of
realistic values encountered in psychological research, see Van Erp,
Verhagen, Grasman, & Wagenmakers, 2017. Defaults to |

`alpha` |
Vector of slant parameters, passed to sn::rsn. |

`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 |

`distribution` |
Atomic character. The distribution of the moderators.
Can be set to either |

`model` |
Expression. An expression to specify the model from which to
simulate the mean true effect size, mu. This formula may use the terms |

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.

```
set.seed(8)
simulate_smd()
simulate_smd(k_train = 50, distribution = "bernoulli")
simulate_smd(distribution = "bernoulli", model = "es * x[ ,1] * x[ ,2]")
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.