Title


mreggerplot -- Scatter plot for MR-Egger type models

Syntax

mreggerplot varname_gd varname_gdse varname_gp varname_gpse [if] [in] [, options]

options Description ---------------------------------------------------------------------------------------------- egger MR-Egger estimator for fitted line ellipses marker confidence intervals as ellipses errorbars marker confidence intervals as capped lines fe fixed effect standard errors for fitted line gpci CIs around G-P associations ivw IVW line (default is MR-Egger) legend(string) legend options level(#) set confidence level; default is level(95) linetop draw fitted line (and CI) on top of points mleglabel(string) Label for data points in legend; default is Instruments median median estimator for fitted line mlabel(string) variable containing marker labels nolci do not plot confidence interval around fitted line noline do not plot fitted line nomcis do not plot confidence intervals around markers penweighted penalized weighted estimator re random effect estimator for fitted line recons random intercept for fitted line reslope random slope for fitted line reps(#) number of bootstrap replications to obtain standard error seed(#) seed for random number generator for bootstrapping to obtain standard error weighted weighted median estimator wmarkers weighted markers * Other options passed to the twoway plot

Description

mreggerplot plots a scatter plot for MR-Egger type models

varname_gd is a variable containing the genotype-disease (SNP-outcome) association estimates.

varname_gdse is a variable containing the genotype-disease (SNP-outcome) association estimate standard errors.

varname_gp is a variable containing the genotype-phenotype (SNP-exposure) association estimates.

varname_gpse is a variable containing the genotype-phenotype (SNP-exposure) association estimate standard errors.

Note that in Stata 18.0 the default legend position of a twoway plot was changed from the 6 o'clock position to the 3 o'clock position. In Stata 18.0 and above mreggerplot resets the default back to 6 o'clock (which can be overridden with, for example, legend(pos(12))).

Examples

Using the data provided by Do et al. (2013) recreate Bowden et al. (2016), Figure 4, LDL-c "All genetic variants" (plot in row 2, column 1).

Setup . use https://raw.github.com/remlapmot/mrrobust/master/dodata, clear

Select observations (p-value with exposure < 10^-8) . gen byte sel1 = (ldlcp2 < 1e-8)

Scatter plot of MR-Egger model . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1

Scatter plot of MR-Egger model labelling outlying genotypes . gen mlabvar = rsid if abs(ldlcbeta) > .3 . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1, mlab(mlabvar) mlabsize(vsmall) mlabp(7) mlabc(gs0)

Scatter plot of MR-Egger model with genotype-phenotype CIs . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1, gpci

Scatter plot of MR-Egger model specifying own titles and legend label . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1, title(Investigating pleiotropy: MR-Egger model fit) xtitle(Genotype-LDLC associations) ytitle(Genotype-CHD associations) mleglabel(Genotypes)

Scatter plot of IVW model . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1, ivw

Scatter plot of unweighted median model . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1, median

Scatter plot of MR-Egger model using ellipses around points . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1, ellipses

Scatter plot of MR-Egger model adding an IVW line (with legend entry) for comparison . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1 . mregger chdbeta ldlcbeta [aw=1/(chdse^2)] if sel1==1, ivw . addplot : function _b[ldlcbeta]*x if sel1==1, range(0 0.5) lc(gs0) lp(longdash) lw(vthin) legend(order(5 "Instruments" 4 "95% CIs" 3 "MR-Egger" 2 "MR-Egger 95% CI" 6 "IVW") rows(1) size(vsmall))

Scatter plot of MR-Egger model adding weighted median and modal lines (with legend entries) for comparison . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1 . mrmedian chdbeta chdse ldlcbeta ldlcse if sel1==1, weighted . addplot : function _b[beta]*x if sel1==1, range(0 0.5) lc(gs0) lp(shortdash) lw(vthin) . mrmodal chdbeta chdse ldlcbeta ldlcse if sel1==1, phi(.25) . addplot : function _b[beta]*x if sel1==1, range(0 0.5) lc(gs0) lp(longdash) legend(order(5 "Instruments" 4 "95% CIs" 3 "MR-Egger" 2 "MR-Egger 95% CI" 6 "Weighted median" 7 "Modal") rows(1) si(vsmall) symx(*.5))

Scatter plot without any fitted lines . mreggerplot chdbeta chdse ldlcbeta ldlcse if sel1==1, ivw noline nolci gpci legend(order(4 "Instruments" 3 "95% CI") size(vsmall) rows(1))

References

Bowden J, Davey Smith G, Haycock PC, Burgess S. Consistent estimation in Mendelian randomization with some invalid instruments using a weighted median estimator. Genetic Epidemiology, 2016, 40, 4, 304-314. DOI

Do et al.Common variants associated with plasma triglycerides and risk for coronary artery disease. Nature Genetics, 2013, 45, 1345-1352. DOI

Author

INCLUDE help mrrobust-author