Skip to contents

This function provides a unified interface to various data-generating mechanisms for simulation studies. The specific DGM is determined by the first argument. See vignette("Adding_New_DGMs", package = "PublicationBiasBenchmark") for details of extending the package with new DGMs.

Usage

simulate_dgm(dgm_name, settings)

Arguments

dgm_name

Character string specifying the DGM type

settings

List containing the required parameters for the DGM or numeric condition_id

Value

A data frame containing the generated data with standardized structure

Output Structure

The returned data frame follows a standardized schema that downstream functions rely on. Across the currently implemented DGMs, the following columns are used:

  • yi (numeric): The effect size estimate.

  • sei (numeric): Standard error of yi.

  • ni (integer): Total sample size for the estimate (e.g., sum over groups where applicable).

  • es_type (character): Effect size type, used to disambiguate the scale of yi. Currently used values are "SMD" (standardized mean difference / Cohen's d), "logOR" (log odds ratio), and "none" (unspecified generic continuous coefficient).

  • study_id (integer/character, optional): Identifier of the primary study/cluster when a DGM yields multiple estimates per study (e.g., Alinaghi2018, PRE). If absent, each row is treated as an independent study.

Examples


simulate_dgm("Carter2019", 1)
#>              yi        sei  ni es_type
#> 1  -0.027406349 0.28285599  50     SMD
#> 2  -0.096607006 0.07837172 652     SMD
#> 3   0.016303565 0.25400447  62     SMD
#> 4   0.002914326 0.14990642 178     SMD
#> 5  -0.199668025 0.50124431  16     SMD
#> 6   0.169618220 0.20888902  92     SMD
#> 7  -0.403814247 0.45174844  20     SMD
#> 8   0.250896476 0.27843914  52     SMD
#> 9  -0.152818816 0.47209208  18     SMD
#> 10  0.361928439 0.22543004  80     SMD

simulate_dgm("Carter2019", list(mean_effect = 0, effect_heterogeneity = 0,
                       bias = "high", QRP = "high", n_studies = 10))
#>           yi       sei  ni es_type
#> 1  0.7838699 0.3281473  40     SMD
#> 2  0.6203106 0.2961379  48     SMD
#> 3  0.4809701 0.1971873 106     SMD
#> 4  0.1201830 0.1645514 148     SMD
#> 5  0.7183940 0.3273348  40     SMD
#> 6  0.6595228 0.2853888  52     SMD
#> 7  0.2868821 0.1319919 232     SMD
#> 8  0.2173063 0.1052860 363     SMD
#> 9  1.0274545 0.2855963  56     SMD
#> 10 0.2882129 0.1368006 216     SMD

simulate_dgm("Stanley2017", list(environment = "SMD", mean_effect = 0,
                        effect_heterogeneity = 0, bias = 0, n_studies = 5,
                        sample_sizes = c(32,64,125,250,500)))
#>             yi        sei   ni es_type
#> 1 -0.046999782 0.25003451   64     SMD
#> 2 -0.115987229 0.17692527  128     SMD
#> 3  0.036326602 0.12650154  250     SMD
#> 4  0.067512997 0.08946820  500     SMD
#> 5  0.006335243 0.06324571 1000     SMD