rondolab / MR-PRESSO

Performs the Mendelian Randomization Pleiotropy RESidual Sum and Outlier (MR-PRESSO) method.
81 stars 30 forks source link

IVW Estimate from TwoSampleMR #18

Open relgamal opened 2 years ago

relgamal commented 2 years ago

Hello @rondolab ,

I am wondering why the raw MR result p-values from MR-PRESSO vary substantially from the TwoSampleMR package's IVW p-values (causal estimates are very similar). I have read in other threads for MR-PRESSO that the method used for MR in this package is IVW but for some exposures I have p-values that are orders of magnitude different.

Thank you in advance for your help,

Ruth

wusiwei2022 commented 1 year ago

Come across the same issue. The estimates and standard error are similar, which means the t-statistic should be the same. I guess the issue is attribnuted to different ways of calculating degree of freedom.

relgamal commented 1 year ago

@wusiwei2022 Thanks for your comment! Could be degrees of freedom, yes, but a bizarre problem nonetheless given MRPRESSO is built into TwoSampleMR now.

marieverbanck commented 1 year ago

Hi @wusiwei2022 and @relgamal,

thank you for using MR-PRESSO and for mentioning that issue.

You are correct, the causal estimate and se from MR-PRESSO are perfectly similar to those obtained from the standard IVW; however, the p-values may be different between MR-PRESSO and standard IVW especially when the number of IVs is small. The reason for this difference is because MR-PRESSO uses a t-test while standard IVW, as implemented in TwoSampleMR::mr_ivw, uses a Gaussian distribution to compute the P-values.

If resMRPRESSO is your MR-PRESSO result object, you can obtain the same P-value as in TwoSampleMR::mr_ivw, from MR-PRESSO by running: 2 * pnorm(abs(resMRPRESSO$`T-stat`), lower.tail = FALSE)

Hoping this clarifies the issue. Best, Marie

marieverbanck commented 1 year ago

Here is a small example to manually compare the results before/after removing outliers and IVW. Hoping this clarifies the issues.

library(MRPRESSO)
data (SummaryStats)

# MR-PRESSO
testSVMR <- mr_presso(BetaOutcome = "Y_effect", BetaExposure = "E1_effect", SdOutcome = "Y_se", SdExposure = "E1_se", OUTLIERtest = TRUE, DISTORTIONtest = TRUE, data = SummaryStats, NbDistribution = 1000,  SignifThreshold = 0.05, seed = 244)

# IVW with all the IVs
testIVW <- mr_ivw(b_exp = SummaryStats$E1_effect, b_out = SummaryStats$Y_effect, se_exp = SummaryStats$E1_se, se_out = SummaryStats$Y_se, SummaryStats$Y_effect)

# IVW while removing manually the identified outliers from MR-PRESSO
outliers <- testSVMR$`MR-PRESSO results`$`Distortion Test`$`Outliers Indices` # outliers from MR-PRESSO
testIVWnoOut <- mr_ivw(b_exp = SummaryStats$E1_effect[-outliers], b_out = SummaryStats$Y_effect[-outliers], se_exp = SummaryStats$E1_se[-outliers], se_out = SummaryStats$Y_se[-outliers], SummaryStats$Y_effect[-outliers])

# Comparison
resMRPRESSO <- testSVMR$`Main MR results`
resMRPRESSO

    ##    Exposure       MR Analysis Causal Estimate         Sd   T-stat      P-value
    ##   E1_effect               Raw        0.539012 0.01948158 27.66778 1.446937e-31
    ##   E1_effect Outlier-corrected        0.508981 0.01290836 39.43034 1.530911e-36

resIVW <- rbind.data.frame(testIVW, testIVWnoOut)
resIVW

    ##              b        se         pval          nsnp Q        Q_df Q_pval      
    ## testIVW      0.539012 0.01948158 1.705633e-168 50   128.0214 49   5.495832e-09
    ## testIVWnoOut 0.508981 0.01290836 0             46   47.77453 45   0.3606764   

resMRPRESSO$`Causal Estimate` ==  resIVW$
    ## [1] TRUE TRUE
resMRPRESSO$`Sd` ==  resIVW$se
    ## [1] TRUE TRUE

# Please note that MR-PRESSO uses a t-test while standard IVW uses a gaussian distribution.The causal estimates and se from MR-PRESSO are very similar to those obtained from the standard IVW; however, the p-values may be different between MR-PRESSO and standard IVW when the number of IVs are small. You can obtain the p-value from MR-PRESSO by running:
pval <- 2 * pnorm(abs(resMRPRESSO$`T-stat`), lower.tail = FALSE)
pval == resIVW$pval
    ## [1] TRUE TRUE