sfdr: Estimate of FDR Using Rectangular Rejection Region

Description Usage Arguments Value Examples

Description

This function calculates an estimate of the false discovery rate

FDR(t1, t2) = E[(V00 + V01 +V10)/(max(1, R))]

using the estimates of pi_00, pi_10, pi_01, and estimates of cdf of the p-values under the alternative hypothesis.

Usage

1
sfdr(p1, p2, pi_00, pi_10, pi_01, pi_1, pi_2, t1, t2)

Arguments

p1

vectors of p-values of the two independent experiments.

p2

vectors of p-values of the two independent experiments.

pi_00, pi_10, pi_01, pi_1, pi_2

proportions ...

t1, t2

the threshold values of p-values for two experiments.

Value

This function returns an estimate of simultaneous FDR.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
set.seed(1)
n <- 500
n11 <- 20; n10 <- n01 <- 20; n00 <- n - (n11 + n10 + n01)
mu1 <- rep(0, n)
mu1[1:(n11+n10)] <- rnorm(n = n11+n10, mean = 6,sd = 1)
t1 <- plyr::laply(1:n, function(i)rt(n = 1, df = 4, ncp = mu1[i]))
p1 <- plyr::laply(1:n, function(i)2*pt(q = abs(t1[i]), df = 4, ncp = 0, lower.tail = FALSE))
lambda1 <- estimate.lambda(p1, B = 20)
mu2 <- rep(0, n)
mu2[c(1:n11, (n11+n10+1):(n11+n10+n01))] <- rnorm(n = n11+n01, mean = 6,sd = 1)
t2 <- plyr::laply(1:n, function(i)rt(n = 1, df = 4, ncp = mu2[i]))
p2 <- plyr::laply(1:n, function(i)2*pt(q = abs(t2[i]), df = 4, ncp = 0, lower.tail = FALSE))
t1 <- p1[n11]; t2 <- p2[n11]
lambda2 <- estimate.lambda(p2, B = 20)
pi_00 <- pi00(p1, p2, lambda1, lambda2)
pi_1 <- pi0(p1, lambda1)
pi_2 <- pi0(p2, lambda2)
pi_10 <- max(0, pi_2 - pi_00)
pi_01 <- max(0, pi_1 - pi_00)
sfdrout <- sfdr(p1, p2, pi_00, pi_10, pi_01, pi_1, pi_2,  t1, t2)

ntyet/sfdr documentation built on May 7, 2019, 1:30 p.m.

Related to sfdr in ntyet/sfdr...