exp_quantile: exp_quantile

Description Usage Arguments Details Value Author(s) Examples

View source: R/cFDR.R

Description

Transform principal p-values for estimating cFDR in a shared control design. Computes the 'expected quantile' of a p value.

Usage

1
2
exp_quantile(p, pc, rho, method = 1, pi0 = 0.5, sigma = 1,
  dist = rbind((1:10)/10, dnorm((1:10)/10, sd = 3)))

Arguments

p

Observed p value or set of p values for principal phenotype

pc

Observed p value or set of p values for conditional phenotype. Must be of the same length as p.

rho

Correlation between z values induced by shared controls

method

Set to 1 to assume Z scores for the conditional phenotype follow a mixed distribution characterised by pi0, sigma; 2 to specify assume they follow empirical distribution characterised by dist.

pi0

Relevant only if method = 1. Parameter for distribution of Z scores for the conditional phenotype (proportion of SNPs null for conditional phenotype).

sigma

Relevant only if method = 1. Parameter for distribution of Z scores for the conditional phenotype (variance of true effect sizes for SNPs non-null for conditional phenotype).

dist

Relevant only if method = 2. Matrix with two rows; first is a list of potential values for Z scores for conditional phenotype, second is a list of probabilities associated with those values.

Details

Computes the probability that a p value at some SNP for a phenotype i is less than some cutoff p_i given that the p value at that SNP for a second phenotype j is less than a cutoff p_j, under the null hypothesis that the SNP is not associated with phenotype i.

If the GWAS for phenotypes i and j share a number of controls, effect sizes for the two phenotypes will be correlated, even at null SNPs. This leads to dependence of the expected quantile both on the number of shared controls and study sizes (through paramter rho), and the distribution of Z values for phenotype j across all SNPs, not all of which will necessarily be null for phenotype j.

The distribution of Z scores for phenotype j can be specified in two ways, depending on the parameter method. In the first case, we assume that the distribution of 'true' Z scores (Z scores which we would observe if the observed allele frequencies exactly matched the population allele frequencies) has a mixture distribution of 0 with probability pi0, and N(0,sigma^2) with probability 1-pi0. These parameters can be estimated from an observed distribution of Z scores using the function fit.em .

In the second case, the distribution of true Z scores can be specified as an array of Z scores and corresponding probabilities (or PDF heights).

Value

A list of transformed p values (expected quantiles) of the same length as p.

Author(s)

James Liley

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
p <- 0.2; pc <- 0.1;
rho <- 0.25
sigma <- 5; pi0 <- 0.95
exp_quantile(p,pc,rho,method=1,pi0=pi0,sigma=sigma)
# Generally the expected quantile is close to p. In this case, the SNP is 'probably' null for phenotype j, so the MAF in controls is somewhat aberrant from expected (as pc<0.1). This means that the expected quantile is higher than the p value.

p<-0.2; pc <-1e-8;
exp_quantile(p,pc,rho,method=1,pi0=pi0,sigma=sigma)
# If a low value of pc is observed, it is 'likely' to have arisen from a non-null SNP for phenotype j. This p value is quite reasonable for a non-null SNP, given the distribution of z values for such SNPs (sigma=5), so the aberration from expected MAF amongst controls is minimal.

pi0=1
exp_quantile(p,pc,rho,method=1,pi0=pi0,sigma=sigma)
# If, on the other hand, pi0=1 (no non-null SNPs for phenotype j), and we happen to observe a p value of 1e-8 for the conditional phenotype, we conclude that MAF in controls is likely to be very aberrant from expected, so the expected quantile is markedly higher than the p value.

rho <- 0
exp_quantile(p,pc,rho,method=1,pi0=pi0,sigma=sigma)
# If rho=0 (no shared controls) z values for the two phenotypes are independent, and the expected quantile equals parameter p.

p3 = rbind((-500:500)/20, dnorm((-500:500)/20,sd=3))
exp_quantile(5e-4,5e-3,0.3,method=2,pi0=0.9,dist=p3)
exp_quantile(5e-4,5e-3,0.3,method=1,pi0=0.9,sigma=3)
# Demonstrates specification of an empirical distribution for Z scores for the conditional phenotype.

jamesliley/cFDR-common-controls documentation built on May 18, 2019, 11:21 a.m.