Title: | Visualize 'Confounder' Control in Meta-Analyses |
Version: | 0.1.2 |
Description: | Visualize 'confounder' control in meta-analysis. 'metaconfoundr' is an approach to evaluating bias in studies used in meta-analyses based on the causal inference framework. Study groups create a causal diagram displaying their assumptions about the scientific question. From this, they develop a list of important 'confounders'. Then, they evaluate whether studies controlled for these variables well. 'metaconfoundr' is a toolkit to facilitate this process and visualize the results as heat maps, traffic light plots, and more. |
License: | MIT + file LICENSE |
URL: | https://github.com/malcolmbarrett/metaconfoundr |
BugReports: | https://github.com/malcolmbarrett/metaconfoundr/issues |
Depends: | R (≥ 3.5.0) |
Imports: | dplyr (≥ 1.0.0), forcats, ggplot2 (≥ 3.4.0), magrittr, purrr, rlang (≥ 0.1.2), shiny, stringr, tibble, tidyr (≥ 1.0.0), tidyselect |
Suggests: | covr, knitr, metafor, patchwork, readr, rio, rmarkdown, roxygen2, spelling, testthat (≥ 3.0.0), vdiffr |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Language: | en-US |
LazyData: | true |
RoxygenNote: | 7.1.2 |
NeedsCompilation: | no |
Packaged: | 2023-01-17 18:42:07 UTC; malcolmbarrett |
Author: | Malcolm Barrett |
Maintainer: | Malcolm Barrett <malcolmbarrett@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-01-17 19:00:09 UTC |
metaconfoundr: Visualize Confounder Control in Meta-Analyses
Description
Visualize confounder control in meta-analysis. 'metaconfoundr' is an approach to evaluating bias in studies used in meta-analyses based on the causal inference framework. Study groups create a causal diagram displaying their assumptions about the scientific question. From this, they develop a list of important confounders. Then, they evaluate whether studies controlled for these variables well. 'metaconfoundr' is a toolkit to facilitate this process and visualize the results as heatmaps, traffic light plots, and more.
Author(s)
Maintainer: Malcolm Barrett malcolmbarrett@gmail.com (ORCID)
Authors:
Julie M. Petersen juliemo@bu.edu (ORCID)
Ludovic Trinquart ludovic@bu.edu (ORCID)
See Also
Useful links:
Report bugs at https://github.com/malcolmbarrett/metaconfoundr/issues
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Count and plot non-confounders
Description
Count and plot non-confounders
Usage
count_non_confounders(.df)
plot_non_confounders(.df, ..., geom = ggplot2::geom_col, sort = TRUE)
Arguments
.df |
A data frame, usually the result of |
... |
Arguments passed to |
geom |
The ggplot2 geom to use |
sort |
Logical. Should the results be sorted? |
Value
a tibble
or ggplot
Examples
ipi %>%
metaconfoundr() %>%
plot_non_confounders(size = 3, geom = ggplot2::geom_point)
Facet by constructs
Description
A helper function to facet by constructs in 'mc_heatmap()
and
mc_trafficlight()
Usage
facet_constructs(...)
Arguments
... |
Arguments passed to |
Value
a facet component
See Also
Other plots:
geom_cochrane()
,
mc_heatmap()
,
scale_fill_cochrane()
,
theme_mc()
Add Cochrane-style symbols to heatmaps and traffic light plots
Description
Add Cochrane-style symbols to heatmaps and traffic light plots
Usage
geom_cochrane(
mapping = ggplot2::aes(shape = control_quality),
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Value
a geom
See Also
Other plots:
facet_constructs()
,
mc_heatmap()
,
scale_fill_cochrane()
,
theme_mc()
IPI data
Description
These data represent 14 analyses (retrospective cohorts and sibling-matched designs) to evaluate the association between short interpregnancy interval (<6 months versus 18-23 months) and risk of preterm birth (<37 weeks gestation) and the adequacy of confounder control (Petersen et al.). Adequacy of confounder control was determined overall for each study as well as by variable and construct (groupings of conceptually related variables).These studies are a subset of studies originally identified in a systematic review by Ahrens et al. to summarize associations between short interpregnancy interval and a variety of perinatal outcomes in high-resource settings.
Usage
ipi
ipi_wide
ipi_metaanalysis
Format
An object of class tbl_df
(inherits from tbl
, data.frame
) with 407 rows and 5 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 37 rows and 14 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 11 rows and 9 columns.
Source
Ahrens et al. (2019)
References
Ahrens KA, Nelson H, Stidd RL, Moskosky S, Hutcheon JA. Short interpregnancy intervals and adverse perinatal outcomes in high-resource settings: An updated systematic review. Paediatr Perinat Epidemiol. 2019;33(1):O25-O47.
Petersen JM, Barrett M, Ahrens K, Murray EJ, Hogue C, Mumford S, Bryant Mantha A, Fox MP, Gadupudi S, Trinquart L. Confounder Matrix: A Tool to Assess Confounding Bias in Systematic Reviews of Observational Studies. 2020
Label values using ROBINS approach
Description
label_robins()
is a helper function to modify metaconfoundr labels to use
ROBINS-like labels: low risk, some concerns, high risk.
Usage
label_robins()
Value
a character vector of ROBINS labels
Examples
mc_heatmap(metaconfoundr(ipi)) +
ggplot2::scale_fill_ordinal(labels = label_robins())
mc_heatmap(metaconfoundr(ipi)) +
scale_fill_cochrane(labels = label_robins())
Launch metaconfoundr Shiny app
Description
launch_metaconfoundr_app()
launches a Shiny app to create visualizations of
confounding control in meta-analyses
Usage
launch_metaconfoundr_app()
Value
A Shiny app
Tidy metaconfoundr data layouts
Description
mc_longer()
and mc_wider()
are helper functions to put metaconfoundr()
for long and wide data sets, respectively. results into a tidy format.
mc_detect_layout()
chooses between the two automatically based on the
number of variables in the data frame. mc_study_values()
helps standardize
evaluations of control quality.
Usage
mc_detect_layout(...)
mc_longer(
study = contains("construct"),
construct = contains("construct"),
variable = matches("variable|factor"),
control_quality = contains("control_quality"),
is_confounder = contains("confounder"),
study_values = mc_study_values()
)
mc_study_values(inadequate = 0, some_concerns = 1, adequate = 2)
mc_wider(
construct = contains("construct"),
variable = matches("variable|factor"),
is_confounder = contains("confounder"),
study = everything(),
study_values = mc_study_values()
)
Arguments
... |
Additional arguments passed to |
study |
The column with the name of the studies |
construct |
The domain or construct column |
variable |
The column that describes the confounding variables |
control_quality |
The column that describes the confounding control quality |
is_confounder |
The column that describes if a variable is a confounder |
study_values |
What are the levels of |
inadequate |
Which value signifies inadequate control? |
some_concerns |
Which value signifies control with some concerns? |
adequate |
Which value signifies adequate control? |
Value
a function that tidies the data
Plot a heatmap or traffic light plot of metaconfoundr()
summaries
Description
mc_heatmap()
and mc_trafficlight()
visualize the results of
metaconfoundr()
, summarizing the quality of confounder control in each
study.
Usage
mc_heatmap(
.df,
legend_title = "control quality",
sort = FALSE,
by_group = FALSE,
score = c("adequate", "sum", "controlled"),
non_confounders = FALSE
)
mc_trafficlight(
.df,
size = 8,
legend_title = "control quality",
sort = FALSE,
by_group = FALSE,
score = c("adequate", "sum", "controlled"),
non_confounders = FALSE
)
Arguments
.df |
A data frame, usually the result of |
legend_title |
The legend title |
sort |
Logical. Sort by confounder score? Calculated by |
by_group |
Logical. If sorted, sort within domain? |
score |
The approach used to calculate the score. |
non_confounders |
Logical. Include non-confounders? Default is |
size |
The size of the points in the traffic light plot |
Value
a ggplot
See Also
Other plots:
facet_constructs()
,
geom_cochrane()
,
scale_fill_cochrane()
,
theme_mc()
Examples
ipi %>%
metaconfoundr() %>%
dplyr::mutate(variable = stringr::str_wrap(variable, 10)) %>%
mc_heatmap() +
theme_mc() +
facet_constructs() +
ggplot2::guides(x = ggplot2::guide_axis(n.dodge = 2))
ipi %>%
metaconfoundr() %>%
mc_trafficlight() +
geom_cochrane() +
facet_constructs() +
scale_fill_cochrane() +
theme_mc() +
ggplot2::guides(x = ggplot2::guide_axis(n.dodge = 2))
Prepare a meta-analysis data set for metaconfoundr
Description
metaconfoundr()
standardizes data frames with information on how well a set
of studies control for a set of variables. In this approach, a set of domain
experts agree on the variables that are required to properly control for
confounding for a scientific question. Then, for a given confounder, the
studies are described as being adequately controlled, inadequately
controlled, or controlled with some concerns. metaconfoundr()
is intended
to standardize data for use in mc_heatmap()
and mc_trafficlight()
.
See the vignette on data preparation for more information on how to set up
your evaluation.
Usage
metaconfoundr(.df, data_format = mc_detect_layout())
Arguments
.df |
A data frame. See the vignette on data preparation for more details. |
data_format |
The format of the data. Detected automatically by default,
but explicit options include |
Value
a tibble
Examples
metaconfoundr(ipi)
metaconfoundr(ipi_wide)
ipi_wide2 <- ipi_wide %>%
dplyr::rename(scope = construct)
metaconfoundr(ipi_wide2, mc_wider(construct = "scope"))
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
- tidyselect
contains
,ends_with
,everything
,last_col
,matches
,num_range
,one_of
,starts_with
Add Cochrane-style palettes to ggplots
Description
Add Cochrane-style palettes to ggplots
Usage
scale_fill_cochrane(...)
scale_color_cochrane(...)
scale_shape_cochrane(...)
Arguments
... |
Arguments passed to the underline scale function |
Value
scales for ggplot
See Also
Other plots:
facet_constructs()
,
geom_cochrane()
,
mc_heatmap()
,
theme_mc()
Add a score of confounding control
Description
score_control()
adds a variable, score
, that summarizes how well a study
controls for a domain or construct. Used to sort heatmaps and traffic light
plots.
Usage
score_control(.df, score = c("adequate", "sum", "controlled"))
Arguments
.df |
A data frame, usually the result of |
score |
The approach used to calculate the score. |
Value
a tibble
Examples
library(dplyr)
ipi %>%
metaconfoundr() %>%
filter(is_confounder == "Y") %>%
score_control("controlled") %>%
arrange(desc(score))
Summarize the control quality of studies
Description
summarize_control_quality()
allows you to summarize how well studies
control for variables within one or more domains, and how well those domains
are controlled for overall. Each logical statement is a domain and can be
named.
Usage
summarize_control_quality(.df, ..., domains = TRUE)
Arguments
.df |
A data frame, usually the result of |
... |
Boolean arguments to declare adequate control logic |
domains |
Logical. Include the domains in the output? If |
Value
A tibble
Examples
summary_df <- summarize_control_quality(
metaconfoundr(ipi),
Sociodemographics = `Maternal age` & `Race/ethnicity` & `Marital status`,
Socioeconomics = `SES category` | Insurance & Education,
"Reproductive Hx" = `Prior pregnancy outcome`
)
summary_df
summary_df %>%
mc_trafficlight() +
theme_mc() +
facet_constructs() +
geom_cochrane() +
scale_fill_cochrane()
A minimal theme for metaconfoundr plots
Description
A minimal theme for metaconfoundr plots
Usage
theme_mc(base_size = 14)
Arguments
base_size |
base font size, given in pts. |
Value
a ggplot theme
See Also
Other plots:
facet_constructs()
,
geom_cochrane()
,
mc_heatmap()
,
scale_fill_cochrane()