diff --git a/6_dea/dea.Rmd b/6_dea/dea.Rmd index bb790f7c5f50b2062860dd857b5184b15c306231..7658d3c9317ab290748ca86cb0daddae170df44a 100644 --- a/6_dea/dea.Rmd +++ b/6_dea/dea.Rmd @@ -32,51 +32,507 @@ classoption: aspectratio=169 ## Hypothesis testing -\begin{itemize} - \item $H_0$: the gene pression is the same between the $2$ groups - \item $H_1$: the gene pression is not the same between the $2$ groups -\end{itemize} +### Rejection of a null hypothesis $H_0$ + Given the null model of our data how likely are we to observe a value? \\ + We can compute this likelihood from the probability distribution of the null hypothesis.\\ + We reject the hypothesis at risk $\alpha$, the probability that the null hypothesis was true for the observed value. + +### $p$-value + The $p$-value is the probability to observe a value as or more extreme under the null hypothesis model. ## Hypothesis testing +\begin{center} +\only<1>{\includegraphics[width=12cm]{img/dnorm}} +\only<2>{\includegraphics[width=12cm]{img/dnorm_alpha}} +\only<3>{\includegraphics[width=12cm]{img/dnorm_alpha_accept}} +\only<4>{\includegraphics[width=12cm]{img/dnorm_alpha_reject}} +\end{center} \begin{itemize} - \item $H_0$: the gene pression is the same between the $2$ groups - \item $H_1$: the gene pression is not the same between the $2$ groups + \item distribution under the null hypothesis $H_0$ + \pause + \item rejection zone at a risk $\alpha$ \end{itemize} +## $p$-value construction +\begin{center} + \only<1>{\includegraphics[width=10cm]{img/pval_1_0.05}} + \only<2>{\includegraphics[width=10cm]{img/pval_1_0.15}} + \only<3>{\includegraphics[width=10cm]{img/pval_1_0.25}} + \only<4>{\includegraphics[width=10cm]{img/pval_1_0.35}} + \only<5>{\includegraphics[width=10cm]{img/pval_1_0.45}} + \only<6>{\includegraphics[width=10cm]{img/pval_1_0.55}} + \only<7>{\includegraphics[width=10cm]{img/pval_1_0.65}} + \only<8>{\includegraphics[width=10cm]{img/pval_1_0.75}} + \only<9>{\includegraphics[width=10cm]{img/pval_1_0.85}} + \only<10>{\includegraphics[width=10cm]{img/pval_1_0.95}} +\end{center} + \begin{center} + probability to observe a value as or more extreme under the null hypothesis model + \end{center} + +## $p$-value construction \begin{center} - {\bf We reject $H_0$ with a given risk $\alpha$ and a power $\beta$} + \only<1>{\includegraphics[width=10cm]{img/pval_2_0.05}} + \only<2>{\includegraphics[width=10cm]{img/pval_2_0.15}} + \only<3>{\includegraphics[width=10cm]{img/pval_2_0.25}} + \only<4>{\includegraphics[width=10cm]{img/pval_2_0.35}} + \only<5>{\includegraphics[width=10cm]{img/pval_2_0.45}} + \only<6>{\includegraphics[width=10cm]{img/pval_2_0.55}} + \only<7>{\includegraphics[width=10cm]{img/pval_2_0.65}} + \only<8>{\includegraphics[width=10cm]{img/pval_2_0.75}} + \only<9>{\includegraphics[width=10cm]{img/pval_2_0.85}} + \only<10>{\includegraphics[width=10cm]{img/pval_2_0.95}} \end{center} ## Hypothesis testing +\begin{center} + \href{https://en.wikipedia.org/}{ + \includegraphics[width=0.6\textwidth]{img/alpha_beta.png} + } +\end{center} +\vspace{-2.5em} +We specify $H_0$ not $H_1$ + +## Hypothesis testing + +\begin{center} +\begin{columns} +\column{0.6\textwidth} \begin{itemize} \item $\beta$ probability of a Type II error, known as a {\it false negative} \item $1 - \beta$ probability of a {\it true positive}, i.e., correctly rejecting the null hypothesis. $1 - \beta$ is also known as the power of the test. \item $\alpha$ probability of a Type I error, known as a {\it false positive} \item $1 - \alpha$ probability of a {\it true negative}, i.e., correctly not rejecting the null hypothesis \end{itemize} +\column{0.4\textwidth} -## Hypothesis testing +\begin{center} + {\bf ROC curve} + \href{https://en.wikipedia.org/}{ + \includegraphics[width=\textwidth]{img/roc_curve.png} + } +\end{center} +receiver operating characteristic +\end{columns} +\end{center} + +## Differential expression analysis + +### Finding difference in gene expression +\vspace{1em} + +\begin{center} +\begin{columns} +\column{0.5\textwidth} +\begin{center} +\begin{tikzpicture} + \fill + (0.5,3.5) node {\bf $\text{gene}_1$} + -- (0.5,2.5) node {\bf $\text{gene}_2$} + -- (0.5,1.5) node {\bf $\vdots$} + -- (0.5,0.5) node {\bf $\text{gene}_n$}; + \fill + (1.5,4.5) node {\bf{$\text{cell}_1$}} + -- (1.5,3.5) node {mRNA} + -- (1.5,2.5) node {mRNA} + -- (1.5,1.5) node {$\vdots$} + -- (1.5,0.5) node {mRNA}; + \fill + (2.5,4.5) node {\bf{$\text{cell}_2$}} + -- (2.5,3.5) node {mRNA} + -- (2.5,2.5) node {mRNA} + -- (2.5,1.5) node {$\vdots$} + -- (2.5,0.5) node {mRNA}; + \fill + (3.5,4.5) node {\bf{$\cdots$}} + -- (3.5,3.5) node {$\cdots$} + -- (3.5,2.5) node {$\cdots$} + -- (3.5,1.5) node {$\ddots$} + -- (3.5,0.5) node {$\cdots$}; + \fill + (4.5,4.5) node {\bf{$\text{cell}_c$}} + -- (4.5,3.5) node {mRNA} + -- (4.5,2.5) node {mRNA} + -- (4.5,1.5) node {$\vdots$} + -- (4.5,0.5) node {mRNA}; + \draw (1,0) grid (5,4); +\end{tikzpicture} +\end{center} +\column{0.5\textwidth} +For a given gene $x_i$ we can test: +\vspace{1em} +\begin{itemize} + \item $H_0$: $E\left(x_i\right) = E\left(x_{i'}\right)$ + \item $H_0$: $E\left(x_i\right) = E\left(x_{i'}\right) = \dots = E\left(x_{i''}\right)$ + \item $H_0$: $E\left(x_i \times y\right) = E\left(x_i \times 1\right)$ +\end{itemize} +\vspace{2em} +or any combination of the above cases +\end{columns} +\end{center} + +## Differential expression analysis +\begin{center} + \href{https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8701051/}{ + \includegraphics[width=0.9\textwidth]{img/dea_tree.png} + } +\end{center} + +## Counts distributions + +$P(X = x)$ for $\mathcal{NB}(\lambda, \alpha = 10)$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/NB_sigma_10.png} +\end{center} + + +## Counts distributions + +$P(X = x)$ for $\mathcal{NB}(\lambda, \alpha = 2)$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/NB_sigma_2.png} +\end{center} + +## Counts distributions + +$P(X = x)$ for $\mathcal{NB}(\lambda, \alpha = 1)$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/NB_sigma_1.png} +\end{center} + +## Non-parametric approaches + +### We don't try to model the data distribution + +Instead we work with: + +- ranks of the values +- the sign of the difference between two groups (Wilcoxon) +- the distribution of differances + +If we know the distribution the parametric approach is often more powerfull + +### Often limited to the 2 groups setting + + +## Wilcoxon rank sum test + +### $H_0$: the median are equal + +\begin{center} + \href{https://www.nature.com/articles/s41467-021-27464-5}{ + \includegraphics[width=\textwidth]{img/wilcoxon_example.png} + } +\end{center} + +## WaddR + +### Base on 2-Wasserstein distance +\begin{center} + \href{https://pubmed.ncbi.nlm.nih.gov/33792651/}{ + \includegraphics[width=\textwidth]{img/waddR.png} + } +\end{center} + +## Model based approaches + +\begin{center} +\begin{columns} +\column{0.5\textwidth} + +\vspace{1em} + +{\bf Gaussian models} + +\[ +log(X + 1) \sim \mathcal{N}(\mu, \sigma) +\] + +{\bf Poisson models} + +\[ +X \sim \mathcal{P}(\lambda) +\] + +{\bf NB models} + +\[ +X \sim \mathcal{NB}(\lambda, \alpha) +\] + +{\bf ZINB models} + +\[ +X \sim \pi \delta_0 + \left(1 - \pi\right) \mathcal{NB}(\lambda, \alpha) +\] +\column{0.5\textwidth} \begin{center} \href{https://en.wikipedia.org/}{ - \includegraphics[width=0.6\textwidth]{img/alpha_beta.png} + \includegraphics[width=\textwidth]{img/dirac.png} + } +\end{center} +\end{columns} +\end{center} + + +## Model based approaches + +### NB distributed counts with excess of zeros +\begin{center} + \includegraphics[width=0.8\textwidth]{img/ziNB_1} +\end{center} + +## Model based approaches + +### Mixture of two NB distributions + +\begin{center} + \includegraphics[width=0.8\textwidth]{img/ziNB_2} +\end{center} + +## Model based approaches + +### $y = \beta_0 + \beta_1 x$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/lm_2_groups_b0_3_b1_05.png} +\end{center} + +$\beta_0 = 3$, $\beta_1 = 0.5$ + +## Model based approaches + +### $y = \beta_0 + \beta_1 x$ + +### Wald test: +\[H_0: \beta_1 = 0\] + +### Likelihood ratio test (LTR) +\[H_0: L\left(y = \beta_0\right) = L\left(y = \beta_0 + \beta_1 x\right)\] + +## Model based approaches + +### $y = \beta_0 + \beta_1 x$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/lm_b0_3_b1_05.png} +\end{center} + +$\beta_0 = 3$, $\beta_1 = 0.5$ + +## Model based approaches + +### $y = \beta_0 + \beta_1 x$ + +\begin{center} + \href{https://cole-trapnell-lab.github.io/monocle3/}{ + \includegraphics[width=0.7\textwidth]{img/deg_pseudotime.png} + } +\end{center} + +## Model based approaches + +### $y = \beta_0 + \beta_1 x_1 + \beta_2 x_2$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/lm_2_groups_b0_b0_3_b1_05.png} +\end{center} + +$\beta_0 = 3$, $\beta_1 = 0.5$ $\beta_2 = 5$ + +## Model based approaches + +### $y = \beta_0 + \beta_1 x_1 + \beta_2 x_2$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/lm_2_groups_b0_b0_3_b1_05_interaction.png} +\end{center} + +$\beta_0 = 3$, $\beta_1 = 0.5$ $\beta_2 = 5$ + +## Model based approaches + +### $y = \beta_0 + \beta_1 x_1 + \beta_2 x_2$ + +\begin{center} +\includegraphics[width=0.7\textwidth]{img/lm_2_groups_2_factors_b0_b0_3_b1_05_interaction.png} +\end{center} + +$\beta_0 = 3$, $\beta_1 = 0.5$ $\beta_2 = 5$ + +## Model based approaches + +### $y = \beta_0 + \beta_1 x_1 + \beta_2 x_2$ + +\begin{center} + href{doi: 10.1093/nar/gky675}{ + \includegraphics[width=0.6\textwidth]{img/deg_time_group.png} } \end{center} -# Parametric versus non-parametric testing -# Differential expression analysis between groups +# Multiple hypotheses testing + +## Multiple hypotheses problem +\begin{center} + \only<1>{\includegraphics[width=10cm]{img/dnorm_abs}\\[-2.5em]} + \only<1>{\includegraphics[width=10cm]{img/pval_alpha}} + \only<2>{\includegraphics[width=10cm]{img/pval_alpha_random_H0_1} + \begin{center} + n = 10 + \end{center}} + \only<3>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_2} + \begin{center} + n = 30 + \end{center}} + \only<4>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_3} + \begin{center} + n = 60 + \end{center}} + \only<5>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_4} + \begin{center} + n = 100 + \end{center}} + \only<6>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_5} + \begin{center} + n = 150 + \end{center}} + \only<7>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_6} + \begin{center} + n = 210 + \end{center}} + \only<8>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_7} + \begin{center} + n = 280 + \end{center}} + \only<9>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_8} + \begin{center} + n = 360 + \end{center}} + \only<10>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_9} + \begin{center} + n = 450 + \end{center}} + \only<11>{\includegraphics[width=12cm]{img/pval_alpha_random_H0_10} + \begin{center} + n = 550 + \end{center}} +\end{center} + + +## Multiple hypotheses solutions + +\begin{block}{Family Wise Error Rate (FWER)} + \begin{itemize} + \item Bonferoni like procedure + \item Control the risk of having fewer than one false positive + \item $\Pr\left(FP < 1\right) < \alpha_{FWER}$ + \item $\alpha_{FWER} = \frac{\alpha}{m}$ + \end{itemize} +\end{block} +\begin{example} + \begin{center} + \emph{``We reject 14 hypothesis with a FWER of 0.05''} + \emph{``We reject 14 hypothesis at a level of 0.05 after Bonferoni correction''} + \end{center} + Means: 14 hypotheses are not following the null distribution and we make this statement with a probability 0.05 of having fewer than one false positives in the 14 tests. +\end{example} + +## Multiple hypotheses solutions + +\begin{block}{False Discovery Rate (FDR)} + \begin{itemize} + \item Benjamini-Hochberg like procedure + \item Control the risk of having less than a proportion of false positive + \item $\Pr\left(\mathbb{E}\left[\frac{FP}{R}\right | R > 0]\right)\Pr\left(R > 0\right) < \alpha_{FDR}$ + \item adaptive procedure $\alpha_{FDR} \sim f_0$ + \end{itemize} +\end{block} +\only<1>{ +\vspace{2em} +\begin{tabular}{l|ccc} + hypothesis & Claimed non-significant & Claimed significant & Total\\ + \hline + Null & TN & FP & $m_0$\\ + Non-null & FN & TP & $m_1$\\ + Total & S & R & $m$ +\end{tabular} +} +\only<2-3>{ + \begin{example} + \begin{center} + \emph{``We reject 254 hypothesis with a FDR of 0.05''} + \emph{``We reject 254 hypothesis with a level of 0.05 after BH correction''} + \end{center} + Means: 254 hypotheses are not following the null distribution and we expect on average 5\% or less of false positives in the 254. + \end{example} +} +\only<3>{ + \begin{center} + The number of FPs increases with the number of TPs + \end{center} +} -## Differential expression analysis between $2$ groups +## FWER versus FDR control +\begin{center} +\includegraphics[width=12cm]{img/pval_hist_H0} +\end{center} +$$\Pr\left(FP < 1\right) < \alpha_{FWER}$$ +$$\Pr\left(\mathbb{E}\left[\frac{FP}{R}\right | R > 0]\right)\Pr\left(R > 0\right) < \alpha_{FDR}$$ +When $TP \leq 1$ FWER and FDR control are identical.\\ +The difference increases with the number of $TP$s -## Between $n$ groups +## FDR control -# Regression analysis +\begin{center} +\includegraphics[width=12cm]{img/pval_hist_H0_H1}\\[-1em] +\pause +When we analyse data we hope to get a mixture between:\\ +\includegraphics[width=12cm]{img/pval_hist_H0}\\[-2em] +\pause +\includegraphics[width=12cm]{img/pval_hist_H1} +\end{center} -# Multiple testing +## FDR control: local FDR ($\ell FDR$) of Efron + +\begin{center} +\only<1>{\includegraphics[width=12cm]{img/pval_hist_H0_H1}} +\only<2-3>{\includegraphics[width=12cm]{img/pval_hist_H0_H1_mixture}} +\only<4>{\includegraphics[width=12cm]{img/zval_hist_H0_H1_mixture}} +\end{center} +\only<3-4>{ + $$\ell FDR\left(x_i\right) = \frac{{\color{blue}\Pr\left(x_i | H_i = 0\right)}}{{\color{blue}\Pr\left(x_i | H_i = 0\right)}{\color{red}\Pr\left(x_i | H_i = 1\right)}}$$ +} +\only<4>{ +\begin{center} + work with $z$-values instead of $p$-values +\end{center} +} # Post-selection inference +## Post-selection inference + +\begin{center} + \href{https://en.wikipedia.org/}{ + \includegraphics[width=\textwidth]{img/post_inference.png} + } +\end{center} + +## SimCD + +\begin{center} + \href{https://arxiv.org/abs/2104.01512v1}{ + \includegraphics[width=0.6\textwidth]{img/simCD.png} + } +\end{center} + +area under ROC curves + # Multivariate Differential expression analysis \ No newline at end of file diff --git a/6_dea/img/NB_sigma_.pdf b/6_dea/img/NB_sigma_.pdf new file mode 100644 index 0000000000000000000000000000000000000000..486287438f8491587770307c6050e74236b2a560 Binary files /dev/null and b/6_dea/img/NB_sigma_.pdf differ diff --git a/6_dea/img/NB_sigma_1.png b/6_dea/img/NB_sigma_1.png new file mode 100644 index 0000000000000000000000000000000000000000..11e29ba9d08548761b6636a1ad18b4175706cb94 Binary files /dev/null and b/6_dea/img/NB_sigma_1.png differ diff --git a/6_dea/img/NB_sigma_10.png b/6_dea/img/NB_sigma_10.png new file mode 100644 index 0000000000000000000000000000000000000000..f31cdb78fe65a0a55603de9abe6e84e33b45bdad Binary files /dev/null and b/6_dea/img/NB_sigma_10.png differ diff --git a/6_dea/img/NB_sigma_2.png b/6_dea/img/NB_sigma_2.png new file mode 100644 index 0000000000000000000000000000000000000000..fea6a025a9f4b85c9d3fc13e30c2d0f1e70c986a Binary files /dev/null and b/6_dea/img/NB_sigma_2.png differ diff --git a/6_dea/img/dea_tree.png b/6_dea/img/dea_tree.png new file mode 100644 index 0000000000000000000000000000000000000000..4e3002c0d7dff0345530f74534283d17071edaf1 Binary files /dev/null and b/6_dea/img/dea_tree.png differ diff --git a/6_dea/img/deg_pseudotime.png b/6_dea/img/deg_pseudotime.png new file mode 100644 index 0000000000000000000000000000000000000000..303f29a252978956442e3ca30b8b16c9710e433b Binary files /dev/null and b/6_dea/img/deg_pseudotime.png differ diff --git a/6_dea/img/deg_time_group.png b/6_dea/img/deg_time_group.png new file mode 100644 index 0000000000000000000000000000000000000000..1761b1b55158f6b4eefd9997fd1a664c3b258e35 Binary files /dev/null and b/6_dea/img/deg_time_group.png differ diff --git a/6_dea/img/dirac.png b/6_dea/img/dirac.png new file mode 100644 index 0000000000000000000000000000000000000000..1b07e74e79e0a4dd41b1ec21487b24ca4bfaf4ef Binary files /dev/null and b/6_dea/img/dirac.png differ diff --git a/6_dea/img/dnorm.pdf b/6_dea/img/dnorm.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8a0b6c82e48bd7b8a9ce18206e64ec48d1d46ff8 Binary files /dev/null and b/6_dea/img/dnorm.pdf differ diff --git a/6_dea/img/dnorm_abs.pdf b/6_dea/img/dnorm_abs.pdf new file mode 100644 index 0000000000000000000000000000000000000000..deb5cda5988b6e46e5abb91f55777e9ab35926f5 Binary files /dev/null and b/6_dea/img/dnorm_abs.pdf differ diff --git a/6_dea/img/dnorm_abs1.pdf b/6_dea/img/dnorm_abs1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9c5423476670f343d3f8cecffb60b2638d30e67b Binary files /dev/null and b/6_dea/img/dnorm_abs1.pdf differ diff --git a/6_dea/img/dnorm_abs10.pdf b/6_dea/img/dnorm_abs10.pdf new file mode 100644 index 0000000000000000000000000000000000000000..34727814a657f4811fe2cf688d83bc1c6eb5b06c Binary files /dev/null and b/6_dea/img/dnorm_abs10.pdf differ diff --git a/6_dea/img/dnorm_abs2.pdf b/6_dea/img/dnorm_abs2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..73bede4a41ae7af91d05aa845dee8dfaf4509057 Binary files /dev/null and b/6_dea/img/dnorm_abs2.pdf differ diff --git a/6_dea/img/dnorm_abs3.pdf b/6_dea/img/dnorm_abs3.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c5ed2ba5f8f4460d661ba51c03b7e85cef5d9f1b Binary files /dev/null and b/6_dea/img/dnorm_abs3.pdf differ diff --git a/6_dea/img/dnorm_abs4.pdf b/6_dea/img/dnorm_abs4.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2b972b24751eca9f414c62fd9b36c429e6d75916 Binary files /dev/null and b/6_dea/img/dnorm_abs4.pdf differ diff --git a/6_dea/img/dnorm_abs5.pdf b/6_dea/img/dnorm_abs5.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2aa3dd99517a178caa018ffb8d3d597cf89accef Binary files /dev/null and b/6_dea/img/dnorm_abs5.pdf differ diff --git a/6_dea/img/dnorm_abs6.pdf b/6_dea/img/dnorm_abs6.pdf new file mode 100644 index 0000000000000000000000000000000000000000..77aa05f4057d83de0d4b99c9410a6755d9b410a7 Binary files /dev/null and b/6_dea/img/dnorm_abs6.pdf differ diff --git a/6_dea/img/dnorm_abs7.pdf b/6_dea/img/dnorm_abs7.pdf new file mode 100644 index 0000000000000000000000000000000000000000..51ed6f5287f828fbd34de87d64f82003a16023d8 Binary files /dev/null and b/6_dea/img/dnorm_abs7.pdf differ diff --git a/6_dea/img/dnorm_abs8.pdf b/6_dea/img/dnorm_abs8.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a74b517fe5a7caaec6d63bc14a3a678d809bc48b Binary files /dev/null and b/6_dea/img/dnorm_abs8.pdf differ diff --git a/6_dea/img/dnorm_abs9.pdf b/6_dea/img/dnorm_abs9.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9cdf6a00692037688a3bacde8f0c52c810626300 Binary files /dev/null and b/6_dea/img/dnorm_abs9.pdf differ diff --git a/6_dea/img/dnorm_abs_0.pdf b/6_dea/img/dnorm_abs_0.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6d0bcccaa1fe267d714d6560445c2b35e81878b2 Binary files /dev/null and b/6_dea/img/dnorm_abs_0.pdf differ diff --git a/6_dea/img/dnorm_abs_1.pdf b/6_dea/img/dnorm_abs_1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..32b1adef5f57e462f47cc6d427c540bb0d971860 Binary files /dev/null and b/6_dea/img/dnorm_abs_1.pdf differ diff --git a/6_dea/img/dnorm_abs_10.pdf b/6_dea/img/dnorm_abs_10.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1bc3f60946436687015ae77f0f0ca1617a636d57 Binary files /dev/null and b/6_dea/img/dnorm_abs_10.pdf differ diff --git a/6_dea/img/dnorm_abs_2.pdf b/6_dea/img/dnorm_abs_2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..73106597ff7750dd300cf525c6ab9764c7cc306e Binary files /dev/null and b/6_dea/img/dnorm_abs_2.pdf differ diff --git a/6_dea/img/dnorm_abs_3.pdf b/6_dea/img/dnorm_abs_3.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a30db67249f380eb07179ca4463219bd07a4f2e4 Binary files /dev/null and b/6_dea/img/dnorm_abs_3.pdf differ diff --git a/6_dea/img/dnorm_abs_4.pdf b/6_dea/img/dnorm_abs_4.pdf new file mode 100644 index 0000000000000000000000000000000000000000..14089e575a1956f5865482d68e68a4d878c08297 Binary files /dev/null and b/6_dea/img/dnorm_abs_4.pdf differ diff --git a/6_dea/img/dnorm_abs_5.pdf b/6_dea/img/dnorm_abs_5.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7b33b5de0b82ffe4884b96dc8baea8193ec67e61 Binary files /dev/null and b/6_dea/img/dnorm_abs_5.pdf differ diff --git a/6_dea/img/dnorm_abs_6.pdf b/6_dea/img/dnorm_abs_6.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e1e8d0a0f29f75232a35aeb1b5ef33df1dd1f54a Binary files /dev/null and b/6_dea/img/dnorm_abs_6.pdf differ diff --git a/6_dea/img/dnorm_abs_7.pdf b/6_dea/img/dnorm_abs_7.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9e64c13b8ea5170725d91fb1fd2c644b6f159d53 Binary files /dev/null and b/6_dea/img/dnorm_abs_7.pdf differ diff --git a/6_dea/img/dnorm_abs_8.pdf b/6_dea/img/dnorm_abs_8.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ffe3c2ab8beae42b5e20e02cd6a871d93d14e4e1 Binary files /dev/null and b/6_dea/img/dnorm_abs_8.pdf differ diff --git a/6_dea/img/dnorm_abs_9.pdf b/6_dea/img/dnorm_abs_9.pdf new file mode 100644 index 0000000000000000000000000000000000000000..073c0da95d5ec29c89d6c1df2be7e61c203568c4 Binary files /dev/null and b/6_dea/img/dnorm_abs_9.pdf differ diff --git a/6_dea/img/dnorm_alpha.pdf b/6_dea/img/dnorm_alpha.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7ded40ec460e81dab0bafcee3ca7d163c297856c Binary files /dev/null and b/6_dea/img/dnorm_alpha.pdf differ diff --git a/6_dea/img/dnorm_alpha_accept.pdf b/6_dea/img/dnorm_alpha_accept.pdf new file mode 100644 index 0000000000000000000000000000000000000000..673d8754c871918e5f126ac64ef106224135fd64 Binary files /dev/null and b/6_dea/img/dnorm_alpha_accept.pdf differ diff --git a/6_dea/img/dnorm_alpha_reject.pdf b/6_dea/img/dnorm_alpha_reject.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b98367b1b5bf216564daf3d3070c9538f8d31bc4 Binary files /dev/null and b/6_dea/img/dnorm_alpha_reject.pdf differ diff --git a/6_dea/img/lm_2_groups_2_factors_b0_b0_3_b1_05_interaction.png b/6_dea/img/lm_2_groups_2_factors_b0_b0_3_b1_05_interaction.png new file mode 100644 index 0000000000000000000000000000000000000000..d972c8a73683cd24f9e2697df039d5b0fd84e2f9 Binary files /dev/null and b/6_dea/img/lm_2_groups_2_factors_b0_b0_3_b1_05_interaction.png differ diff --git a/6_dea/img/lm_2_groups_b0_3_b1_05.png b/6_dea/img/lm_2_groups_b0_3_b1_05.png new file mode 100644 index 0000000000000000000000000000000000000000..7c7451803cc63c3ca26419ea08da306354a1c123 Binary files /dev/null and b/6_dea/img/lm_2_groups_b0_3_b1_05.png differ diff --git a/6_dea/img/lm_2_groups_b0_b0_3_b1_05.png b/6_dea/img/lm_2_groups_b0_b0_3_b1_05.png new file mode 100644 index 0000000000000000000000000000000000000000..d1c2ecbf9a92e1a5107531df2b27210e7e223482 Binary files /dev/null and b/6_dea/img/lm_2_groups_b0_b0_3_b1_05.png differ diff --git a/6_dea/img/lm_2_groups_b0_b0_3_b1_05_interaction.png b/6_dea/img/lm_2_groups_b0_b0_3_b1_05_interaction.png new file mode 100644 index 0000000000000000000000000000000000000000..f2848935ebde85c521cfa3cca002ae27bcd0324d Binary files /dev/null and b/6_dea/img/lm_2_groups_b0_b0_3_b1_05_interaction.png differ diff --git a/6_dea/img/lm_b0_3_b1_05.png b/6_dea/img/lm_b0_3_b1_05.png new file mode 100644 index 0000000000000000000000000000000000000000..cf2d2d70653676af5809731bf73f0452a4f0bee6 Binary files /dev/null and b/6_dea/img/lm_b0_3_b1_05.png differ diff --git a/6_dea/img/post_inference.png b/6_dea/img/post_inference.png new file mode 100644 index 0000000000000000000000000000000000000000..850aea25afc1d469279badc1cb0a40ceeabbe8a1 Binary files /dev/null and b/6_dea/img/post_inference.png differ diff --git a/6_dea/img/pval.pdf b/6_dea/img/pval.pdf new file mode 100644 index 0000000000000000000000000000000000000000..287a06a5b0bcecef59a0b20a4e4884919be18bb2 Binary files /dev/null and b/6_dea/img/pval.pdf differ diff --git a/6_dea/img/pval_0.pdf b/6_dea/img/pval_0.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bbf134415b4fcec7b940dea45bc6b3fe7e4ff09d Binary files /dev/null and b/6_dea/img/pval_0.pdf differ diff --git a/6_dea/img/pval_1.pdf b/6_dea/img/pval_1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a49b45dd6a352d445b80f92f304916c5717d99d2 Binary files /dev/null and b/6_dea/img/pval_1.pdf differ diff --git a/6_dea/img/pval_10.pdf b/6_dea/img/pval_10.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8f15e518a8a65eaba7f72494612df4c8fb60aba7 Binary files /dev/null and b/6_dea/img/pval_10.pdf differ diff --git a/6_dea/img/pval_1_0.05.pdf b/6_dea/img/pval_1_0.05.pdf new file mode 100644 index 0000000000000000000000000000000000000000..dbbd6410867904460e09437ec919a3e14afaf27c Binary files /dev/null and b/6_dea/img/pval_1_0.05.pdf differ diff --git a/6_dea/img/pval_1_0.15.pdf b/6_dea/img/pval_1_0.15.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1aefc76313ead31a54420b24138ae8841f437d40 Binary files /dev/null and b/6_dea/img/pval_1_0.15.pdf differ diff --git a/6_dea/img/pval_1_0.25.pdf b/6_dea/img/pval_1_0.25.pdf new file mode 100644 index 0000000000000000000000000000000000000000..41a958784277d0e2af09d655519c323c478351ce Binary files /dev/null and b/6_dea/img/pval_1_0.25.pdf differ diff --git a/6_dea/img/pval_1_0.35.pdf b/6_dea/img/pval_1_0.35.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7320c060629190100d089d9425bf8207eb801a06 Binary files /dev/null and b/6_dea/img/pval_1_0.35.pdf differ diff --git a/6_dea/img/pval_1_0.45.pdf b/6_dea/img/pval_1_0.45.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6afa27030bd0bb3c5902e3704e8b6f04a3355829 Binary files /dev/null and b/6_dea/img/pval_1_0.45.pdf differ diff --git a/6_dea/img/pval_1_0.55.pdf b/6_dea/img/pval_1_0.55.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8140be619749bcfbc3e58cc629be6edfb5b7112a Binary files /dev/null and b/6_dea/img/pval_1_0.55.pdf differ diff --git a/6_dea/img/pval_1_0.65.pdf b/6_dea/img/pval_1_0.65.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d2c51b3c15010eeb1655ebd5042037773ee734dc Binary files /dev/null and b/6_dea/img/pval_1_0.65.pdf differ diff --git a/6_dea/img/pval_1_0.75.pdf b/6_dea/img/pval_1_0.75.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f91b6a0ffb81036614a70158bdda6cab127d2468 Binary files /dev/null and b/6_dea/img/pval_1_0.75.pdf differ diff --git a/6_dea/img/pval_1_0.85.pdf b/6_dea/img/pval_1_0.85.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f10c3afcab5f2becd3655c1ba5bcb0fdea12c6ce Binary files /dev/null and b/6_dea/img/pval_1_0.85.pdf differ diff --git a/6_dea/img/pval_1_0.95.pdf b/6_dea/img/pval_1_0.95.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2ef5a0f6adf657ffff1a380a9398ef3fc9000826 Binary files /dev/null and b/6_dea/img/pval_1_0.95.pdf differ diff --git a/6_dea/img/pval_2.pdf b/6_dea/img/pval_2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ae124bf17618f6090f702fe6a80dc4c06cbeed47 Binary files /dev/null and b/6_dea/img/pval_2.pdf differ diff --git a/6_dea/img/pval_2_0.05.pdf b/6_dea/img/pval_2_0.05.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a3e77ba5838f351bcf521fe382be71a3f7b8d304 Binary files /dev/null and b/6_dea/img/pval_2_0.05.pdf differ diff --git a/6_dea/img/pval_2_0.15.pdf b/6_dea/img/pval_2_0.15.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bd8105cb0ea0f73795efcd69b082b69f753bb0d5 Binary files /dev/null and b/6_dea/img/pval_2_0.15.pdf differ diff --git a/6_dea/img/pval_2_0.25.pdf b/6_dea/img/pval_2_0.25.pdf new file mode 100644 index 0000000000000000000000000000000000000000..33c62f5e6f2465947f7abecd9a7b0f769147e30f Binary files /dev/null and b/6_dea/img/pval_2_0.25.pdf differ diff --git a/6_dea/img/pval_2_0.35.pdf b/6_dea/img/pval_2_0.35.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3ca688ae861c4ddadc1ff56e2ce606f4d6700480 Binary files /dev/null and b/6_dea/img/pval_2_0.35.pdf differ diff --git a/6_dea/img/pval_2_0.45.pdf b/6_dea/img/pval_2_0.45.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e1355c2367c851140bdfe0e1bbe9fac45015eab7 Binary files /dev/null and b/6_dea/img/pval_2_0.45.pdf differ diff --git a/6_dea/img/pval_2_0.55.pdf b/6_dea/img/pval_2_0.55.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6a77e82ac211a3665576cbd5ea07402ed8a0506c Binary files /dev/null and b/6_dea/img/pval_2_0.55.pdf differ diff --git a/6_dea/img/pval_2_0.65.pdf b/6_dea/img/pval_2_0.65.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b43036fc7765f42619a97a3cd7fed0f87b5bad6d Binary files /dev/null and b/6_dea/img/pval_2_0.65.pdf differ diff --git a/6_dea/img/pval_2_0.75.pdf b/6_dea/img/pval_2_0.75.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e346172da7a7b643e6e147d34ea128f8b384f2c4 Binary files /dev/null and b/6_dea/img/pval_2_0.75.pdf differ diff --git a/6_dea/img/pval_2_0.85.pdf b/6_dea/img/pval_2_0.85.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fe65e46adc74c3a6450eed26be7a3ce71ce90c49 Binary files /dev/null and b/6_dea/img/pval_2_0.85.pdf differ diff --git a/6_dea/img/pval_2_0.95.pdf b/6_dea/img/pval_2_0.95.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6cf7be2705f0f43d0681e97950a1249f69af7427 Binary files /dev/null and b/6_dea/img/pval_2_0.95.pdf differ diff --git a/6_dea/img/pval_3.pdf b/6_dea/img/pval_3.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4c28a7e394bbb76383cad0e362e8e5fb8643037a Binary files /dev/null and b/6_dea/img/pval_3.pdf differ diff --git a/6_dea/img/pval_4.pdf b/6_dea/img/pval_4.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7a197f28e917150c92cd8bbee25922d3bde13602 Binary files /dev/null and b/6_dea/img/pval_4.pdf differ diff --git a/6_dea/img/pval_5.pdf b/6_dea/img/pval_5.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cd2536bf74fe67db40ec0f616319c05ddfebfd3a Binary files /dev/null and b/6_dea/img/pval_5.pdf differ diff --git a/6_dea/img/pval_6.pdf b/6_dea/img/pval_6.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bb3112ea10dbed1ccabab8a68d589375ef23ec03 Binary files /dev/null and b/6_dea/img/pval_6.pdf differ diff --git a/6_dea/img/pval_7.pdf b/6_dea/img/pval_7.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ec448e8c7064373587c84f48c27d2d49e6c1e0c0 Binary files /dev/null and b/6_dea/img/pval_7.pdf differ diff --git a/6_dea/img/pval_8.pdf b/6_dea/img/pval_8.pdf new file mode 100644 index 0000000000000000000000000000000000000000..875ef4551a4a6e2bea6a3f490cf5d0742468c9cd Binary files /dev/null and b/6_dea/img/pval_8.pdf differ diff --git a/6_dea/img/pval_9.pdf b/6_dea/img/pval_9.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6aceeb643817b1ce6e6eff8fb0234a7b46a29d5a Binary files /dev/null and b/6_dea/img/pval_9.pdf differ diff --git a/6_dea/img/pval_alpha.pdf b/6_dea/img/pval_alpha.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c43708b9253b70f6afeec7cea06669aa55b0f450 Binary files /dev/null and b/6_dea/img/pval_alpha.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_1.pdf b/6_dea/img/pval_alpha_random_H0_1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1616b4b9d1465ccc8852283b1a2a3d15b879579f Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_1.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_10.pdf b/6_dea/img/pval_alpha_random_H0_10.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8496a5271af5bc2ac1b1a22a994b6315153ac2a4 Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_10.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_2.pdf b/6_dea/img/pval_alpha_random_H0_2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d6ebf6a6bbfb4954a11412f6def0384ad4dad7e4 Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_2.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_3.pdf b/6_dea/img/pval_alpha_random_H0_3.pdf new file mode 100644 index 0000000000000000000000000000000000000000..63ce9500dc084115945a57cbebbde8b96b9f7708 Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_3.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_4.pdf b/6_dea/img/pval_alpha_random_H0_4.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d39d25cb676b292eb91e6697420bf11c51373d10 Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_4.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_5.pdf b/6_dea/img/pval_alpha_random_H0_5.pdf new file mode 100644 index 0000000000000000000000000000000000000000..924bae36d56e6b8c4380f3321f15085800c0f88b Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_5.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_6.pdf b/6_dea/img/pval_alpha_random_H0_6.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c77301d984c7be1fc6bba6f67d53e21241637ccd Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_6.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_7.pdf b/6_dea/img/pval_alpha_random_H0_7.pdf new file mode 100644 index 0000000000000000000000000000000000000000..deeb19dc155a3477f304a5ec7b66454f4752f321 Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_7.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_8.pdf b/6_dea/img/pval_alpha_random_H0_8.pdf new file mode 100644 index 0000000000000000000000000000000000000000..941edef4e180b9d2c52ee21ede8a0bed28e61198 Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_8.pdf differ diff --git a/6_dea/img/pval_alpha_random_H0_9.pdf b/6_dea/img/pval_alpha_random_H0_9.pdf new file mode 100644 index 0000000000000000000000000000000000000000..661cec6851049b435889d8261282bc81d00c074d Binary files /dev/null and b/6_dea/img/pval_alpha_random_H0_9.pdf differ diff --git a/6_dea/img/pval_cdf_H0.pdf b/6_dea/img/pval_cdf_H0.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2ef9d679cef7ce0872dd04191a1d66871bdd00f3 Binary files /dev/null and b/6_dea/img/pval_cdf_H0.pdf differ diff --git a/6_dea/img/pval_cdf_H0_H1.pdf b/6_dea/img/pval_cdf_H0_H1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..aa6411b1951a38783298cb6c1b0fa46346732c4f Binary files /dev/null and b/6_dea/img/pval_cdf_H0_H1.pdf differ diff --git a/6_dea/img/pval_cdf_H0_H1_zoom.pdf b/6_dea/img/pval_cdf_H0_H1_zoom.pdf new file mode 100644 index 0000000000000000000000000000000000000000..76077ba5886ad1befee501ac3e07e1a54077fd76 Binary files /dev/null and b/6_dea/img/pval_cdf_H0_H1_zoom.pdf differ diff --git a/6_dea/img/pval_cdf_H0_zoom.pdf b/6_dea/img/pval_cdf_H0_zoom.pdf new file mode 100644 index 0000000000000000000000000000000000000000..88dd580b790fb7ce98c66d816526b008b3b1ba98 Binary files /dev/null and b/6_dea/img/pval_cdf_H0_zoom.pdf differ diff --git a/6_dea/img/pval_hist_H0.pdf b/6_dea/img/pval_hist_H0.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bf264a0ae1d10be8be8c9cac7b71c87dcb67d397 Binary files /dev/null and b/6_dea/img/pval_hist_H0.pdf differ diff --git a/6_dea/img/pval_hist_H0_H1.pdf b/6_dea/img/pval_hist_H0_H1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fa9fb85950657f61dd7c57551a4ed6f11dc9f07e Binary files /dev/null and b/6_dea/img/pval_hist_H0_H1.pdf differ diff --git a/6_dea/img/pval_hist_H0_H1_mixture.pdf b/6_dea/img/pval_hist_H0_H1_mixture.pdf new file mode 100644 index 0000000000000000000000000000000000000000..106c98c14c3ec0930d0e4f9b12653a9d73359ec7 Binary files /dev/null and b/6_dea/img/pval_hist_H0_H1_mixture.pdf differ diff --git a/6_dea/img/pval_hist_H1.pdf b/6_dea/img/pval_hist_H1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..40c287d3e364c34f764d2794b83f67dd34481d57 Binary files /dev/null and b/6_dea/img/pval_hist_H1.pdf differ diff --git a/6_dea/img/roc_curve.png b/6_dea/img/roc_curve.png new file mode 100644 index 0000000000000000000000000000000000000000..1ae11dece356ac394aa1c0cfc73b468d9311ab51 Binary files /dev/null and b/6_dea/img/roc_curve.png differ diff --git a/6_dea/img/simCD.png b/6_dea/img/simCD.png new file mode 100644 index 0000000000000000000000000000000000000000..6be85b68312833dcef3038495e4b98f07d6855b5 Binary files /dev/null and b/6_dea/img/simCD.png differ diff --git a/6_dea/img/uni_vs_bi.pdf b/6_dea/img/uni_vs_bi.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f197892b90d8505e0fbaa723b5ed37df3c70b7c2 Binary files /dev/null and b/6_dea/img/uni_vs_bi.pdf differ diff --git a/6_dea/img/waddR.png b/6_dea/img/waddR.png new file mode 100644 index 0000000000000000000000000000000000000000..a97352b8be516cc0ad6bb1f4d8112e5ae7cd114a Binary files /dev/null and b/6_dea/img/waddR.png differ diff --git a/6_dea/img/wilcoxon_example.png b/6_dea/img/wilcoxon_example.png new file mode 100644 index 0000000000000000000000000000000000000000..2f8793db38f806f777bd5b4221b137fe42de72ab Binary files /dev/null and b/6_dea/img/wilcoxon_example.png differ diff --git a/6_dea/img/ziNB_1.pdf b/6_dea/img/ziNB_1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6ffa78bf66dca0eea20ee0bb209ced816c22dd2c Binary files /dev/null and b/6_dea/img/ziNB_1.pdf differ diff --git a/6_dea/img/ziNB_2.pdf b/6_dea/img/ziNB_2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..acb202d3b0835b264ce4c8616fc98cbfcfb78ee9 Binary files /dev/null and b/6_dea/img/ziNB_2.pdf differ diff --git a/6_dea/img/zval_hist_H0_H1_mixture.pdf b/6_dea/img/zval_hist_H0_H1_mixture.pdf new file mode 100644 index 0000000000000000000000000000000000000000..96dd61d1dad27e9064f542082ac4d21bc455d881 Binary files /dev/null and b/6_dea/img/zval_hist_H0_H1_mixture.pdf differ diff --git a/6_dea/plot.R b/6_dea/plot.R new file mode 100644 index 0000000000000000000000000000000000000000..863a4dd6feb8ceaa65208c714f6cfbf6d2035f2c --- /dev/null +++ b/6_dea/plot.R @@ -0,0 +1,227 @@ +library(tidyverse) +library(patchwork) +setwd("6_dea/") + +for( threshold in seq(from = 0.05, to = 1, by = 0.1)) { +data <- tibble( + x = seq(from = -5, to = 5, length.out = 1000) +) %>% + mutate( + y = dnorm(x), + q = qnorm(y), + p = pnorm(x) + ) +data %>% + ggplot(aes(x = x, y = y)) + + geom_line() + + geom_area(fill = "#18BABD") + + geom_ribbon(data = data %>% filter(x < qnorm(threshold)), + aes(xmin = -5, xmax = qnorm(threshold), ymin = 0, ymax = y), + fill = "#F67770") + + geom_vline(xintercept = qnorm(threshold), size = 2) + + theme_bw(base_size = 22) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent') + ) +ggsave(filename = str_c("img/pval_1_", threshold, ".pdf"), bg='transparent', width = 12, height = 5) + +p1 <- data %>% + ggplot(aes(x = x, y = p)) + + geom_line() + + geom_area(fill = "#18BABD") + + geom_ribbon(data = data %>% filter(x < qnorm(threshold)), + aes(xmin = -5, xmax = pnorm(threshold), ymin = 0, ymax = p), + fill = "#F67770") + + geom_vline(xintercept = qnorm(threshold), size = 2) + + theme_bw(base_size = 22) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent') + ) + +p2 <- tibble( + x = pnorm(rnorm(100000)) + ) %>% + ggplot(aes(x = x, fill = x > threshold)) + + geom_histogram( bins = 100) + + geom_vline(xintercept = threshold, size = 2) + + theme_bw(base_size = 22) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent'), + legend.position = "none" + ) + +p <- p1 / p2 +ggsave(plot = p, filename = str_c("img/pval_2_", threshold, ".pdf"), bg='transparent', width = 12, height = 10) +} + +tibble( + x = c(rep(1, 500), rep(20,500)) +) %>% + mutate( + y = 3 + x * 0.5, + y_rand = y + rnorm(n()) + ) %>% + ggplot(aes(x = x, y = y)) + + geom_point(aes(y = y_rand)) + + geom_point(size = 10, color = "blue") + + theme_bw(base_size = 22) + + ylim(c(0, 20)) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent') + ) +ggsave(filename = "img/lm_2_groups_b0_3_b1_05.png", bg='transparent', width = 12, height = 6) + +tibble( + x = seq(from = 0, to = 20, length.out = 1000) +) %>% + mutate( + y = 3 + x * 0.5, + y_rand = y + rnorm(n()) + ) %>% + ggplot(aes(x = x, y = y)) + + geom_point(aes(y = y_rand)) + + geom_line(size = 2, color = "blue") + + theme_bw(base_size = 22) + + ylim(c(0, 20)) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent') + ) +ggsave(filename = "img/lm_b0_3_b1_05.png", bg='transparent', width = 12, height = 6) + + +tibble( + x = seq(from = 0, to = 20, length.out = 1000), + group = rbinom(1000, 1, 0.5) +) %>% + mutate( + y = 3 + x * 0.5 + group * 5, + y_rand = y + rnorm(n()) + ) %>% + ggplot(aes(x = x, y = y, group = group)) + + geom_point(aes(y = y_rand)) + + geom_line(size = 2, color = "blue") + + theme_bw(base_size = 22) + + ylim(c(0, 20)) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent') + ) +ggsave(filename = "img/lm_2_groups_b0_b0_3_b1_05.png", bg='transparent', width = 12, height = 6) + +tibble( + x = seq(from = 0, to = 20, length.out = 1000), + group = rbinom(1000, 1, 0.5) +) %>% + mutate( + y = 3 + x * 0.5 + group * 5 + (group + 1) * x * -0.4, + y_rand = y + rnorm(n()) + ) %>% + ggplot(aes(x = x, y = y, group = group)) + + geom_point(aes(y = y_rand)) + + geom_line(size = 2, color = "blue") + + theme_bw(base_size = 22) + + ylim(c(0, 20)) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent') + ) +ggsave(filename = "img/lm_2_groups_b0_b0_3_b1_05_interaction.png", bg='transparent', width = 12, height = 6) + +tibble( + x = seq(from = 0, to = 20, length.out = 1000), + group = rbinom(1000, 1, 0.5), + time = as.factor(c(rep(1, 250), rep(2, 250), rep(3, 250), rep(4, 250))) +) %>% + mutate( + y = 3 + x * 0.5 + group * 5 + (group + 1) * x * -0.4, + y_rand = y + rnorm(n()) + ) %>% + ggplot(aes(x = x, y = y, group = group, color = time)) + + geom_point(aes(y = y_rand)) + + geom_line(size = 2, color = "blue") + + theme_bw(base_size = 22) + + ylim(c(0, 20)) + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent') + ) +ggsave(filename = "img/lm_2_groups_2_factors_b0_b0_3_b1_05_interaction.png", bg='transparent', width = 12, height = 6) + + +tibble( + x = rep(1:20, 2), +) %>% + mutate( + pNB = dnbinom(x, mu = 1, size = 10) + dnbinom(x, mu = 5, size = 10) + ) %>% + ggplot(aes(x = x, y = pNB)) + + geom_point(size = 6) + + geom_col(width = 0.2, position = "dodge") + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent'), + legend.position = "none" + ) +ggsave(file = paste0("img/ziNB_1.pdf"), width = 16, height = 9) + +tibble( + x = rep(1:20, 2), + group = c(rep(0, 20), rep(1, 20)) +) %>% + mutate( + pNB = dnbinom(x, mu = 1 + 4 * group, size = 10) + ) %>% + ggplot(aes(x = x, y = pNB, color = as.factor(group))) + + geom_point(size = 6) + + geom_col(width = 0.2, position = "dodge") + + theme( + panel.background = element_rect(fill='transparent'), + plot.background = element_rect(fill='transparent', color=NA), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), + legend.background = element_rect(fill='transparent'), + legend.box.background = element_rect(fill='transparent'), + legend.position = "none" + ) +ggsave(file = paste0("img/ziNB_2.pdf"), width = 16, height = 9)