cfdr: cfdr

Description Usage Arguments Details Value Author(s) Examples

View source: R/single_snps.R

Description

###### Part of this description will go in the description for X4 and part of it in the description

Usage

1
cfdr(Z, sub = which(Z[, 1]^2 + Z[, 2]^2 > 6))

Arguments

Z

an n x 2 vector of Z scores. Z_i is Z[,1], Z_j is Z[,2]

sub

optional parameter; only compute cFDR at this subset of values.

Details

Compute the conditional false discovery rate (cFDR) at a set of paired Z scores.

Given two positively-valued random variables Z_i and Z_j, for which the distribution of Z_j is known and we have a hypothesis H on the distribution of Z_i, we define functions F_i and F_j as F_i(z_i)=Pr(Z_i>z_i|H), F_j(z_j)=Pr(Z_j>z_j) and set P_i, P_j as the random variables F_i(Z_i), F_j(Z_j) (these are analagous to p-values). For two observations z_i and z_j with p_i=F_i(z_i), p_j=F_j(z_j) we then define the conditional false discovery rate, or cFDR, as

cFDR(p_i|p_j)=Pr(H|P_i<p_i,P_j<p_j)

If P_i and P_j are independent under H, then the cFDR can be conservatively estimated as

cFDR = Pr(H) Pr(P_i<p_i|P_j<p_j,H)/Pr(P_i<p_i|P_j<p_j) < p_i*ordp_j*|p_j*<p_j/ord(p_i*,p_j*)|(p_i*<p_i,p_j*<p_j)

that is, p_i divided by the proportion of observed (p_i*,p_j*) with p_j* less than p_j which also satisfy p_i*<p_i

This is a useful way to capture pleiotropy between phenotypes. In our case, if H is the hypothesis that Z_d~N(0,1), then Z_a and Z_d are independent.

Note that the procedure of declaring non-null all SNPs with cFDR < alpha does not limit the false discovery rate of such SNPs to alpha(ie, the procedure is not analagous to the Benjamini-Hochberg FDR controlling procedure). A bound on the overall FDR can be obtained using the c2a function (below.)

Value

vector of values of cFDR

Author(s)

James Liley

Examples

1
2
3
4
nn=100000
Z=abs(rbind(rmnorm(0.8*nn,varcov=diag(2)), rmnorm(0.15*nn,varcov=rbind(c(1,0),c(0,2^2))), rmnorm(0.05*nn,varcov=rbind(c(3^2,2),c(2,4^2)))));
cfdr=cfdr(Z,sub=which(Z[,1]^2 + Z[,2]^2 > 6))
plotZ(Z,rlim=2); points(Z[which(cfdr<0.001),],col="red",pch=16)

jamesliley/subtest documentation built on May 18, 2019, 11:21 a.m.