forest_plot: Forest plot

View source: R/plots.r

forest_plotR Documentation

Forest plot

Description

Creates a forest plot of MR estimates from do_mr(). Will plot both the Wald ratios for all SNPs which form the instrument and inverse variance weighted method. However, if you wish for only the "discovery" results to be plotted (i.e. WR for single-SNP instruments and only IVW for multi-SNP instruments), then setting 'plot_all_res' to FALSE will achieve this. If the plot is too crowded, subsetting the results before passing them to this plotter will help.

Usage

forest_plot(
  res,
  snp_col = "snp",
  beta_col = "b",
  se_col = "se",
  pval_col = NULL,
  or_col = "or",
  or_lci_col = "or_lci95",
  or_uci_col = "or_uci95",
  method_col = "method",
  exposure_col = "exposure",
  outcome_col = "outcome",
  plot_all_res = TRUE
)

Arguments

res

A data.frame of MR results

snp_col

Column name for SNPs (Optional)

beta_col

Column name for beta (Optional)

se_col

Column name for standard error (Optional)

pval_col

Column name for P value (Optional, unused for now)

or_col

Column name for odds ratio (Optional)

or_lci_col

Column name for lower CI of OR (Optional)

or_uci_col

Column name for upper CI of OR (Optional)

method_col

Column name which contains the MR method (Optional)

exposure_col

Column name for exposure names (Optional)

outcome_col

Column name for outcome names (Optional)

plot_all_res

For multi-SNP instruments, also plot the Wald ratios for all SNPs (TRUE) or just the inverse variance weighted result (FALSE).

Value

Plot

See Also

[do_mr()]


jwr-git/mrpipeline documentation built on Oct. 2, 2022, 3:41 p.m.