cfdr: cfdr

Description Usage Arguments Details Author(s) Examples

View source: R/cFDR.R

Description

Compute estimated cFDR values from a set of pairs of p values, or adjusted p-values if controls are shared.

Usage

1
cfdr(P_i, P_j, sub = 1:length(P_i))

Arguments

P_i

vector of p-values for the principal phenotype.

P_j

vector of p-values or adjusted p-values for the conditional phenotype. If controls are shared between GWAS, the p-values must be adjusted using the function exp_quantile.

sub

set of indices; only compute cFDR at this subset of p-value pairs. Typically, only SNPs with low values of P_i or P_j are of interest; it is possible to increase the speed of the procedure by only calculating cFDR at such SNPs.

Details

For a set of p-values or adjusted p values P_i for the principal phenotype, and a set of p values P_j for the conditional phenotype, the cFDR for SNP x is estimated as

est. cFDR(x) = P_i(x) * (# P_j ≤ P_j(x)) / (# P_i ≤ P_i(x) AND P_j ≤ P_j(x))

The procedure can be sped up by specifying a subset of SNPs at which to estimate the cFDR. This is most effective if a boundary of the subset can be written as P_j = f(P_i), where f is non-increasing. Equivalently, if S is the set of all p-value pairs, the subset S' should satisfy the condition

for all (p_i',p_j') in S', (p_i,p_j) in S: p_i ≤ p_i', q_j ≤ p_j => (p_i,p_j) in S'.

An example of such a subset is the set of p_i,p_j with p_i^2 + p_j^2 < α.

The estimated cFDR is a conservative estimate (upper bound) on the quantity

Pr(H0 | P_i<P_i(x),P_j<P_j(x))

where H0 is the null hypothesis at SNP x for the principal phenotype (ie, SNP x is not associated with the principal phenotype)

Author(s)

James Liley

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(mnormt)
P = 2*pnorm(-abs(rmnorm(10000,varcov=diag(c(0.8,0.8))+0.2)))
P_i = P[,1]; P_j=P[,2]
W = which((qnorm(P_i/2)^2) + (qnorm(P_j/2)^2) > 4)

# Using function
C = cfdr(P_i,P_j,sub=W); C[W[1]]

# Explicit computation
P_i[W[1]]/ (length(which (P_i <= P_i[1] & P_j <= P_j[1])) / length(which (P_j <= P_j[1])) )

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