Title
mrmedian -- Weighted median of instrumental variable estimates
Syntax
mrmedian varname_gd varname_gdse varname_gp varname_gpse [if] [in] [, options]
options Description ---------------------------------------------------------------------------------------------- level(#) set confidence level; default is level(95) penweighted penalized weighted estimator reps(#) number of bootstrap replications to obtain standard error seed(#) seed for random number generator for bootstrapping to obtain standard error weighted weighted estimator
Description
mrmedian performs unweighted, weighted, and penalized median IV estimator on summary level data (i.e. reported genotype-disease [SNP-outcome] and genotype-phenotype [SNP-exposure] association estimates and their standard errors for individual genotypes).
See Bowden et al. (2016) for more information.
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.
Options
level(#); see [R] estimation options.
reps(#) specifies the number of bootstrap replications for obtaining the standard error. The default is 1000 replications.
seed(#) specifies the initial value of the random-number seed. The default is the current random-number seed. Specifying seed(#) is the same as typing set seed # before issuing the command; see set_seed.
weighted use weights.
penweighted use penalized weights.
Examples
Using the data provided by Do et al. (2013) recreate Bowden et al. (2016), Table 4, LDL-c "All genetic variants" median estimates.
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)
Unweighted median estimator . mrmedian chdbeta chdse ldlcbeta ldlcse if sel1==1
Unweighted median estimator with reproducible standard error . mrmedian chdbeta chdse ldlcbeta ldlcse if sel1==1, seed(12345)
Weighted median estimator . mrmedian chdbeta chdse ldlcbeta ldlcse if sel1==1, weighted
Penalized weighted median estimator . mrmedian chdbeta chdse ldlcbeta ldlcse if sel1==1, penweighted
Stored results
mrmedian stores the following in e():
Scalars e(k) number of instruments e(reps) number of (bootstrap) replications
Macros e(cmd) mrmedian e(cmdline) command as typed
Matrices e(b) coefficient vector e(V) variance-covariance matrix of the estimates
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