Title: | Probabilistic Two Sample Mendelian Randomization |
---|---|
Description: | Efficient statistical inference of two-sample MR (Mendelian Randomization) analysis. It can account for the correlated instruments and the horizontal pleiotropy, and can provide the accurate estimates of both causal effect and horizontal pleiotropy effect as well as the two corresponding p-values. There are two main functions in the 'PPMR' package. One is PMR_individual() for individual level data, the other is PMR_summary() for summary data. |
Authors: | Zhongshang Yuan [aut], Xiang Zhou [aut], Michael Kleinsasser [cre] |
Maintainer: | Michael Kleinsasser <[email protected]> |
License: | GPL-3 |
Version: | 1.0 |
Built: | 2024-11-23 04:32:20 UTC |
Source: | https://github.com/umich-biostatistics/PPMR |
A simulated individual level dataset for PMR.
Exampleindividual
Exampleindividual
A list contains the following objects:
the standardized genotype matrix for 465 individuals and 50 cis-SNPs in eQTL data.
the standardized genotype matrix for 2000 individuals and 50 cis-SNPs in GWAS data.
the standarized gene expression vector for 465 individuals in eQL data.
the standarized complex trait vector for 2000 individuals in GWAS data.
A simulated summary level dataset for PMR
Examplesummary
Examplesummary
A list contains the following objects:
the cis-SNP effect size vector for one specific gene in eQTL data.
the cis-SNP effect size vector for one specific gene in GWAS data.
the LD matrix in eQTL data.
the LD matrix in GWAS data.
the sample size of eQTL data.
the sample size of GWAS data.
Fit the probabilistic MR model with individual level data while accounting for the correlated instruments and horizontal pleiotropy in TWAS framework.
PMR_individual(yin, zin, x1in, x2in, gammain, alphain, max_iterin, epsin)
PMR_individual(yin, zin, x1in, x2in, gammain, alphain, max_iterin, epsin)
yin |
standardized exposure vector (e.g. gene expression in TWAS). |
zin |
standardized complex trait vector. |
x1in |
standardized cis-genotype matrix in eQTL data. |
x2in |
standardized cis-genotype matrix in GWAS data. |
gammain |
indicator variable for constrained PMR model, with 1 for the null model that there is no horizontal pleiotropy. |
alphain |
indicator variable for constrained PMR model, with 1 for the null model that there is no causal effect. |
max_iterin |
The maximum iteration. |
epsin |
The convergence tolerance of the absolute value of the difference between the nth and (n+1)th log likelihood. |
a list of estimates of model parameters, including the causal effect
alpha
, the horizontal pleiotropy effect gamma
, and the two
corresponding p values
Zhongshang Yuan, Xiang Zhou.
data(Exampleindividual) attach(Exampleindividual) fmH1 = PMR_individual(yin=x, zin=y, x1in=zx, x2in=zy, gammain=0,alphain = 0,max_iterin =1000,epsin=1e-5) alpha<-fmH1$alpha gamma<-fmH1$gamma fmH0gamma = PMR_individual(yin=x,zin= y, x1in=zx, x2in=zy,gammain=1, alphain = 0,max_iterin =1000,epsin=1e-5) fmH0alpha = PMR_individual(yin=x, zin=y, x1in=zx, x2in=zy,gammain=0, alphain = 1,max_iterin =1000, epsin=1e-5) loglikH1=max(fmH1$loglik,na.rm=TRUE) loglikH0gamma=max(fmH0gamma$loglik,na.rm=TRUE) loglikH0alpha=max(fmH0alpha$loglik,na.rm=TRUE) stat_alpha = 2 * (loglikH1 - loglikH0alpha) pvalue_alpha = pchisq(stat_alpha,1,lower.tail=FALSE) stat_gamma = 2 * (loglikH1 - loglikH0gamma) pvalue_gamma = pchisq(stat_gamma,1,lower.tail=FALSE)
data(Exampleindividual) attach(Exampleindividual) fmH1 = PMR_individual(yin=x, zin=y, x1in=zx, x2in=zy, gammain=0,alphain = 0,max_iterin =1000,epsin=1e-5) alpha<-fmH1$alpha gamma<-fmH1$gamma fmH0gamma = PMR_individual(yin=x,zin= y, x1in=zx, x2in=zy,gammain=1, alphain = 0,max_iterin =1000,epsin=1e-5) fmH0alpha = PMR_individual(yin=x, zin=y, x1in=zx, x2in=zy,gammain=0, alphain = 1,max_iterin =1000, epsin=1e-5) loglikH1=max(fmH1$loglik,na.rm=TRUE) loglikH0gamma=max(fmH0gamma$loglik,na.rm=TRUE) loglikH0alpha=max(fmH0alpha$loglik,na.rm=TRUE) stat_alpha = 2 * (loglikH1 - loglikH0alpha) pvalue_alpha = pchisq(stat_alpha,1,lower.tail=FALSE) stat_gamma = 2 * (loglikH1 - loglikH0gamma) pvalue_gamma = pchisq(stat_gamma,1,lower.tail=FALSE)
Fit the probabilistic MR model with summary data while accounting for the correlated instruments and horizontal pleiotropy in TWAS framework.
PMR_summary(betaxin, betayin, Sigma1sin, Sigma2sin, samplen1, samplen2, gammain, alphain, max_iterin, epsin)
PMR_summary(betaxin, betayin, Sigma1sin, Sigma2sin, samplen1, samplen2, gammain, alphain, max_iterin, epsin)
betaxin |
the cis-SNP effect size vector for one specific gene in eQTL data, which must be calculated based on both the standardized gene expression value and the standardized cis-genotype matrix. |
betayin |
the cis-SNP effect size vector for one specific gene in GWAS data, which be calculated based on both the standardized complex trait value and the standardized cis-genotype matrix. |
Sigma1sin |
the LD matrix in eQTL data. |
Sigma2sin |
the LD matrix in GWAS data. Both |
samplen1 |
the sample size of eQTL data. |
samplen2 |
the sample size of GWAS data. |
gammain |
indicator variable for constrained model, with 1 for the null model that there is no horizontal pleiotropy. |
alphain |
indicator variable for constrained model, with 1 for the null model that there is no causal effect. |
max_iterin |
The maximum iteration. |
epsin |
The convergence tolerance of the absolute value of the difference between the nth and (n+1)th log likelihood. |
A list of estimates of model parameters, including the causal effect
alpha
, the horizontal pleiotropy effect gamma
, and the two corresponding p values.
Zhongshang Yuan, Xiang Zhou.
data(Examplesummary) attach(Examplesummary) fmH1=PMR_summary(betaxin=betax,betayin=betay,Sigma1sin=Sigma1,Sigma2sin=Sigma2, samplen1=n1,samplen2=n2,gammain=0,alphain=0,max_iterin =1000, epsin=1e-5) fmH0alpha=PMR_summary(betaxin=betax,betayin=betay,Sigma1sin=Sigma1,Sigma2sin=Sigma2, samplen1=n1,samplen2=n2,gammain=0,alphain=1,max_iterin =1000, epsin=1e-5) fmH0gamma=PMR_summary(betaxin=betax,betayin=betay,Sigma1sin=Sigma1,Sigma2sin=Sigma2, samplen1=n1,samplen2=n2,gammain=1,alphain=0,max_iterin =1000, epsin=1e-5) loglikH1=max(fmH1$loglik,na.rm=TRUE) loglikH0alpha=max(fmH0alpha$loglik,na.rm=TRUE) loglikH0gamma=max(fmH0gamma$loglik,na.rm=TRUE) stat_alpha = 2 * (loglikH1 - loglikH0alpha) pvalue_alpha = pchisq(stat_alpha,1,lower.tail=FALSE) stat_gamma = 2 * (loglikH1 - loglikH0gamma) pvalue_gamma = pchisq(stat_gamma,1,lower.tail=FALSE)
data(Examplesummary) attach(Examplesummary) fmH1=PMR_summary(betaxin=betax,betayin=betay,Sigma1sin=Sigma1,Sigma2sin=Sigma2, samplen1=n1,samplen2=n2,gammain=0,alphain=0,max_iterin =1000, epsin=1e-5) fmH0alpha=PMR_summary(betaxin=betax,betayin=betay,Sigma1sin=Sigma1,Sigma2sin=Sigma2, samplen1=n1,samplen2=n2,gammain=0,alphain=1,max_iterin =1000, epsin=1e-5) fmH0gamma=PMR_summary(betaxin=betax,betayin=betay,Sigma1sin=Sigma1,Sigma2sin=Sigma2, samplen1=n1,samplen2=n2,gammain=1,alphain=0,max_iterin =1000, epsin=1e-5) loglikH1=max(fmH1$loglik,na.rm=TRUE) loglikH0alpha=max(fmH0alpha$loglik,na.rm=TRUE) loglikH0gamma=max(fmH0gamma$loglik,na.rm=TRUE) stat_alpha = 2 * (loglikH1 - loglikH0alpha) pvalue_alpha = pchisq(stat_alpha,1,lower.tail=FALSE) stat_gamma = 2 * (loglikH1 - loglikH0gamma) pvalue_gamma = pchisq(stat_gamma,1,lower.tail=FALSE)