reverseDirection: reverseDirection

View source: R/reverseDirection.R

reverseDirectionR Documentation

reverseDirection

Description

Runs the MR Steiger approach on simulated data in the presence or absence of pleiotropy, measurment error of the exposure, or unmeasured confounding of the exposure-outcome relationship.

Usage

reverseDirection(nSim = 1000, n = 100, MAF = c(rep(0.5, 10)), gamma0 = 0, gammaG = c(rep(0.2, 5), rep(0.1, 5)), varX = 1, measurementError = F, delta0 = 0, deltaX = 1, varME = 1, beta0 = 0, betaX = seq(from = 0, to = 1, length.out = 4), pleiotropy = F, betaG = c(rep(0.2, 5), rep(0.1, 5)), varY = 0.2, unmeasuredConfounding = F, meanU = 0, varU = 1, gammaU = 1, betaU = 1, sig.level = 0.05, SEED = 1, plot.pdf = T, plot.name = "reverseDirection")

Arguments

nSim

the number of simulations

n

the sample size

MAF

vector of the minor allele frequencies of the SNPs

gamma0

the intercept for the linear association of the SNPs G with the exposure X

gammaG

the vectore of slopes for the linear association of the SNPs G with the exposure X

varX

the variance of the exposure X which is generated from a normal distribution

measurementError

if measurementError=T then the exposure is generated with measurement error

delta0

the intercept for the linear association of the exposure with measurement error

deltaX

the slope for the linear association of the exposure with measurement error

varME

the variance of the exposure X with measurement error which is generated from a normal distribution

beta0

the intercept for the linear association of the exposure X with the outcome Y

betaX

the slope for the linear association of the exposure X with the outcome Y

pleiotropy

if pleiotropy=T then the outcome Y is generated with a direct effect of the SNP G on Y

betaG

the vector of slopes for the linear association of the SNPs G with the outcome Y

varY

the variance of the outcome Y which is generated from a normal distribution

unmeasuredConfounding

if unmeasuredConfounding=T then an unmeasured confounder U of the exposure X- outcome Y relationship is generated from a normal distribution with mean meanU and viarance varU

meanU

mean of the unmeasured confounder U

varU

variance of the unmeasured confounder U

gammaU

the effect of the unmeasured confounder U on the exposure X

betaU

the effect of the unmeasured confounder U on the outcome Y

sig.level

the significance level, default=0.05

SEED

the seed for the random number generator

plot.pdf

if plot.pdf=T then a plot of the percent of simulations where case 1-3 is accepted. If plot.pdf=F then no plot will be created.

plot.name

specifies the name of the plot that is created

Details

This function outputs the percent of simulations where case 1 (X->Y), case 2 (X<-Y), or case 3 (inconclusive) is detected by using the MR Steiger approach. The percent of simulations where the Steiger p-value and MR p-value is less than alpha is given (pSteiger and pMR, respectively). The correlation between the first SNP G1 and the exposure X (corG1X), correlation between the first SNP G1 and the outcome Y (corG1Y) and the correlation between the exposure X and the outcome Y (corXY).

Author(s)

Sharon Lutz

References

Hemani G, Tilling K, Davey Smith G (2017) Orienting the causal relationship between imprecisely measured traits using GWAS summary data. PLOS Genetics 13(11): e1007081.

Examples

reverseDirection(nSim=100)

SharonLutz/reverseDirection documentation built on Jan. 10, 2025, 4:40 a.m.