Draw a scatter plot of the genetic associations and/or causal estimates

Description

The function mr_plot has two functionalities. It can generate a visual representation of both MRInput and MRAll objects.

Usage

1
2
3
4
5
6
7
8
9
mr_plot(object, error = TRUE, line = "ivw", orientate = FALSE,
  interactive = TRUE, labels = FALSE)

## S4 method for signature 'MRInput'
mr_plot(object, error = TRUE, line = "ivw",
  orientate = FALSE, interactive = TRUE, labels = FALSE)

## S4 method for signature 'MRAll'
mr_plot(object)

Arguments

object

An MRInput object or an MRAll object.

error

When viewing an MRInput object, one can choose whether to include error bars (default is to include).

line

When viewing an MRInput object, one can choose whether to include the IVW estimate (line = "ivw") or the MR-Egger estimate (line = "egger").

orientate

When viewing an MRInput object, one can choose whether to orientate all genetic variants so that the associations with the risk factor are all positive. This is recommended particularly when plotting the MR-Egger estimate, although the default setting is FALSE.

interactive

When viewing an MRInput object, one can choose whether to produce an interactive graph using the plotly package, or a static graph using the regular plot command.

labels

When viewing an MRInput object with interactive set to FALSE, setting labels to TRUE means that the name of each genetic variants appears above the corresponding datapoint.

...

Additional arguments to be passed to other methods.

Details

The result is dependent on the type of object passed to mr_plot. When the object is an MRInput object, the function uses either the plot command (if interactive is set to FALSE) or plotly syntax (if interactive is set to TRUE) to plot the association estimates against each other. If interactive is set to FALSE, then a static graph is produced. By setting labels to TRUE, the names of the genetic variants appear above the points. This produces a less visually appealing graph, but one where it is easier to identify the individual genetic variants. If interactive is set to TRUE, then the plot is interactive and the user can hover over the various points to see the name of the associated genetic variant and its association estimates. When the object is an MRAll object, the function generates a ggplot to compare the causal estimates proposed by different methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
mr_plot(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds, byse = chdloddsse),
  line="ivw")
mr_plot(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds, byse = chdloddsse),
  error=FALSE, line="egger", orientate = TRUE)
mr_plot(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds, byse = chdloddsse),
  line="ivw", interactive=FALSE) # produces a static graph
mr_plot(mr_allmethods(mr_input(bx = ldlc, bxse = ldlcse,
   by = chdlodds, byse = chdloddsse), method="all", iterations = 1000))
  # iterations is set to 1000 to reduce runtime for the mr_median method,
  # 10000 iterations are recommended in practice
mr_plot(mr_allmethods(mr_input(bx = ldlc, bxse = ldlcse,
   by = chdlodds, byse = chdloddsse), method="ivw"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.