Package 'PPMR'

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-04 06:24:45 UTC
Source: CRAN

Help Index


Individual level dataset

Description

A simulated individual level dataset for PMR.

Usage

Exampleindividual

Format

A list contains the following objects:

zx

the standardized genotype matrix for 465 individuals and 50 cis-SNPs in eQTL data.

zy

the standardized genotype matrix for 2000 individuals and 50 cis-SNPs in GWAS data.

x

the standarized gene expression vector for 465 individuals in eQL data.

y

the standarized complex trait vector for 2000 individuals in GWAS data.


Summary level dataset

Description

A simulated summary level dataset for PMR

Usage

Examplesummary

Format

A list contains the following objects:

betax

the cis-SNP effect size vector for one specific gene in eQTL data.

betay

the cis-SNP effect size vector for one specific gene in GWAS data.

Sigma1

the LD matrix in eQTL data.

Sigma2

the LD matrix in GWAS data.

n1

the sample size of eQTL data.

n2

the sample size of GWAS data.


PMR model with individual level data

Description

Fit the probabilistic MR model with individual level data while accounting for the correlated instruments and horizontal pleiotropy in TWAS framework.

Usage

PMR_individual(yin, zin, x1in, x2in, gammain, alphain, max_iterin, epsin)

Arguments

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.

Value

a list of estimates of model parameters, including the causal effect alpha, the horizontal pleiotropy effect gamma, and the two corresponding p values

Author(s)

Zhongshang Yuan, Xiang Zhou.

Examples

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)

PMR model with summary data

Description

Fit the probabilistic MR model with summary data while accounting for the correlated instruments and horizontal pleiotropy in TWAS framework.

Usage

PMR_summary(betaxin, betayin, Sigma1sin, Sigma2sin, samplen1, samplen2,
  gammain, alphain, max_iterin, epsin)

Arguments

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 Sigma2sin and sigma1sin are often the same from the reference panel.

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.

Value

A list of estimates of model parameters, including the causal effect alpha, the horizontal pleiotropy effect gamma, and the two corresponding p values.

Author(s)

Zhongshang Yuan, Xiang Zhou.

Examples

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)