This vignette explains how to access and use the presimulated
meta-analytic datasets from the PublicationBiasBenchmark
package. While the Using
Precomputed Results vignette describes how to work with method
outputs applied to these datasets, this vignette focuses on accessing
the raw simulated datasets themselves, allowing you to apply your own
methods or conduct custom analyses.
For the sake of not re-downloading the datasets every time you re-knit this vignette, we disable evaluation of code chunks below. (To examine the output, please copy to your local R session.)
The package provides access to the presimulated meta-analytic datasets used in the benchmark. Each dataset represents a collection of studies (effect sizes and standard errors) generated according to specific simulation conditions. These are the exact same datasets to which all benchmark methods were applied.
Presimulated datasets contain the raw study-level data for meta-analyses, including:
yi (numeric): The effect size estimate for each
studysei (numeric): Standard error of yini (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). If absent, each row is treated as an independent
studycondition_id (integer): Identifier of the
conditionrepetition_id (integer): Identifier for the simulation
repetitionEach dataset represents one simulated meta-analysis under specific conditions (e.g., true effect size, heterogeneity, number of studies, publication bias pattern).
Accessing the presimulated datasets allows you to:
The package includes presimulated datasets for several DGMs. See the Adding New DGMs vignette for details on the individual DGMs and their simulation designs.
You can view the specific conditions for each DGM using the dgm_conditions()
function:
# View conditions for the Stanley2017 DGM
conditions <- dgm_conditions("Stanley2017")
head(conditions)Each condition represents a unique combination of simulation parameters that determines how the meta-analytic datasets are generated.
Before accessing the presimulated datasets, you need to download them
from the package repository. The download_dgm_datasets()
function downloads the datasets for a specified DGM:
# Specify path to the directory containing resources
PublicationBiasBenchmark.options(resources_directory = "/path/to/files")
# Download presimulated datasets for the Stanley2017 DGM
download_dgm_datasets("Stanley2017")Note: Dataset files can be quite large as they contain all individual study data across many simulation repetitions. Each DGM may require several gigabytes of storage space. The datasets are downloaded to a local cache directory and are automatically available for subsequent analysis. You only need to download them once.
Once downloaded, you can retrieve the presimulated datasets using the
retrieve_dgm_dataset()
function. This function allows you to extract specific simulation
repetitions and conditions.
You can retrieve a specific simulated meta-analytic dataset by specifying the condition and repetition:
# Retrieve first repetition of condition 1
dataset <- retrieve_dgm_dataset(
dgm = "Stanley2017",
condition_id = 1,
repetition_id = 1
)
# Examine the dataset structure
head(dataset)
str(dataset)This returns a data frame containing the study-level data (effect
sizes yi, standard errors sei, …) for that
specific simulated meta-analysis.
To retrieve all simulation repetitions for a specific condition, omit
the repetition_id argument:
# Retrieve all repetitions for condition 1
all_reps <- retrieve_dgm_dataset(
dgm = "Stanley2017",
condition_id = 1
)
# Check how many repetitions are available
length(unique(all_reps$repetition_id))
# Extract data for a specific repetition
rep_5 <- all_reps[all_reps$repetition_id == 5, ]This is useful when you want to apply your method to multiple repetitions without repeatedly calling the retrieve function.