Fits a radial MR-Egger model using first order, second order, or modified second order weights. Outliers are identified using a significance threshold specified by the user. The function returns an object of class "egger", containing regression estimates, a measure of total heterogeneity using Rucker's Q statistic, the individual contribution to overall heterogeneity of each variant, and a data frame for use in constructing the radial plot.
Arguments
- r_input
A formatted data frame using the
format_radialfunction, or an object of classMRInputgenerated byMendelianRandomization::mr_inputor a data.frame for a single exposure-outcome pair generated byTwoSampleMR::harmonise_data.- alpha
A value specifying the statistical significance threshold for identifying outliers (
0.05specifies a p-value threshold of 0.05).- weights
A value specifying the inverse variance weights used to calculate the MR-Egger estimate and Rucker's Q statistic. By default modified second order weights are used, but one can choose to select first order (
1), second order (2) or modified second order weights (3).- summary
A logical argument (
TRUEorFALSE) indicating whether a summary of results and heterogeneity should be presented (default=TRUE).
Value
An object of class "egger" containing the following components:
coefA matrix giving the intercept and slope coefficient, corresponding standard errors, t-statistics, and (two-sided) p-values.
qstatisticRucker's Q statistic for overall heterogeneity.
dfDegrees of freedom. This is equal to the number of variants -2 when fitting the radial MR-Egger model.
outliersA data frame containing variants identified as outliers, with respective Q statistics, chi-squared tests and SNP identification.
dataA data frame containing containing SNP IDs, inverse variance weights, the product of the inverse variance weight and ratio estimate for each variant, contribution to overall heterogeneity with corresponding p-value, and a factor indicator showing outlier status.
confintA vector giving lower and upper confidence limits for the radial MR-Egger effect estimate.
References
Bowden, J., et al., Improving the visualization, interpretation and analysis of two-sample summary data Mendelian randomization via the Radial plot and Radial regression. International Journal of Epidemiology, 2018. 47(4): p. 1264-1278.
Examples
# Example using format_radial data
ldl.dat <- data_radial[data_radial[,10]<5e-8,]
ldl.fdat <- format_radial(ldl.dat[,6], ldl.dat[,9],
ldl.dat[,15], ldl.dat[,21],
ldl.dat[,1])
egger_radial(ldl.fdat, 0.05, 1, TRUE)
#>
#> Radial MR-Egger
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) -0.4303552 0.3244151 -1.326557 1.884296e-01
#> Wj 0.6129126 0.1109369 5.524877 3.988423e-07
#>
#> Residual standard error: 1.537 on 80 degrees of freedom
#>
#> F-statistic: 30.52 on 1 and 80 DF, p-value: 3.99e-07
#> Q-Statistic for heterogeneity: 188.9285 on 80 DF , p-value: 8.445607e-11
#>
#> Outliers detected
#>
# Example using TwoSampleMR format data
if (FALSE) { # \dontrun{
if (require("TwoSampleMR", quietly = TRUE)) {
# Example with one exposure-outcome pair
bmi_exp_dat <- TwoSampleMR::extract_instruments(outcomes = 'ieu-a-2')
chd_out_dat <- TwoSampleMR::extract_outcome_data(
snps = bmi_exp_dat$SNP,
outcomes = 'ieu-a-7')
tsmrdat <- TwoSampleMR::harmonise_data(exposure_dat = bmi_exp_dat,
outcome_dat = chd_out_dat)
egger_radial(r_input = tsmrdat, alpha = 0.05,
weights = 1, summary = TRUE)
}
} # }
# Example using MendelianRandomization format data
if (require("MendelianRandomization", quietly = TRUE)) {
dat <- data_radial[data_radial[,10] < 5e-8,]
mrdat <- MendelianRandomization::mr_input(bx = dat$ldlcbeta,
bxse = dat$ldlcse,
by = dat$chdbeta,
byse = dat$chdse,
snps = dat$rsid)
egger_radial(r_input = mrdat, alpha = 0.05,
weights = 1, summary = TRUE)
}
#>
#> Radial MR-Egger
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) -0.4303552 0.3244151 -1.326557 1.884296e-01
#> Wj 0.6129126 0.1109369 5.524877 3.988423e-07
#>
#> Residual standard error: 1.537 on 80 degrees of freedom
#>
#> F-statistic: 30.52 on 1 and 80 DF, p-value: 3.99e-07
#> Q-Statistic for heterogeneity: 188.9285 on 80 DF , p-value: 8.445607e-11
#>
#> Outliers detected
#>