mixIE_MA_DP: mixIE-MA with data perturbation (mixIE-MA-DP)

View source: R/mixIE_MA_DP.R

mixIE_MA_DPR Documentation

mixIE-MA with data perturbation (mixIE-MA-DP)

Description

This is the main function of mixIE-MA method with data perturbation.

Usage

mixIE_MA_DP(
  b_exp,
  b_out,
  se_exp,
  se_out,
  n,
  flip = 1,
  B = 200,
  thres_e = Inf,
  diagnostic_plot = FALSE,
  point_size = 1,
  ...
)

Arguments

b_exp

A vector of SNP effects on the exposure variable, usually obtained from a GWAS.

b_out

A vector of SNP effects on the outcome variable, usually obtained from a GWAS.

se_exp

A vector of standard errors of b_exp.

se_out

A vector of standard errors of b_out.

n

Sample size of either one of the GWAS dataset.

flip

Whether to reorient the SNPs like Egger regression?

B

Number of data perturbation, default is 200.

thres_e

Could ignore this.

diagnostic_plot

Should the function returns diagnostic plots? Default is FALSE

point_size

The size of points in the IV scatter plot.

...

Arguments to be passed to mixIE_MA

Value

A list

mixIE_MA_theta

Estimated causal effect from mixIE-MA

mixIE_MA_se

Estimate standard error for mixIE_MA_theta

mixIE_MA_pval

Two-sided p-value of mixIE_MA_theta

mixIE_MA_pi

Estimated proportion of invalid IVs from mixIE-MA

mixIE_MA_tau

A vector of (averaged) posterior probabilities of each IVs being invalid from mixIE-MA

mixIE_MA_DP_theta

Estimated causal effect from mixIE-MA-DP

mixIE_MA_DP_se

Estimate standard error for mixIE_MA_DP_theta

mixIE_MA_DP_pval

Two-sided p-value of mixIE_MA_DP_theta

mixIE_MA_DP_pi

Estimated proportion of invalid IVs from mixIE-MA-DP

mixIE_MA_DP_tau

A vector of posterior probabilities of each IVs being invalid from mixIE-MA-DP

Examples

set.seed(1)
result = mixIE_MA_DP(b_exp=FG_T2D$beta_hat_1,
                     b_out=FG_T2D$beta_hat_2,
                     se_exp=FG_T2D$seb1,
                     se_out = FG_T2D$seb2,
                     flip=1,
                     n=69033)
result

## Diagnostic plot
set.seed(1)
result = mixIE_MA_DP(b_exp=FG_T2D$beta_hat_1,
                     b_out=FG_T2D$beta_hat_2,
                     se_exp=FG_T2D$seb1,
                     se_out = FG_T2D$seb2,
                     flip=1,
                     n=69033,diagnostic_plot=TRUE)

## Compare IVs' posterior probability from mixIE-MA and mixIE-MA-DP
result$iv_barplot

## Histogram of estimates from data perturbation
result$est_hist

## GWAS scatter plot (red points are valid IVs, blue points are invalid IVs)
result$scatter_og.plot # mixIE-MA
result$scatter_dp.plot # mixIE-MA-DP


ZhaotongL/mixIE documentation built on April 14, 2023, 4:20 p.m.