PharmIV

This respository supplies the tools necessary to calculate the power of an instrumental variable analysis study using a single binary instrument Z to analyse the causal effect of a binary exposure X on a continuous outcome Y in the context of pharmacoepidemiology. If you use this material, please cite:

Venexia M Walker, Neil M Davies, Frank Windmeijer, Stephen Burgess, Richard M Martin; Power calculator for instrumental variable analysis in pharmacoepidemiology. Int J Epidemiol 2017 dyx090. doi: 10.1093/ije/dyx090

R package

This folder contains the R package to calculate the power of an instrumental variable analysis study using a single binary instrument Z to analyse the causal effect of a binary exposure X on a continuous outcome Y. The syntax for this package is as follows:

PharmIV(n = NULL, delta = NULL, alpha = 0.05, sigma = 1.00, prob_x1 = NULL, prob_z1 = NULL, cond_z1 = NULL, cond_z0 = NULL)

Shiny code

This folder contains the code to produce the power calculator shiny app. The app is avaliable here.

Stata package

This folder contains the Stata package to calculate the power of an instrumental variable analysis study using a single binary instrument Z to analyse the causal effect of a binary exposure X on a continuous outcome Y. The syntax for this package is as follows:

PharmIV, n(numlist) delta(numlist) alpha(numlist) sigma(numlist) prob_x1(numlist) prob_z1(numlist) cond_z1(numlist) cond_z0(numlist) 

Stata code for paper

This folder contains the code to reproduce the paper “Power calculator for instrumental variable analysis in pharmacoepidemiology”. The paper is avaliable here.

Funding statement

This work was supported by the Perros Trust and the Integrative Epidemiology Unit. The Integrative Epidemiology Unit is supported by the Medical Research Council and the University of Bristol [grant number MC_UU_12013/9]. SB is supported by a Sir Henry Dale Fellowship jointly funded by the Wellcome Trust and the Royal Society (Grant Number 204623/Z/16/Z).