Skip to content

Commit c4f1b18

Browse files
committed
Add message about MR-GRIP plot scale
1 parent 78e76a7 commit c4f1b18

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

R/scatterplot.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ mr_scatter_plot <- function(mr_results, dat) {
4444
mrres$a[mrres$method == "MR Egger (bootstrap)"] <- temp$b_i
4545
}
4646

47+
if ("MR GRIP" %in% mrres$method) {
48+
temp <- mr_grip(
49+
d$beta.exposure,
50+
d$beta.outcome,
51+
d$se.exposure,
52+
d$se.outcome,
53+
default_parameters()
54+
)
55+
# keep intercept at 0 because plot on gd versus gp axes
56+
# mrres$a[mrres$method == "MR GRIP"] <- temp$b_i
57+
msgtxt <- paste0("Strictly, it is only valid to view the MR-GRIP estimate on the standard MR scatter plot axes when the intercept is zero. The estimated intercept for this model is: ", signif(temp$b_i))
58+
message(msgtxt)
59+
}
60+
4761
ggplot2::ggplot(
4862
data = d,
4963
ggplot2::aes(x = beta.exposure, y = beta.outcome)

0 commit comments

Comments
 (0)