I've applied the commands below to obtain mr_ivw effect estimates, taking into account correlation between SNPs.
MRObject <- dat_to_MRInput(dat, get_correlation=TRUE)
MendelianRandomization::mr_ivw(MRObject[[1]], correl=TRUE)
As it's important that the correlations are in the right direction, with signs of the correlations corresponding to the same effect alleles as the genetic associations, I was wondering whether harmonization is performed automatically (applying the commands above)?
I've compared the results with the following:
1) Create ld matrix within TwoSample MR
2) Apply harmonise_ld_dat function (this function was not working, but I created it myself with the source code from
https://rdrr.io/github/MRCIEU/TwoSampleMR/src/R/other_formats.R
3) Get mr_ivw with function in MendelianRandomization package and using the harmonised dataset from step 2:
mr_ivw(mr_input(bx=Input$beta.exposure,bxse=Input$se.exposure,by=Input$beta.outcome,byse=Input$se.outcome,corr=Harmonised_ld_matrix))
The same results were obtained, as same LD matrix.
Is it correct to assume that the MRObject already contains harmonised LD matrix?
I've applied the commands below to obtain mr_ivw effect estimates, taking into account correlation between SNPs. MRObject <- dat_to_MRInput(dat, get_correlation=TRUE) MendelianRandomization::mr_ivw(MRObject[[1]], correl=TRUE)
As it's important that the correlations are in the right direction, with signs of the correlations corresponding to the same effect alleles as the genetic associations, I was wondering whether harmonization is performed automatically (applying the commands above)?
I've compared the results with the following: 1) Create ld matrix within TwoSample MR 2) Apply harmonise_ld_dat function (this function was not working, but I created it myself with the source code from https://rdrr.io/github/MRCIEU/TwoSampleMR/src/R/other_formats.R 3) Get mr_ivw with function in MendelianRandomization package and using the harmonised dataset from step 2: mr_ivw(mr_input(bx=Input$beta.exposure,bxse=Input$se.exposure,by=Input$beta.outcome,byse=Input$se.outcome,corr=Harmonised_ld_matrix))
The same results were obtained, as same LD matrix. Is it correct to assume that the MRObject already contains harmonised LD matrix?