mrrobust: a stata package for mr-egger regression type ... · tom palmer wesley spiller neil...

28
mrrobust : a Stata package for MR-Egger regression type analyses London Stata User Group Meeting 2017 8 th September 2017 Tom Palmer Wesley Spiller Neil Davies

Upload: others

Post on 30-Mar-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

mrrobust: a Stata package for MR-Egger regression type analysesLondon Stata User Group Meeting 2017

8th September 2017Tom Palmer Wesley Spiller Neil Davies

Page 2: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Outline

• Introduction• GitHub and installation• Worked example• Stata wishes• Discussion

2 / 28

Page 3: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Introduction

• Mendelian randomization: instrumental variable analysisusing genotypes as instruments in epidemiology (DaveySmith, 2003)

• Researchers do still work on individual level data (ivreg2)• However so much summary data now available from GWAS

that researchers mainly fitting summary data estimators (IVW,MR-Egger, median, modal)

• This package implements several of these methods.• R packages:

• MendelianRandomization package (Yavorska & Burgess,2017)

• TwoSampleMR package, companion to MR-Basehttps://mrcieu.github.io/TwoSampleMR

http://www.mrbase.org

3 / 28

Page 4: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

GitHub repositoryhttps://github.com/remlapmot/mrrobust

• parallel package• Based on git (Linus

Torvalds)• GitHub – excellent for

projects with a small no.collaborators

• master branch; make newfeature in a new branch -merge into master whenready

• To help someone else: forkrepo - new feature in newbranch - send pull request

4 / 28

Page 5: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

GitHub README.md

• Every repo has aREADME.md - can do alotwith this

• I include installationinstructions and link to ashort video

5 / 28

Page 6: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Installation: from GitHub

• First install dependencies (thanks to Ben Jann for 3 of these):. ssc install addplot

. ssc install moremata

. ssc install heterogi

. ssc install kdens

. ssc install metan

• In Stata version 13 and above:. net install mrrobust, from(https://raw.github.com/remlapmot/mrrobust/master/)

• Obtain updates with:. adoupdate mrrobust, update

• In Stata version 12 and below (down to version 9) – installmanually from zip archive of repository – save files in currentworking directory or on adopath.

6 / 28

Page 7: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

help mrrobust

7 / 28

Page 8: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Two Sample MR

• With a single instrument IV estimator is:

β =instrument-outcome associationinstrument-exposure association

• Can obtain such associations from published GWAS• GWAS results also now available from online databases such

as MR-Base• Two-sample Mendelian randomization• Single genotype:

β =genotype-diseasesample 1

genotype-phenotypesample 2

8 / 28

Page 9: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Worked example

• Using data from Do et al., Nat Gen, 2013 and analysis inBowden, Gen Epi, 2016

• Estimate effect of:• Exposure: LDL cholesterol (mean differences) on• Outcome: risk of coronary heart disease (log odds ratios)

-.2-.1

0.1

.2ch

dbet

a

-.6 -.4 -.2 0 .2ldlcbeta

9 / 28

Page 10: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Genotype-specific IV estimatesmrforest ... Genotypes

rs1169288rs17345563rs10790162rs579459rs10832962rs2980885rs1564348rs2247056rs1010167rs688rs2954022rs10401969rs11220462rs2297374rs4722551rs8176720rs3780181rs2288002rs6544713rs868943rs2710642rs217386rs9875338rs17508045rs2000999rs6511720rs4148218rs646776rs2642438rs7225700rs1883025rs515135rs6882076rs6065311rs7703051rs6016381rs2073547rs1800562rs314253rs1998013rs10102164rs10903129rs9989419rs6603981rs4240624rs1367117rs364585rs7254892rs174532rs6859rs267733rs1535rs492602rs4942486rs2587534rs2294261rs5763662rs2326077rs2328223rs12670798rs2255141rs2737252rs4530754rs16831243rs7832643rs2287623rs4587594rs1800961rs8017377rs903319rs1250229rs6489818rs653178

SummaryIVWMR-EggerMedianModal

1.84 (0.98, 2.71)1.83 (0.51, 3.16)1.71 (0.94, 2.48)1.46 (0.89, 2.03)1.38 (0.36, 2.39)1.32 (0.18, 2.46)1.27 (0.45, 2.09)1.20 (-0.10, 2.50)1.12 (-0.41, 2.65)1.04 (0.51, 1.57)1.02 (0.50, 1.53)0.92 (0.42, 1.41)0.90 (0.15, 1.64)0.88 (-0.05, 1.81)0.85 (-0.55, 2.24)0.82 (-0.05, 1.69)0.78 (-0.39, 1.94)0.76 (-0.19, 1.71)0.75 (0.35, 1.16)0.73 (-0.33, 1.79)0.71 (-0.54, 1.96)0.69 (-0.11, 1.50)0.67 (-0.39, 1.72)0.65 (-0.38, 1.69)0.62 (0.05, 1.18)0.59 (0.28, 0.90)0.59 (-0.38, 1.56)0.59 (0.37, 0.80)0.57 (-0.35, 1.49)0.50 (-0.51, 1.51)0.47 (-0.65, 1.58)0.46 (0.19, 0.73)0.46 (-0.17, 1.08)0.45 (-0.20, 1.10)0.45 (0.07, 0.84)0.44 (-0.35, 1.24)0.43 (-0.64, 1.50)0.42 (-0.52, 1.36)0.42 (-0.77, 1.61)0.39 (-0.10, 0.89)0.38 (-0.65, 1.40)0.36 (-0.45, 1.18)0.36 (-1.02, 1.73)0.35 (-0.63, 1.34)0.31 (-0.42, 1.05)0.29 (0.04, 0.54)0.29 (-0.82, 1.40)0.29 (-0.04, 0.62)0.28 (-1.00, 1.55)0.23 (-0.25, 0.70)0.08 (-1.19, 1.36)0.04 (-0.52, 0.60)0.03 (-1.04, 1.11)0.00 (-1.60, 1.60)-0.02 (-0.66, 0.62)-0.12 (-1.05, 0.82)-0.13 (-1.43, 1.18)-0.16 (-1.02, 0.69)-0.18 (-2.01, 1.66)-0.22 (-1.19, 0.75)-0.25 (-1.29, 0.78)-0.25 (-1.24, 0.73)-0.27 (-1.24, 0.71)-0.32 (-1.44, 0.81)-0.32 (-1.15, 0.50)-0.33 (-1.58, 0.91)-0.35 (-0.95, 0.26)-0.43 (-1.68, 0.81)-0.60 (-1.89, 0.69)-1.15 (-2.33, 0.04)-1.42 (-3.01, 0.17)-1.96 (-3.36, -0.57)-3.35 (-5.11, -1.59)

0.48 (0.41, 0.56)0.62 (0.41, 0.82)0.43 (0.28, 0.57)0.49 (0.23, 0.75)

Estimate (95% CI)

1.84 (0.98, 2.71)1.83 (0.51, 3.16)1.71 (0.94, 2.48)1.46 (0.89, 2.03)1.38 (0.36, 2.39)1.32 (0.18, 2.46)1.27 (0.45, 2.09)1.20 (-0.10, 2.50)1.12 (-0.41, 2.65)1.04 (0.51, 1.57)1.02 (0.50, 1.53)0.92 (0.42, 1.41)0.90 (0.15, 1.64)0.88 (-0.05, 1.81)0.85 (-0.55, 2.24)0.82 (-0.05, 1.69)0.78 (-0.39, 1.94)0.76 (-0.19, 1.71)0.75 (0.35, 1.16)0.73 (-0.33, 1.79)0.71 (-0.54, 1.96)0.69 (-0.11, 1.50)0.67 (-0.39, 1.72)0.65 (-0.38, 1.69)0.62 (0.05, 1.18)0.59 (0.28, 0.90)0.59 (-0.38, 1.56)0.59 (0.37, 0.80)0.57 (-0.35, 1.49)0.50 (-0.51, 1.51)0.47 (-0.65, 1.58)0.46 (0.19, 0.73)0.46 (-0.17, 1.08)0.45 (-0.20, 1.10)0.45 (0.07, 0.84)0.44 (-0.35, 1.24)0.43 (-0.64, 1.50)0.42 (-0.52, 1.36)0.42 (-0.77, 1.61)0.39 (-0.10, 0.89)0.38 (-0.65, 1.40)0.36 (-0.45, 1.18)0.36 (-1.02, 1.73)0.35 (-0.63, 1.34)0.31 (-0.42, 1.05)0.29 (0.04, 0.54)0.29 (-0.82, 1.40)0.29 (-0.04, 0.62)0.28 (-1.00, 1.55)0.23 (-0.25, 0.70)0.08 (-1.19, 1.36)0.04 (-0.52, 0.60)0.03 (-1.04, 1.11)0.00 (-1.60, 1.60)-0.02 (-0.66, 0.62)-0.12 (-1.05, 0.82)-0.13 (-1.43, 1.18)-0.16 (-1.02, 0.69)-0.18 (-2.01, 1.66)-0.22 (-1.19, 0.75)-0.25 (-1.29, 0.78)-0.25 (-1.24, 0.73)-0.27 (-1.24, 0.71)-0.32 (-1.44, 0.81)-0.32 (-1.15, 0.50)-0.33 (-1.58, 0.91)-0.35 (-0.95, 0.26)-0.43 (-1.68, 0.81)-0.60 (-1.89, 0.69)-1.15 (-2.33, 0.04)-1.42 (-3.01, 0.17)-1.96 (-3.36, -0.57)-3.35 (-5.11, -1.59)

0.48 (0.41, 0.56)0.62 (0.41, 0.82)0.43 (0.28, 0.57)0.49 (0.23, 0.75)

Estimate (95% CI)

0-2 -1 0 1 2

IGX2=98.5%

10 / 28

Page 11: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Funnel plotmrfunnel chdbeta chdse ldlcbeta ldlcse if sel1==1

02

46

810

Inst

rum

ent s

treng

th (a

bs(γ

j)/σ Y

j)

-4 -2 0 2βIV

• MR-Egger estimate: long dashed line• IVW estimate: dashed line

11 / 28

Page 12: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Inverse variance weighted (IVW) regression:

• Summary data version of TSLS with independent instruments(Angrist & Pischke)

• Notation:• Γ̂j : genotype-disease associations (SEs: σYj )• γ̂i : genotype-phenotype associations (SEs: σXj )

• With L instruments• and instrument specific ratio estimates: β̂j = Γ̂j/γ̂j

β̂IVW =

∑Lj=1 wj β̂j∑L

j=1 wj, wj =

γ̂2j

σ2Yj

• Estimate biased when one or more instruments exhibitdirectional pleiotropy

12 / 28

Page 13: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

IVW estimate

. mregger chdbeta ldlcbeta [aw=1/(chdse^2)] if sel1==1, ivw fe

Number of genotypes = 73

Coef. Std. Err. z P>|z| [95% Conf. Interval]

chdbetaldlcbeta .4815055 .038221 12.60 0.000 .4065938 .5564173

. lincom ldlcbeta, or

( 1) [chdbeta]ldlcbeta = 0

Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]

(1) 1.618509 .061861 12.60 0.000 1.501694 1.744412

13 / 28

Page 14: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

MR-Egger regression

• Proposed by Bowden et al., IJE, 2015 Assumptions:• INstrument Strength Independent of Direct Effect (InSIDE) –

instrument-exposure and pleiotropic association parametersindependent.

• Under InSIDE, estimates for variants with strongerinstrument-exposure associations γ̂j will be closer to the truecausal effect parameter than variants with weakerassociations.

• NO Measurement Error (NOME) – requires no measurementerror to be present in the instrument-exposure associations.This allows the variance in the set of variants J to be estimatedas var(β̂j ) =

σ2Yjγ̂j

.

14 / 28

Page 15: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

MR-Egger regression

Model:

Γ̂j = β0 + β1γ̂j + εj , εj ∼ N(0, σ2) weighted by1σ2

yj

• MR-Egger intercept: average directional pleiotropic effectacross the set of variants

• MR-Egger slope: causal effect estimate corrected forpleiotropy

15 / 28

Page 16: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

MR-Egger estimateWith I2

GX statistic

. mregger chdbeta ldlcbeta [aw=1/(chdse^2)] if sel1==1, tdist gxse(ldlcse)

Number of genotypes = 73

Coef. Std. Err. t P>|t| [95% Conf. Interval]

sign(ldlcbeta)*chdbetaslope .6173131 .1034573 5.97 0.000 .4110251 .8236012_cons -.0087706 .0054812 -1.60 0.114 -.0196998 .0021585

Residual standard error: 1.548I^2_GX statistic: 98.49%

• Additionally specifying fe option would calculate SEs withResidual standard error: 1

16 / 28

Page 17: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Egger regression plotmreggerplot ...

rs1998013 rs7254892

-.10

.1.2

.3.4

Gen

otyp

e-C

HD

ass

ocia

tions

0 .1 .2 .3 .4 .5Genotype-LDLC associations

Genotypes 95% CIs MR-Egger MR-Egger 95% CI

17 / 28

Page 18: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

I2GX statistic

• NOME violated - individual variants suffer from weakinstrument bias – attenuation of MR Egger estimates to thenull.

• Assess NOME assumption with I2GX statistic, Bowden et al.,

IJE, 2016.

QGX =

∑Lj=1(γ̂j − γ̂)2∑L

j=1 σ2Xj

I2GX =

QGX − (L − 1)

QGX=

σ2γ

σ2γ + s2

• I2GX of 0.9 represents an estimated relative bias of 10%

towards the null.18 / 28

Page 19: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Median estimator

• Essentially take the median or weighted median of thegenotype-specific IV estimates

. mrmedian chdbeta chdse ldlcbeta ldlcse if sel1==1, weighted seed(12345)

Number of genotypes = 73Replications = 1000

Coef. Std. Err. z P>|z| [95% Conf. Interval]

beta .4582573 .0624645 7.34 0.000 .3358291 .5806856

19 / 28

Page 20: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Modal estimator

• Hartwig et al., IJE, 2017• Take the instrument specific ratio estimates• Perform kernel density estimation - Normal density• Find the highest point of the estimated density - mode• Sensitive to the bandwidth parameter used in density

estimation

20 / 28

Page 21: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Modal estimator

. mrmodalplot chdbeta chdse ldlcbeta ldlcse if sel1==1

0.5

11.

5D

ensi

ty

-4 -2 0 2 4IV estimates

φ = .25 φ = .5 φ = 1

• Choose value of φ which gives smoothest density, here φ = 1.

21 / 28

Page 22: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Modal estimate

. mrmodal chdbeta chdse ldlcbeta ldlcse if sel1==1, weighted seed(12345) phi(.25)

Number of genotypes = 73Replications = 1000

Phi = .25

Coef. Std. Err. z P>|z| [95% Conf. Interval]

beta .5820001 .1365403 4.26 0.000 .314386 .8496142

. mrmodal chdbeta chdse ldlcbeta ldlcse if sel1==1, weighted seed(12345) phi(1)

Number of genotypes = 73Replications = 1000

Phi = 1

Coef. Std. Err. z P>|z| [95% Conf. Interval]

beta .4789702 .0718135 6.67 0.000 .3382183 .6197221

22 / 28

Page 23: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

MR-Egger SIMEX

• Approach to assessing the NOME assumption in the weightsused in IVW/MR-Egger

. mreggersimex chdbeta ldlcbeta [aw=1/chdse^2] if sel1==1, ///> gxse(ldlcse) seed(12345)(running mreggersimexonce on estimation sample)

Bootstrap replications (25)1 2 3 4 5

.........................

Number of genotypes = 73Bootstrap replications = 25

Simulation replications = 50

Coef. Std. Err. z P>|z| [95% Conf. Interval]

slope .6256194 .1166245 5.36 0.000 .3970396 .8541991_cons -.0089987 .0062257 -1.45 0.148 -.0212009 .0032035

23 / 28

Page 24: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

MR-Egger SIMEX

.59

.6.6

1.6

2.6

3M

R-E

gger

slo

pe

-1 0 1 2λ

-.009

-.008

5-.0

08-.0

075

MR

-Egg

er in

terc

ept

-1 0 1 2λ

SIMEX Original SimulatedQuadratic fit Extrapolation

• λ = 0: original data estimate• λ = −1: estimate from data with “no measurement error”

24 / 28

Page 25: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Stata wishes

• I often push more than 1 update to GitHub per day - wouldhelp me if I could additionally specify time in distribution datein .pkg file, current format is only:d Distribution-Date: yyyymmdd

• MR-Base uses Google authentication so Stata commands forGoogle, Facebook, Microsoft authentication – like R packagegoogleAuthR – would be very helpful

25 / 28

Page 26: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Summary

• mrrobust package• Install from GitHub repo• Esimators: IVW, MR-Egger (I2

GX statistic), Median, Modal• Plots: IV forest plot, Egger regression plot, modal density plot• Testing/validation: I have cscripts for each command – on

GitHub – graph commands much harder and moreinconvenient to test

• To do: many methods - field developing rapidly

26 / 28

Page 27: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Bibliography

• Bowden J, Davey Smith G, Burgess S. Mendelian randomization with invalid instruments: effect estimation andbias detection through Egger regression. International Journal of Epidemiology. 2015, 44, 2, 512–525.

• Bowden J, Davey Smith G, Haycock PC, Burgess S. 2016. Consistent estimation in Mendelian randomizationwith some invalid instruments using a weighted median estimator. Genetic Epidemiology, published online 7 April.

• Bowden J, Del Greco F, Minelli C, Davey Smith G, Sheehan NA, Thompson JR. 2016. Assessing the suitability ofsummary data for two-sample Mendelian randomization analyses using MR-Egger regression: the role of theI-squared statistic. International Journal of Epidemiology.

• Davey Smith G, Ebrahim S. “Mendelian randomization”: can genetic epidemiology contribute to understandingenvironmental determinants of disease. International Journal of Epidemiology. 2003; 32, 1, 1–22

• Do R et al., 2013. Common variants associated with plasma triglycerides and risk for coronary artery disease.Nature Genetics. 45, 13451352. DOI: http://dx.doi.org/10.1038/ng.2795

• Hemani G, Zheng J, Wade KH, et al., Davey Smith G, Gaunt TR, Haycock PC. The MR-Base Collaboration.MR-Base: a platform for systematic causal inference across the phenome using billions of genetic associations.bioRxiv, 2016, doi:10.1101/078972; http://www.mrbase.org/ .

• Yavorska OO & Burgess S. MendelianRandomization: an R package for performing Mendelian randomizationanalyses using summarized data. International Journal of Epidemiology. 2017

• Yavorska O, Burgess S. MendelianRandomization: Mendelian Randomization Package. 2016, version 0.2.0.https://CRAN.R-project.org/package=MendelianRandomization

27 / 28

Page 28: mrrobust: a Stata package for MR-Egger regression type ... · Tom Palmer Wesley Spiller Neil Davies. Outline Introduction GitHub and installation Worked example Stata wishes Discussion

Thank you for your attention.

Any questions?

28 / 28