Last updated: 2020-03-04

Checks: 2 0

Knit directory: misc/

This reproducible R Markdown analysis was created with workflowr (version 1.6.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  analysis/methylation.Rmd
    Untracked:  code/Rplots.pdf
    Untracked:  code/sccytokines.R
    Untracked:  data/bart/
    Untracked:  data/cytokine/DE_controls_output_filter10.RData
    Untracked:  data/cytokine/DE_controls_output_filter10_addlimma.RData
    Untracked:  data/cytokine/test.RData
    Untracked:  data/cytokine_normalized.RData
    Untracked:  data/mout_high_alpha0.RData
    Untracked:  data/mout_high_alpha1.RData

Unstaged changes:
    Modified:   analysis/scdeMouthwash.Rmd
    Deleted:    data/mout_high.RData
    Modified:   data/sva_sva_high.RData

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
Rmd 7cb2741 DongyueXie 2020-03-04 wflow_publish(“analysis/binomialthinning.Rmd”)

Introduction

Investigate why effects with larger se are bigger.

Assume we have \(n\) samples and a fraction \(p\) of them belong to group 1 and the rest belong to group 2. So \(x = (1,1,1,...,1,0,0,0,...,0)^T\in R^n\) and \(\sum_ix_i=np\). Under this setting, in simple linear regression \(y = a+\beta x + \epsilon\), \(\epsilon\sim N(0,\sigma^2)\), the variance of \(\hat\beta_j\) is \(\hat s^2 = \frac{n\sigma^2}{n\sum_ix_i^2-(\sum_ix_i)^2}=\frac{\sigma^2}{np-np^2}\). For fixed \(n\) and \(p\), if \(\hat s\) is large, then this means \(\hat\sigma^2\) is large hence \(\sigma^2\) is large.

We now need to figure out the relationship between \(\beta\) and \(\sigma^2\).

Let’s assume we have RNA-Seq count data \(z_i\sim Poisson(\lambda)\) for \(i=1,2,...,n\). In binomial thinning, \(\beta\) is the log2 fold change between groups. Now assume \(\beta>0\), according to Gerard and Stephens(2017), the new(thinned) data vector is \(w_i\sim Poisson(\mu_i)\), where \(\mu_i=2^{-\beta(1-x_i)}\lambda\). The response \(y\) in the simple linear regression is the log transformation of \(w\), \(y_i=\log(w_i)\), \(i=1,2,...n\).

The Taylor series expansion of \(\log w_i\) around \(\mu_i\) is \(\log(w_i)\approx \log(\mu_i)+\frac{w_i-\mu_i}{\mu_i}\). So the mean of \(\log(w_i)\) is \(\log(\mu_i) = \lambda - \beta(1-x_i)\) and variance \(\frac{1}{\mu_i} = \frac{1}{2^{-\beta(1-x_i)}\lambda}\). So if \(\beta\) is large, then \(Var(\log(w_i))\) is large if \(x_i=0\). This explains the why effects with larger se are bigger.