Skip to contents

Fits a radial inverse variance weighted (IVW) model using a range of weighting specifications. Outliers are determined with respect to their contribution to global heterogeneity, quantified by Cochran's Q-statistic, using a significance threshold specified by the user. The ivw_radial function returns an object of class "IVW", containing effect estimates, total estimated heterogeneity using Cochran's Q-statistic, the individual contribution to overall heterogeneity of each variant, and a data frame for used in the downstream plotting functions plot_radial and plotly_radial.

Usage

ivw_radial(r_input, alpha, weights, tol, summary)

Arguments

r_input

A formatted data frame using the format_radial function, or an object of class MRInput generated by MendelianRandomization::mr_input or a data.frame for a single exposure-outcome pair generated by TwoSampleMR::harmonise_data.

alpha

A value specifying the statistical significance threshold for identifying outliers (0.05 specifies a p-value threshold of 0.05).

weights

A value specifying the inverse variance weights used to calculate IVW estimate and Cochran'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).

tol

A value indicating the tolerance threshold for performing the iterative IVW approach. The value represents the minimum difference between the coefficients of the previous and current iterations required for a further iteration to be performed (default= 0.0001).

summary

A logical argument (TRUE or FALSE) indicating whether a summary of results and heterogeneity should be presented (default= TRUE).

Value

An object of class "IVW" containing the following components:

coef

The estimated coefficient, its standard error, t-statistic and corresponding (two-sided) p-value.

qstatistic

Cochran's Q statistic for overall heterogeneity.

df

Degrees of freedom. This is equal to the number of variants -1 when fitting the radial IVW model.

outliers

A data frame containing variants identified as outliers, with respective Q statistics, chi-squared tests and SNP identification.

data

A 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.

confint

A vector giving lower and upper confidence limits for the radial IVW effect estimate.

it.coef

The estimated iterative coefficient, its standard error, t-statistic and corresponding (two-sided) p-value.

it.confint

A vector giving lower and upper confidence limits for the iterative radial IVW effect estimate.

fe.coef

The estimated fixed effect exact coefficient, its standard error, t-statistic and corresponding (two-sided) p-value.

fe.confint

A vector giving lower and upper confidence limits for the fixed effect exact radial IVW effect estimate.

re.coef

The estimated random effect exact coefficient, its standard error, t-statistic and corresponding (two-sided) p-value.

re.confint

A vector giving lower and upper confidence limits for the random effect exact radial IVW effect estimate.

mf

The mean F statistic for the set of genetic variants, indicative of instrument strength.

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.

Author

Wes Spiller; Jack Bowden; Tom Palmer.

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])
ivw_radial(ldl.fdat, 0.05, 1, 0.0001, TRUE)
#> 
#> Radial IVW
#> 
#>               Estimate  Std.Error   t value     Pr(>|t|)
#> Effect (1st) 0.4874900 0.05830409  8.361163 6.210273e-17
#> Iterative    0.4873205 0.05827885  8.361874 6.172955e-17
#> Exact (FE)   0.4958973 0.03804168 13.035630 7.673061e-39
#> Exact (RE)   0.4910400 0.05490461  8.943512 1.025846e-13
#> 
#> 
#> Residual standard error: 1.544 on 81 degrees of freedom
#> 
#> F-statistic: 69.91 on 1 and 81 DF, p-value: 1.46e-12
#> Q-Statistic for heterogeneity: 193.0843 on 81 DF , p-value: 3.827332e-11
#> 
#>  Outliers detected 
#> Number of iterations = 3

# Example using TwoSampleMR format data
if (FALSE) {
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)
ivw_radial(r_input = tsmrdat, alpha = 0.05,
           weights = 1, tol = 0.0001, 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)
ivw_radial(r_input = mrdat, alpha = 0.05,
           weights = 1, tol = 0.0001, summary = TRUE)
}
#> 
#> Radial IVW
#> 
#>               Estimate  Std.Error   t value     Pr(>|t|)
#> Effect (1st) 0.4874900 0.05830409  8.361163 6.210273e-17
#> Iterative    0.4873205 0.05827885  8.361874 6.172955e-17
#> Exact (FE)   0.4958973 0.03804168 13.035630 7.673061e-39
#> Exact (RE)   0.4910400 0.05642800  8.702064 3.086420e-13
#> 
#> 
#> Residual standard error: 1.544 on 81 degrees of freedom
#> 
#> F-statistic: 69.91 on 1 and 81 DF, p-value: 1.46e-12
#> Q-Statistic for heterogeneity: 193.0843 on 81 DF , p-value: 3.827332e-11
#> 
#>  Outliers detected 
#> Number of iterations = 3