ivonesamplemr Stata package

One-sample Mendelian randomization (MR) / instrumental variable (IV) analyses in Stata.

Latest updates

  • January 2024:
    • Reran certification scripts under Stata 18.0
  • August 2023:
    • Added a record of the Stata version in the certification scripts
  • April 2023:
    • The images in the package website now have accompanying alt text descriptions
    • Checked the certification scripts run under the latest Stata 17.0
    • Rewrote the website using Quarto
  • February 2023:
    • Updated the R Markdown code generating the website to use the CRAN version of the Statamarkdown package
  • November 2022:
    • For an example Mendelian randomization analysis using ivonesamplemr please see Madley-Dowd et al., Maternal vitamin D during pregnancy and offspring autism and autism-associated traits: a prospective cohort study, Molecular Autism, 2022, here
  • February 2022:

Description

The package includes implementations of:

  • additive structural mean model: see help ivasmm
  • logistic structural mean model: see help ivlsmm
  • multiplicative structural mean model: see help ivmsmm
  • two-stage predictor substitution estimators: see ivtsps
  • two-stage residual inclusion estimators: see help ivtsri
  • moving window (a.k.a. sliding/rolling window) versions of these estimators: see help ivmw
  • performing estimation within quantiles of the first stage residuals: see help ivxtile

The ivtsps and ivtsri commands implement the following link functions for the second stage model:

  • identity (i.e. linear regression) - for a binary outcome this estimates a causal risk difference
  • logadd (log additive, i.e. Poisson/log-binomial regression) and logmult (log multiplicative, i.e. gamma regression) - for a binary outcome these estimate a causal risk ratio
  • logit (i.e. logistic regression) - for a binary outcome this estimates a causal odds ratio

Installation

Install the ivonesamplemr package within Stata using

net install github, from("https://haghish.github.io/github/")
github install remlapmot/ivonesamplemr

Or use the following code

net install ivonesamplemr, from("https://raw.github.com/remlapmot/ivonesamplemr/main/") replace
do "https://raw.github.com/remlapmot/ivonesamplemr/main/dependency.do"

Launch the main package helpfile with

help ivonesamplemr

To check for an update to the package run within Stata

adoupdate ivonesamplemr, update

Uninstall the package within Stata using

ado uninstall ivonesamplemr