-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslides_enbik_2022.Rmd
253 lines (141 loc) · 3.61 KB
/
slides_enbik_2022.Rmd
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
---
title: "Interpreting uncertainty in differential expression with DESeq2"
author: "Martin Modrák\n Institute of Microbiology of the Czech Academy of Sciences"
output:
xaringan::moon_reader:
lib_dir: ./libs
css: ["hygge", "middlebury-fonts", "ninjutsu", "elixir.css"]
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
library(SBC)
library(ggplot2)
library(dplyr)
theme_set(cowplot::theme_cowplot())
knitr::opts_chunk$set(echo=FALSE, cache = TRUE, fig.width = 4, fig.height=2.5)
```
class: center, middle, inverse
# Background
---
# Why confidence intervals?
DESeq2 does a good job with interval hypothesis
--
We might want to order genes by LFC
--
.mid_fig[

]
---
# Frequentist calibration of CIs
In x% of repetitions of the exact same experiment, x% confidence interval will contain the true value.
???
Assuming the model is correct. Needs to hold for any parameters! -> Worst case, asymptotic results, bounds
---
# Bayesian calibration
Averaged over the prior, x% credible interval will contain the true value x% of the time.
???
Assuming the model is correct. Can be exact.
---
# The secret frequentists don't want you to know
1) Define likelihood
2) Maximize likelihood
3) ????
4) Profit!
---
# The secret frequentists don't want you to know
1) Define likelihood
2) Maximize likelihood
3) ~~????~~ Compute Hessian
4) ~~Profit!~~ Assume normality
--
5) Publish!
---
# Bayesian interpretation of DESeq2
Frequentist models $\simeq$ Bayesian models
--
- Flat priors
- Posterior is normal
???
DESeq2 was intended as Empirical Bayes (maybe screenshot).
Note that this is the same assumption as before!
---
# Priors for the DESeq2 model
$$
\begin{align}
y_{g,s} &\sim \mathrm{NegBinomial\_2}(\mu_{g,s} r_s, \frac{1}{\tau_g}) \\
\mu_{g,s} &= X_s \beta \\
\log \tau_g &\sim \mathrm{N} \left(\frac{a}{\mu_{g}} + b, \sigma_\tau \right) \\
\end{align}
$$
--
$$
\beta \sim \mathrm{N}(0,1)
$$
$$
\sigma_\tau \sim \mathrm{HalfN(0, 1)} ; a \sim \Gamma(3, 6) ; b \sim \Gamma(4, 2.3)
$$
???
Note that we are in between estimating dispersion and known dispersion
---
class: center, middle, inverse
# Results
???
Only showing some settings, but results broadly consistent
---
# 3 replicates, default settings
- I.e. using the `apeglm` Student's T shrinkage
.large_fig[

]
---
# 3 replicates, default settings
Coverage of 95% CI: 91%
.large_fig[

]
---
# 3 replicates, no shrinkage
Coverage of 95% CI: 94%
.large_fig[

]
???
We are kind to the frequentist, because we are not testing all possible values.
---
# 3 replicates, T
Coverage of 95% CI: 98%
.large_fig[

]
---
# 20 replicates, default settings
Coverage of 95% CI: 93.5%
.large_fig[

]
---
# Multiple comparisons
Correction for multiple comparisons applies also to CIs!
--
E.g., for the 3 replicates without shrinkage:
95% CI coverage: 94%
95% CI coverage when p < 0.1: 67%
---
# DESeq - conclusions
- The CIs of DESeq2 can be slightly miscalibrated
--
- Especially with few replicates
--
- p-values still valid
--
- Bayesian interpretation of DESeq2 results is _somewhat_ possible
--
- Correct CIs for multiple comparisons
---
# Thank you - Questions?
https://github.com/hyunjimoon/SBC/
This work was supported by ELIXIR CZ research infrastructure project (MEYS Grant No: LM2018131) including access to computing and storage facilities.