You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/perform_mr.Rmd
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -170,7 +170,7 @@ length(p1)
170
170
171
171
Lines are drawn for each method used in `mr(dat)`, the slope of the line corresponding to the estimated causal effect. To limit which lines are drawn, simply specify the desired methods, e.g., to only draw the lines for the MR Egger and IVW causal effect estimates:
172
172
173
-
```{r}
173
+
```{r fig.alt="A scatter plot visualising the two-sample data points and the following fitted models; Inverse Variance Weighted and MR-Egger.", fig.asp=1.15}
174
174
res <- mr(dat, method_list = c("mr_egger_regression", "mr_ivw"))
Asymmetry in a funnel plot is useful for gauging the reliability of a particular MR analysis. Funnel plots can be produced using the single SNP results as follows:
230
230
231
-
```{r fig.alt="A funnel plot showing the causal effect for each SNP and the inverse variance weighted and MR-Egger estimates using all the SNPs.", fig.asp=1.15}
231
+
```{r fig.alt="A funnel plot showing the causal effect for each SNP and the inverse variance weighted and MR-Egger estimates using all the SNPs.", fig.asp=1.15, fig.height=7}
```{r fig.alt="A forest plot showing the estimated causal effects for each risk factor on the outcome."}
276
276
min(exp(res$b - 1.96*res$se)) # identify value for 'lo' in forest_plot_1_to_many
277
277
max(exp(res$b + 1.96*res$se)) # identify value for 'up' in forest_plot_1_to_many
278
278
@@ -295,7 +295,7 @@ forest_plot_1_to_many(
295
295
296
296
It is also possible to add additional columns and column titles and to choose the size of the text in the columns:
297
297
298
-
```{r}
298
+
```{r fig.alt="A forest plot showing the estimated causal effects for each risk factor on the outcome including columns for the no. SNPs and p-value."}
299
299
res$pval <- formatC(res$pval, format = "e", digits = 2)
300
300
301
301
forest_plot_1_to_many(
@@ -323,7 +323,7 @@ forest_plot_1_to_many(
323
323
324
324
In my own workflow I prefer to to keep the plot free of axis and column titles and to add them separately in a program like Powerpoint:
325
325
326
-
```{r}
326
+
```{r fig.alt="A forest plot showing the estimated causal effects for each risk factor on the outcome including columns for the no. SNPs and p-value without column headers."}
327
327
forest_plot_1_to_many(
328
328
res,
329
329
b = "b",
@@ -364,7 +364,7 @@ res <-
364
364
)
365
365
```
366
366
367
-
```{r}
367
+
```{r fig.alt="A forest plot showing the estimated causal effects for each method for each risk factor on the outcome."}
368
368
forest_plot_1_to_many(
369
369
res,
370
370
b = "b",
@@ -387,7 +387,7 @@ forest_plot_1_to_many(
387
387
388
388
In this next example we plot the same results as above but with results stratified by a grouping variable. We also select one MR method for each unique exposure-outcome combination and sort the results by decreasing effect size within each group (i.e. largest effect at the top).
389
389
390
-
```{r}
390
+
```{r fig.alt="Forest plot split by a subcategory variable."}
0 commit comments