Skip to contents

Summarizes how the levels of one or more categorical variables are distributed across studies in a meta-analytic dataset.

Usage

meta_structure(data, formula, drop = TRUE)

Arguments

data

A data frame containing the meta-analytic dataset.

formula

A formula specifying one or more categorical variables and the study-level grouping variable. The grouping variable must appear last. For example, `~ moderator | study` or `~ outcome + time | study`.

drop

Logical. Should unused factor levels be dropped? Defaults to `TRUE`.

Value

A named list containing:

tab

A contingency table containing the number of effect sizes for each study-by-level combination.

n_effects

Total number of effect sizes represented in the table.

n_studies

Number of studies.

n_levels

Number of factor levels or factor-level combinations.

effects_by_study

Number of effect sizes contributed by each study.

effects_by_level

Number of effect sizes associated with each factor level.

levels_by_study

Number of distinct factor levels represented in each study.

studies_by_level

Number of studies in which each factor level occurs.

coverage_by_study

Proportion of all factor levels represented in each study.

coverage_by_level

Proportion of studies in which each factor level occurs.

single_level

Logical vector identifying studies containing exactly one factor level.

multiple_levels

Logical vector identifying studies containing more than one factor level.

all_levels

Logical vector identifying studies containing all factor levels.

single_level_type

For studies containing exactly one factor level, the corresponding level. Other studies are assigned `NA`.

single_level_studies

Study identifiers for studies containing exactly one factor level.

multiple_level_studies

Study identifiers for studies containing more than one factor level.

all_level_studies

Study identifiers for studies containing all factor levels.

cooccurrence

A symmetric matrix giving the number of studies in which each pair of factor levels occurs together.

effects_per_cell

Frequency distribution of the number of effect sizes in non-empty study-by-level cells.

study_summary

A data frame containing study-level diagnostic summaries.

level_summary

A data frame containing factor-level diagnostic summaries.

marginal

If multiple factors are supplied, a named list containing separate structural summaries for each factor. Otherwise `NULL`.

Details

The function is intended as a diagnostic tool for inspecting the structure of dependent effect sizes before fitting meta-analytic or meta-regression models. It reports the number of effects and studies associated with each factor level, the number of factor levels represented within each study, study-level coverage, and the co-occurrence of factor levels within studies.

For a formula such as

`~ moderator | study`

the function constructs a study-by-moderator contingency table in which each cell contains the number of effect sizes observed for a particular study and moderator level.

Several summaries are then computed from this table. In particular, the function distinguishes between studies containing only one factor level and studies containing multiple levels. This can be useful for assessing how much information about a categorical moderator is available within studies, rather than exclusively between studies.

The `cooccurrence` matrix reports the number of studies in which each pair of factor levels occurs together. Its diagonal gives the number of studies in which each level occurs, while off-diagonal entries give the number of studies that contain both levels.

If more than one factor is specified, as in

`~ outcome + time | study`,

the main contingency table is based on the interaction of the factors. Marginal summaries for each factor separately are additionally returned in the `marginal` component.

Examples

dat <- data.frame(
  study = c(1, 1, 2, 2, 2, 3),
  outcome = factor(c("A", "B", "A", "A", "B", "B"))
)

res <- meta_structure(dat, ~ outcome | study)

res$tab
#>      outcome
#> study A B
#>     1 1 1
#>     2 2 1
#>     3 0 1
res$study_summary
#>   study effects levels coverage single_level multiple_levels all_levels
#> 1     1       2      2      1.0        FALSE            TRUE       TRUE
#> 2     2       3      2      1.0        FALSE            TRUE       TRUE
#> 3     3       1      1      0.5         TRUE           FALSE      FALSE
#>   single_level_type
#> 1              <NA>
#> 2              <NA>
#> 3                 B
res$level_summary
#>   level effects studies studies_only studies_with_other  coverage
#> 1     A       3       2            0                  2 0.6666667
#> 2     B       3       3            1                  2 1.0000000
res$cooccurrence
#>        outcome
#> outcome A B
#>       A 2 2
#>       B 2 3