3
$\begingroup$

I read this paper "voom: precision weights unlock linear model analysis tools for RNA-seq read counts", in the methods, the "Delta rule for log-cpm" section:

The RNA-seq data consist of a matrix of read counts $r_{gi}$, for RNA samples $i=1$ to $n$, and genes $g=1$ to $G$. Write $R_i$ for the total number of mapped reads for sample $i$: $$R_i=\sum_{g=1}^{G}r_{gi}$$ They define the log-counts per million (log-cpm) value for each count as: $$y_{gi}=\log_2\left(\frac{r_{gi}+0.5}{R_i+1}\times 10^6\right)$$

Write $\lambda=E(r)$ for the expected value of a read count given the experimental conditions, and suppose that: $$\text{Var}(r)=\lambda+\phi\lambda^2$$ If $r$ is large, then the log-cpm value of the observation is: $$y\approx\log_2(r)-\log_2(R)+6\log_2(10)$$ where $R$ is the library size. The analysis is conditional on $R$, so $R$ is treated as a constant. It follows that $\text{Var}(y)\approx \text{Var}(\log_2 r)$. If $\lambda$ also is large, then: $$(\log_2 r)(\ln 2)\approx \ln r \approx \ln\lambda+\frac{r-\lambda}{\lambda}$$ so $$\text{Var}(y)(\ln 2)^2\approx\frac{\text{Var}(r)}{\lambda^2}=\frac{1}{\lambda}+\phi$$ How should I deduce the last 2 equations?

$\endgroup$
4
  • 1
    $\begingroup$ There are a couple of "log 2" factors in the last 2 displays (one with subscripted 2) that I think you meant to represent the natural log of 2. It might be easier to read this if you explicitly wrote ln for the natural log where that's intended. $\endgroup$
    – EdM
    Commented Feb 16, 2023 at 21:59
  • $\begingroup$ Yes you are right, it seems the author changed the online version recently. I updated these equations. Thanks $\endgroup$
    – Dan Li
    Commented Feb 16, 2023 at 22:04
  • 1
    $\begingroup$ I suspect this is a case where someone did some math and didn't pay attention to the numerical implications of the result. Let's look at the first of your equations; assume $\lambda = 100$ ("large") and $r \approx \lambda$. Then $\lambda + (r-\lambda)/\lambda \approx \lambda$ and $\log_2(r) \approx \log_2(\lambda)$, so we have $\log_2(100) \approx 100$. Making $\lambda$ larger won't help. Even if we make $r =$, say, $2\lambda$ or $\lambda/2$, we don't get anything like "approximately equal to". $\endgroup$
    – jbowman
    Commented Feb 17, 2023 at 2:55
  • $\begingroup$ There is an updated version and these equations had been corrected. statsci.org/smyth/pubs/VoomPreprint.pdf I updated my question to the updated equations. $\endgroup$
    – Dan Li
    Commented Feb 17, 2023 at 15:19

2 Answers 2

3
$\begingroup$

With the corrected version of the equations, this follows from a standard approximation to the variance of a natural log of a random variable, given the variance of the random variable. See this page, along with its warnings about when this approximation might get you into trouble.

Work first with the natural log of $r$. The Taylor expansion of $\ln r$ about the mean value $\lambda$ for $r$ is:

$$ \ln r \approx \ln \lambda + \frac{(r-\lambda)}{\lambda} - \frac{(r-\lambda)^2}{2\lambda^2}+\dots,$$

based on the first and second derivatives of the natural log function at $r=\lambda$. The terms after the first two are assumed to become small with large $\lambda$.

Then continue by taking the expectations of both sides. As $\lambda$ is the mean of $r$, the expectation of the second term is 0, leaving:

$$E[\ln r] \approx \ln E[r].$$

Now, working with the first two terms of the Taylor expansion, take the variance of both sides, the expected value of squared deviations from the mean:

$$\text{Var}(\ln r) \approx E\left[\left(\ln \lambda + \frac{(r-\lambda)}{\lambda} - \ln E[r]\right)^2\right]$$

$E[r]$ is $\lambda$, so the first and third terms within the parentheses on the right cancel, leaving:

$$\text{Var}(\ln r)\approx E\left[ \left(\frac{(r-\lambda)}{\lambda} \right)^2\right]=\frac{\text{Var }r}{\lambda^2}.$$

Given the assumed form for the variance of $r$, the rightmost part of the last display immediately follows. The $\ln 2$ factors translate between the natural log and the $\log_2$ scales.

$\endgroup$
2
$\begingroup$

Based on Taylor expansions for the moments of functions of random variables $$ \begin{align} \log X & = \log (\mu_X+X-\mu_X) \\ &\approx \log (\mu_X)+ \log' (\mu_X)(X-\mu_X)+\frac{1}{2}\log''(\mu_X)(X-\mu_X)^2 \\ &\approx\log (E(X))+\frac{X-E(X)}{E(X)} \end{align} $$ so take expectations and variances on both sides,

$$E(\log X)\approx\log (E(X))$$ $$\text{Var}(\log X)\approx E\left[\frac{X-E(X)}{E(X)}\right]^2=\frac{\text{Var}(X)}{(E(X))^2}$$ So

$$E[\log r]\approx\log (\lambda)+\frac{r-\lambda}{\lambda} $$

$$\text{Var}[\log r]\approx\frac{\text{Var}(r)}{\lambda^2} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.