Skip to content

Commit 59d7e2f

Browse files
committed
Formatting
1 parent 08e66a8 commit 59d7e2f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

vignettes/perform_mr.Rmd

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,12 @@ res <- mr(dat2)
261261
In this example we wish to plot results from an MR analysis of the effect of multiple exposures on coronary heart disease, with results sorted by decreasing effect size (largest effect at the top of the plot) and with one MR method for each unique exposure-outcome combination. We will also make the size of each point estimate proportional to its inverse variance. This is a useful way to draw attention towards the most reliable results and away from results with very wide confidence intervals. To specify the size of the point estimate, set the weight argument to the name of the column in the data with the weight information.
262262

263263
```{r eval=FALSE}
264-
res <- subset_on_method(res) # default is to subset on either the IVW method (>1 instrumental SNP) or Wald ratio method (1 instrumental SNP).
265-
res <- sort_1_to_many(res, b = "b", sort_action = 4) # this sorts results by decreasing effect size (largest effect at top of the plot)
266-
res <- split_exposure(res) # to keep the Y axis label clean we exclude the exposure ID labels from the exposure column
264+
# default is to subset on either the IVW method (>1 instrumental SNP) or Wald ratio method (1 instrumental SNP).
265+
res <- subset_on_method(res)
266+
# this sorts results by decreasing effect size (largest effect at top of the plot)
267+
res <- sort_1_to_many(res, b = "b", sort_action = 4)
268+
# to keep the Y axis label clean we exclude the exposure ID labels from the exposure column
269+
res <- split_exposure(res)
267270
res$weight <- 1/res$se
268271
```
269272

@@ -273,8 +276,10 @@ load(system.file("extdata", "forestplot_1_to_many_data.RData", package = "TwoSam
273276
```
274277

275278
```{r fig.alt="A forest plot showing the estimated causal effects for each risk factor on the outcome."}
276-
min(exp(res$b - 1.96*res$se)) # identify value for 'lo' in forest_plot_1_to_many
277-
max(exp(res$b + 1.96*res$se)) # identify value for 'up' in forest_plot_1_to_many
279+
# identify value for 'lo' in forest_plot_1_to_many
280+
min(exp(res$b - 1.96*res$se))
281+
# identify value for 'up' in forest_plot_1_to_many
282+
max(exp(res$b + 1.96*res$se))
278283
279284
forest_plot_1_to_many(
280285
res,

0 commit comments

Comments
 (0)