mr_plot | R Documentation |
The function mr_plot
has three functionalities. It can generate a visual representation of MRInput
, MRMVInput
and MRAll
objects.
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)
## S4 method for signature 'MRMVInput'
mr_plot(
object,
error = TRUE,
line = TRUE,
orientate = FALSE,
interactive = TRUE,
labels = FALSE
)
object |
An |
error |
When viewing an |
line |
When viewing an |
orientate |
When viewing an |
interactive |
When viewing an |
labels |
When viewing an |
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.
When the object is an MRMVInput
object, functionality is similar except that we plot the estimated associations with the outcome on the y-axis, and fitted values of the associations with the outcome from the inverse-variance weighted method on the x-axis.
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.
mr_plot(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds, byse = chdloddsse),
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 = 50))
# iterations is set to 50 to reduce runtime for the mr_median method,
# 10000 iterations are recommended in practice
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.