Description Usage Arguments Details Value Author(s) References See Also Examples
This function calculates the local false discovery rate for a two-sample problem using a bivariate test statistic, consisting of classical t-statistics and the corresponding logarithmized standard error.
1 2 |
xdat |
the matrix of expression values, with genes as rows and samples as columns |
grp |
a grouping variable giving the class membership of each sample, i.e. each column in |
test |
a function that takes |
p0 |
if supplied, an estimate for the proportion of non-differentially expressed genes; if not supplied, the routine will estimate it, see Details. |
nperm |
number of permutations for establishing the null distribution of the t-statistic |
nr |
the number of equidistant breaks for the range of each test statistic; fdr values are calculated on the resulting (nr-1) x (nr-1) grid of cells. |
seed |
if specified, the random seed from which the permuations are started |
null |
optional argument for passing in a pre-calculated null distribution, see Examples. |
constrain |
logical value indicating whether the estimated fdr should be constrained to be monotonously decreasing with the absolute size of the t-statistic (more generally, the first test statistic). |
smooth |
a numerical value between 0.01 and 0.99, indicating which percentage of the available degrees of freedom are used for smoothing the fdr estimate; larger values indicate more smoothing. |
verb |
logical value indicating whether provide extra information. |
... |
extra arguments to function |
This routine computes a bivariate extension of the classical local false discovery rate as available through function fdr1d
. Consequently, many arguments have identical or similar meaning. Specifically for fdr2d
, nr
specifies the number of equidistant breaks defining a two-dimensional grid of cells on which the bivariate test statistics are counted; argument constrain
can be set to ensure that the estimated fdr is decreasing with increasing absolute value of the t-statistic; and argument smooth
specifies the degree of smoothing when estimating the fdr.
Note that while fdr2d
might be used for any suitable pair of test statistics, it has only been tested for the default pair, and the smoothing procedure specifically is optimized for this situation.
Note also that the estimation of the proportion p0
directly from the data may be quite unstable and dependant on the degree of smoothing; too heavy smoothing may even lead to estimates greater than 1. It is usually more stable use an estimate of p0
provided by fdr1d
.
Note that fdr1d
can also be used to check the degree of smoothing, see average.fdr
.
Basically, a data frame with one row per gene and three columns: tstat
, the test statistic, logse
, the corresponding logarithmized standard error, and fdr.local
, the local false discovery rate. This data frame has the additional class attributes fdr2d.result
and fdr.result
, see Examples. This is the bad old S3 class mechanism employed to provide plot and summary functions.
Additional information is provided by a param
attribute, which is a list with the following entries:
p0 |
the proportion of non-differentially expressed genes used when calculating the fdr. |
p0.est |
a logical value indicating whether |
fdr |
the matrix of smoothed fdr values calculated on the original grid. |
xbreaks |
vector of breaks for the first test statistic. |
ybreaks |
vector of breaks for the second test statistic. |
A Ploner and Y Pawitan
Ploner A, Calza S, Gusnanto A, Pawitan Y (2005) Multidimensional local false discovery rate for micorarray studies. Submitted Manuscript.
plot.fdr2d.result
, summary.fdr.result
, OCshow
, fdr1d
, average.fdr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # We simulate a small example with 5 percent regulated genes and
# a rather large effect size
set.seed(2000)
xdat = matrix(rnorm(50000), nrow=1000)
xdat[1:25, 1:25] = xdat[1:25, 1:25] - 1
xdat[26:50, 1:25] = xdat[26:50, 1:25] + 1
grp = rep(c("Sample A","Sample B"), c(25,25))
# A default run
res2d = fdr2d(xdat, grp)
res2d[1:20,]
# Looking at the results
summary(res2d)
plot(res2d)
res2d[res2d$fdr<0.05, ]
# Extra information
class(res2d)
attr(res2d,"param")
|
Starting permutations...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
tstat logse fdr.local
1 -3.113975 -1.317751 0.2107689450
2 -4.868530 -1.423606 0.0124838710
3 -4.487968 -1.316576 0.0374126780
4 -3.891546 -1.282619 0.0543524911
5 -2.323968 -1.302204 0.7080678883
6 -2.491116 -1.157857 0.7460020233
7 -2.896670 -1.169804 0.3756223654
8 -4.254195 -1.290534 0.0332573755
9 -3.490224 -1.334211 0.1736562385
10 -3.465717 -1.328086 0.1528700464
11 -2.642704 -1.407889 0.5238031060
12 -1.532776 -1.217003 0.8184856281
13 -3.805811 -1.373781 0.1298236681
14 -4.138912 -1.361446 0.0536263057
15 -4.999346 -1.340191 0.0120454097
16 -3.724595 -1.201502 0.0956079406
17 -4.853666 -1.180403 0.0003179785
18 -2.607185 -1.235779 0.4654395719
19 -3.639713 -1.275850 0.1302013668
20 -4.881803 -1.340349 0.0127744426
$Statistic
Min. 1st Qu. Median Mean 3rd Qu. Max.
-5.247257 -0.647769 -0.003438 0.015693 0.736234 5.125711
$fdr
fdr
statistic (0,0.05] (0.05,0.1] (0.1,0.2] (0.2,1] (1,Inf]
t<0 8 5 4 475 4
t>=0 10 3 4 482 5
$p0
$p0$Value
[1] 0.8382156
$p0$Estimated
[1] TRUE
tstat logse fdr.local
2 -4.868530 -1.423606 1.248387e-02
3 -4.487968 -1.316576 3.741268e-02
8 -4.254195 -1.290534 3.325738e-02
15 -4.999346 -1.340191 1.204541e-02
17 -4.853666 -1.180403 3.179785e-04
20 -4.881803 -1.340349 1.277444e-02
21 -4.273400 -1.134357 2.606529e-02
22 -5.247257 -1.143727 1.601348e-04
23 -4.550108 -1.159578 5.881470e-03
24 -5.002789 -1.299289 2.626309e-03
30 4.274270 -1.211328 2.714740e-03
31 3.687758 -1.223230 3.844077e-02
35 3.774064 -1.087781 3.072547e-02
37 4.810875 -1.337504 6.771634e-06
38 5.125711 -1.279623 6.771634e-06
39 4.883544 -1.324364 6.771634e-06
41 4.404355 -1.367099 3.016086e-02
46 3.476958 -1.184922 4.998823e-02
[1] "fdr2d.result" "fdr.result" "data.frame"
$p0
[1] 0.8382156
$p0.est
[1] TRUE
$fdr
cut.stat.y
cut.stat.x [-1.68,-1.63] (-1.63,-1.57] (-1.57,-1.52] (-1.52,-1.46]
[-5.93,-5.14] 1.016497e-05 6.789719e-05 0.0004291401 0.0001170128
(-5.14,-4.35] 7.127111e-05 8.583627e-04 0.0500607462 0.0011605028
(-4.35,-3.56] 4.980187e-04 7.543943e-02 0.5392176225 0.1626796607
(-3.56,-2.77] 1.009121e-03 1.518015e-01 0.6685138474 0.4618647699
(-2.77,-1.98] 1.556639e-01 1.422781e+00 0.6685138474 0.4618647699
(-1.98,-1.19] 2.933443e-01 2.979744e+00 0.6685138474 0.7749257661
(-1.19,-0.395] 4.427931e+00 5.617510e+00 0.8719620723 0.8335001136
(-0.395,0.395] 9.417282e+00 1.027663e+00 0.5774517378 0.5424582979
(0.395,1.19] 4.056640e+00 1.027663e+00 0.5774517378 0.5424582979
(1.19,1.98] 2.765121e-01 2.343601e-01 0.5774517378 0.5424582979
(1.98,2.77] 2.765121e-01 2.343601e-01 0.5774517378 0.5424582979
(2.77,3.56] 1.435008e-01 1.405925e-01 0.0640265198 0.4498870094
(3.56,4.35] 5.138012e-04 9.223914e-04 0.0640265198 0.0308634697
(4.35,5.14] 3.394681e-05 7.467544e-05 0.0004851369 0.0008886767
cut.stat.y
cut.stat.x (-1.46,-1.41] (-1.41,-1.35] (-1.35,-1.3] (-1.3,-1.24]
[-5.93,-5.14] 0.0007091151 0.0319622586 0.0006728586 6.486309e-05
(-5.14,-4.35] 0.0085408955 0.0319622586 0.0066790854 5.031757e-04
(-4.35,-3.56] 0.2038617163 0.0319622586 0.1225750400 1.200084e-02
(-3.56,-2.77] 0.4088414902 0.5658742386 0.1547746626 3.107612e-01
(-2.77,-1.98] 0.4088414902 0.6789512837 0.7783547602 6.046599e-01
(-1.98,-1.19] 0.6289316657 0.6789512837 0.7783547602 7.341049e-01
(-1.19,-0.395] 0.7974134691 0.6789512837 0.7783547602 8.973134e-01
(-0.395,0.395] 1.0000000000 0.8591118067 0.7839871593 7.379130e-01
(0.395,1.19] 0.7116472313 0.8503171998 0.7839871593 7.379130e-01
(1.19,1.98] 0.7116472313 0.8503171998 0.7224511199 6.723660e-01
(1.98,2.77] 0.7116472313 0.8503171998 0.6276135600 4.128811e-01
(2.77,3.56] 0.5577543946 0.8503171998 0.4513440323 7.928577e-02
(3.56,4.35] 0.3338496078 0.0514955487 0.1269185903 7.928577e-02
(4.35,5.14] 0.0749274908 0.0009334974 0.0005368182 4.863211e-04
cut.stat.y
cut.stat.x (-1.24,-1.19] (-1.19,-1.13] (-1.13,-1.08] (-1.08,-1.02]
[-5.93,-5.14] 2.662789e-05 2.669564e-05 2.869114e-05 1.010564e-05
(-5.14,-4.35] 3.461522e-04 3.776071e-04 4.393928e-04 7.268734e-05
(-4.35,-3.56] 1.551672e-02 2.214101e-02 6.698968e-02 9.250566e-04
(-3.56,-2.77] 3.451949e-01 1.350248e-01 7.071912e-01 1.499118e-01
(-2.77,-1.98] 4.746000e-01 8.474774e-01 9.033145e-01 3.233492e-01
(-1.98,-1.19] 8.203263e-01 9.197094e-01 9.033145e-01 3.233492e-01
(-1.19,-0.395] 8.203263e-01 9.197094e-01 9.033145e-01 8.335412e-01
(-0.395,0.395] 8.542737e-01 8.608025e-01 8.329860e-01 8.924202e-01
(0.395,1.19] 8.542737e-01 8.608025e-01 8.329860e-01 8.924202e-01
(1.19,1.98] 8.117328e-01 6.365743e-01 5.685784e-01 8.924202e-01
(1.98,2.77] 3.208918e-01 3.586726e-01 3.659326e-01 8.924202e-01
(2.77,3.56] 8.626137e-02 7.812575e-02 1.352357e-01 1.362331e-01
(3.56,4.35] 4.794024e-03 6.268985e-04 4.991264e-04 4.905773e-04
(4.35,5.14] 2.023619e-04 4.775147e-05 3.339304e-05 3.228750e-05
cut.stat.y
cut.stat.x (-1.02,-0.969] (-0.969,-0.914]
[-5.93,-5.14] 6.164728e-06 3.381046e-06
(-5.14,-4.35] 3.279677e-05 9.489522e-06
(-4.35,-3.56] 4.716101e-04 7.538774e-05
(-3.56,-2.77] 7.605143e-02 9.572560e-04
(-2.77,-1.98] 1.007017e+00 1.587987e-01
(-1.98,-1.19] 1.073935e+00 6.614802e-01
(-1.19,-0.395] 1.073935e+00 6.614802e-01
(-0.395,0.395] 6.212182e+00 7.268667e+00
(0.395,1.19] 6.212182e+00 2.759033e+00
(1.19,1.98] 1.397037e+00 1.601527e-01
(1.98,2.77] 1.505924e-01 1.009852e-03
(2.77,3.56] 7.196805e-02 4.946541e-04
(3.56,4.35] 4.459883e-04 5.195335e-05
(4.35,5.14] 2.832573e-05 6.771634e-06
$xbreaks
[1] -5.9263662 -5.1361841 -4.3460019 -3.5558197 -2.7656376 -1.9754554
[7] -1.1852732 -0.3950911 0.3950911 1.1852732 1.9754554 2.7656376
[13] 3.5558197 4.3460019 5.1361841
$ybreaks
[1] -1.6821150 -1.6272404 -1.5723657 -1.5174911 -1.4626165 -1.4077419
[7] -1.3528672 -1.2979926 -1.2431180 -1.1882434 -1.1333687 -1.0784941
[13] -1.0236195 -0.9687448 -0.9138702
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.