Latest updates

Short video introduction

Click here for a short video demonstrating the use of the package.

Helpfile examples

Click here for some of the code and output from the examples in the helpfiles.

Once the package is installed, there is a summary helpfile which can be viewed in Stata with:

help mrrobust

This has links to the helpfile for each command, which has an example near the bottom. In these examples you can click on the code to run it.

Overview

The mrrobust package is a collection of commands for performing two-sample Mendelian randomization analyses using summary data of genotype-phenotype and genotype-outcome associations.

Such data can be obtained from repositories such as MR-Base http://www.mrbase.org (Hemani et al. 2016).

The package contains the following commands:

Installing and updating mrrobust

To install mrrobust in Stata versions 13 and later you have two choices.

1. Use net install

net install mrrobust, from(https://raw.github.com/remlapmot/mrrobust/master/) replace
mrdeps

In this code mrdeps installs the dependencies. These are addplot, kdens, and moremata packages (all by Ben Jann), the heterogi command (Orsini et al.), the metan command (Harris et al.), and the grc1leg command (Wiggins).

If you have previously installed the package and the net install command above fails with an error message that there are two copies of the package installed simply run adoupdate.

To check if there is an update available to any of your user-written Stata packages run adoupdate. To update mrrobust run:

adoupdate mrrobust, update

To uninstall mrrobust, issue in Stata:

ado uninstall mrrobust

If this fails with an error message mentioning that you have “multiple citations/instances of the package installed” simply issue adoupdate mrrobust which should leave you with the most recent version of the package you previously installed. You can then run ado uninstall mrrobust.

2. Use the github package

net install github, from("https://haghish.github.io/github/")
gitget mrrobust

This automatically installs the dependencies.

To update the package issue:

github update mrrobust

To uninstall mrrobust issue:

github uninstall mrrobust

Installation for Stata version 12 and earlier versions

The net install syntax for installing mrrobust does not work under Stata version 12 and earlier because this webpage has an address starting with https rather than http. In such cases you need to do a manual installation.

To download and install mrrobust manually:

The installation commands for the other dependencies should work. However, if you want to install them manually:

Extract the zip archives and save all files on your adopath.

To uninstall a manual installation simply delete the files that you placed on your adopath.

Code testing

As far as I know, and unlike R which has the testthat package, there is no recognised standard for writing unit tests for Stata commands. However, StataCorp refer to such do-files as cscripts (certification scripts). If you are interested I publish my cscripts (and their log files of output) in the cscripts directory in the GitHub repository.

Authors

Tom Palmer tom.palmer@lancaster.ac.uk, Wesley Spiller, Neil Davies

How to cite the mrrobust package

Spiller W, Davies NM, Palmer TM. Software Application Profile: mrrobust - A tool for performing two-sample summary Mendelian randomization analyses. International Journal of Epidemiology, 2019, 48, 3, 684-690. https://doi.org/10.1093/ije/dyy195

Thank you to all our users who have cited mrrobust. We made The Best of IJE 2019! https://academic.oup.com/ije/pages/the_best_of_ije

Collaboration

If you would like to extend the code or add new commands I am open to receiving pull requests on GitHub or send me an email.

References

Acknowledgements

Thanks for helpful feedback and suggestions to (in no particular order): Jasmine Khouja, Michael Holmes, Caroline Dale, Amy Taylor, Rebecca Richmond, Judith Brand, Yanchun Bao, Kawthar Al-Dabhani, Michalis Katsoulis, Ghazaleh Fatemifar, and Steve Burgess.