Title: | 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 heat maps, traffic light plots, and more. |
Authors: | Malcolm Barrett [aut, cre] , Julie M. Petersen [aut] , Ludovic Trinquart [aut] |
Maintainer: | Malcolm Barrett <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.2.9000 |
Built: | 2024-11-07 03:12:45 UTC |
Source: | https://github.com/malcolmbarrett/metaconfoundr |
Count and plot non-confounders
count_non_confounders(.df) plot_non_confounders(.df, ..., geom = ggplot2::geom_col, sort = TRUE)
count_non_confounders(.df) plot_non_confounders(.df, ..., geom = ggplot2::geom_col, sort = TRUE)
.df |
A data frame, usually the result of |
... |
Arguments passed to |
geom |
The ggplot2 geom to use |
sort |
Logical. Should the results be sorted? |
a tibble
or ggplot
ipi %>% metaconfoundr() %>% plot_non_confounders(size = 3, geom = ggplot2::geom_point)
ipi %>% metaconfoundr() %>% plot_non_confounders(size = 3, geom = ggplot2::geom_point)
A helper function to facet by constructs in 'mc_heatmap()
and
mc_trafficlight()
facet_constructs(...)
facet_constructs(...)
... |
Arguments passed to |
a facet component
Other plots:
geom_cochrane()
,
mc_heatmap()
,
scale_fill_cochrane()
,
theme_mc()
Add Cochrane-style symbols to heatmaps and traffic light plots
geom_cochrane( mapping = ggplot2::aes(shape = control_quality), data = NULL, stat = "identity", position = "identity", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
geom_cochrane( mapping = ggplot2::aes(shape = control_quality), data = NULL, stat = "identity", position = "identity", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
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 |
a geom
Other plots:
facet_constructs()
,
mc_heatmap()
,
scale_fill_cochrane()
,
theme_mc()
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.
ipi ipi_wide ipi_metaanalysis
ipi ipi_wide ipi_metaanalysis
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.
Ahrens et al. (2019)
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_robins()
is a helper function to modify metaconfoundr labels to use
ROBINS-like labels: low risk, some concerns, high risk.
label_robins()
label_robins()
a character vector of ROBINS labels
mc_heatmap(metaconfoundr(ipi)) + ggplot2::scale_fill_ordinal(labels = label_robins()) mc_heatmap(metaconfoundr(ipi)) + scale_fill_cochrane(labels = label_robins())
mc_heatmap(metaconfoundr(ipi)) + ggplot2::scale_fill_ordinal(labels = label_robins()) mc_heatmap(metaconfoundr(ipi)) + scale_fill_cochrane(labels = label_robins())
launch_metaconfoundr_app()
launches a Shiny app to create visualizations of
confounding control in meta-analyses
launch_metaconfoundr_app()
launch_metaconfoundr_app()
A Shiny app
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.
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() )
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() )
... |
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? |
a function that tidies the data
metaconfoundr()
summariesmc_heatmap()
and mc_trafficlight()
visualize the results of
metaconfoundr()
, summarizing the quality of confounder control in each
study.
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 )
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 )
.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 |
a ggplot
Other plots:
facet_constructs()
,
geom_cochrane()
,
scale_fill_cochrane()
,
theme_mc()
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))
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))
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.
metaconfoundr(.df, data_format = mc_detect_layout())
metaconfoundr(.df, data_format = mc_detect_layout())
.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 |
a tibble
metaconfoundr(ipi) metaconfoundr(ipi_wide) ipi_wide2 <- ipi_wide %>% dplyr::rename(scope = construct) metaconfoundr(ipi_wide2, mc_wider(construct = "scope"))
metaconfoundr(ipi) metaconfoundr(ipi_wide) ipi_wide2 <- ipi_wide %>% dplyr::rename(scope = construct) metaconfoundr(ipi_wide2, mc_wider(construct = "scope"))
Add Cochrane-style palettes to ggplots
scale_fill_cochrane(...) scale_color_cochrane(...) scale_shape_cochrane(...)
scale_fill_cochrane(...) scale_color_cochrane(...) scale_shape_cochrane(...)
... |
Arguments passed to the underline scale function |
scales for ggplot
Other plots:
facet_constructs()
,
geom_cochrane()
,
mc_heatmap()
,
theme_mc()
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.
score_control(.df, score = c("adequate", "sum", "controlled"))
score_control(.df, score = c("adequate", "sum", "controlled"))
.df |
A data frame, usually the result of |
score |
The approach used to calculate the score. |
a tibble
library(dplyr) ipi %>% metaconfoundr() %>% filter(is_confounder == "Y") %>% score_control("controlled") %>% arrange(desc(score))
library(dplyr) ipi %>% metaconfoundr() %>% filter(is_confounder == "Y") %>% score_control("controlled") %>% arrange(desc(score))
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.
summarize_control_quality(.df, ..., domains = TRUE)
summarize_control_quality(.df, ..., domains = TRUE)
.df |
A data frame, usually the result of |
... |
Boolean arguments to declare adequate control logic |
domains |
Logical. Include the domains in the output? If |
A tibble
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()
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
theme_mc(base_size = 14)
theme_mc(base_size = 14)
base_size |
base font size, given in pts. |
a ggplot theme
Other plots:
facet_constructs()
,
geom_cochrane()
,
mc_heatmap()
,
scale_fill_cochrane()