Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better fix for perform_mr vignette #567

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions vignettes/perform_mr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ vignette: >
---

```{r, include=FALSE}
evalinr44 <- getRversion() >= '4.4.0'
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
Expand Down Expand Up @@ -612,7 +613,7 @@ The current plots being generated are not necessarily adequate because while the

### Using your own summary data

If you want to perform analysis with your local summary data (i.e. not in the OpenGWAS database) then use then look up the `mv_extract_exposures_local()` function in replace of the `mv_extract_exposures()` function.
If you want to perform analysis with your local summary data (i.e. not in the OpenGWAS database) then use then look up the `mv_extract_exposures_local()` function instead of the `mv_extract_exposures()` function.

* * *

Expand All @@ -633,7 +634,7 @@ ld_mat

Here `ld_matrix()` returns the LD correlation values (not R^2^) for each pair of variants present in the 1000 genomes data set.

```{r eval=FALSE}
```{r}
dat <- harmonise_data(
exposure_dat = bmi_exp_dat,
outcome_dat = chd_out_dat
Expand All @@ -642,19 +643,19 @@ dat <- harmonise_data(

Convert to the `MRInput` format for the MendelianRandomization package:

```{r eval=FALSE}
```{r eval=evalinr44}
dat2 <- dat_to_MRInput(dat)
```

This produces a list of `MRInput` objects that can be used with the MendelianRandomization functions, e.g.

```{r eval=FALSE}
```{r eval=evalinr44}
MendelianRandomization::mr_ivw(dat2[[1]])
```

Alternatively, convert to the `MRInput` format but also obtaining the LD matrix for the instruments

```{r eval=FALSE}
```{r eval=evalinr44}
dat2 <- dat_to_MRInput(dat, get_correlation = TRUE)
MendelianRandomization::mr_ivw(dat2[[1]], correl = TRUE)
```
Expand Down
Loading