Why Estimate Size Factors?
RNA-seq count matrices record the number of reads assigned to each gene in each sample. Counts can differ between samples partly because their sequencing depths or other sample-wide technical exposures differ. Before comparing expression across samples, we need a relative scaling factor for each sample. The median-ratio method estimates these factors from the pattern across genes rather than using each sample’s total count alone.
The factors are relative: they do not reveal an absolute amount of RNA per cell. Their interpretation depends on an assumption about the distribution of gene-expression changes across the genes used to estimate them. If that assumption fails, a calculated factor may remove a real, broad biological shift along with technical scaling.
Definition and Calculation
Let \(K_{ij}\) be the observed count for gene \(i\) in sample \(j\), with \(G\) genes and \(m\) samples. For the basic calculation below, assume every gene included has a positive count in every sample. First compute a geometric-mean reference for each gene. Then divide each sample’s count for that gene by the reference. A sample’s raw size factor is the median of its gene-wise ratios.
A gene’s geometric mean is a reference across samples, not a control sample or a biological “normal” level. Dividing by it expresses each sample’s count for that gene relative to the gene’s across-sample center. Taking the median across genes gives a robust summary of the typical relative scaling for each sample. The final centering changes all factors by the same constant; it does not change their ratios or the relative normalization.
The method’s multiplicative interpretation is clearest under a count model in which the expected count for gene \(i\) in sample \(j\) is proportional to a sample-wide factor \(s_j\) times a gene-specific expression level. In shorthand, \(E(K_{ij})=s_j q_{ij}\), where \(q_{ij}\) represents the underlying expression level on the scale of the experiment. The factors estimate relative sample-wide scaling; they are not estimates of the \(q_{ij}\).
Why the Geometric-Mean Reference Works
Suppose a gene’s underlying expression is unchanged across samples, so that \(q_{ij}=q_i\) for every \(j\). Ignoring count sampling variation for a moment, its count is proportional to \(s_jq_i\). The gene’s geometric mean is then proportional to \(q_i\) times the geometric mean of the sample factors. Its ratio in sample \(j\) is therefore proportional to \(s_j\) divided by the geometric mean of the factors. The gene-specific expression level cancels.
Thus, unchanged genes all point to the same relative sample scaling in the idealized model. With observed counts, their ratios vary because counts are noisy, and genes may genuinely change. The median can still estimate the typical scaling when enough genes provide a stable reference—for example, when most genes are unchanged, or when increases and decreases are sufficiently balanced that the median gene-wise change is near zero on the log scale.
This is an assumption about the collection of genes used for estimation, not a guarantee supplied by the formula. The method also assumes that the dominant sample differences can reasonably be represented by one multiplicative factor per sample. It cannot correct a sample-specific bias that affects different genes by unrelated amounts.
Worked Example: Calculating Factors for Three Samples
Consider this hypothetical count matrix. All entries are positive, so every gene has a geometric-mean reference for the basic method.
| Gene | Sample 1 | Sample 2 | Sample 3 |
|---|---|---|---|
| A | 100 | 200 | 100 |
| B | 80 | 160 | 80 |
| C | 60 | 120 | 60 |
| D | 40 | 80 | 40 |
| E | 20 | 40 | 20 |
For gene A, the reference is
Its ratios are \(100/125.99\approx0.7937\), \(200/125.99\approx1.5874\), and \(100/125.99\approx0.7937\). Each other gene has the same pattern: its counts are in the proportions \(1:2:1\), so its ratios are also approximately \(0.7937, 1.5874, 0.7937\). The medians across the five genes are therefore \(\tilde{s}_1=0.7937\), \(\tilde{s}_2=1.5874\), and \(\tilde{s}_3=0.7937\).
Their geometric mean is \((0.7937\times1.5874\times0.7937)^{1/3}\approx1\), so the centered factors are approximately \(s_1=0.7937\), \(s_2=1.5874\), and \(s_3=0.7937\). Sample 2’s factor is twice either other factor. Dividing counts by these factors puts the samples on a common relative scale; it does not change the original counts or identify absolute RNA abundance.
Assumptions and a Short Justification
The idealized calculation above can be made more explicit by taking logs. Under the multiplicative mean model, the log of a gene’s count ratio is approximately the log sample factor, centered across samples, plus a centered gene-specific expression term:
If most genes have no expression change, the second term is zero for those genes. Their log-ratios share the same sample-specific value, so the median across genes recovers that value in the idealized setting. If instead the gene-specific centered terms have a distribution whose median is near zero for each sample, the median still targets the centered log factor approximately. Exponentiating returns relative factors. Count variation and finite numbers of genes make these estimates imperfect, which is why the result is an estimate rather than an exact recovery.
The reasoning relies on a suitable reference set of genes. If most genes shift in the same direction by a similar amount, their ratios will make that biological shift look like a sample-wide scaling difference. No calculation from the count matrix alone can distinguish that global biological shift from technical exposure without additional information or assumptions.
Worked Example: A Minority of Changed Genes
Suppose two hypothetical samples have counts as follows: genes A–D have counts \(100,80,60,40\) in Sample 1 and \(200,160,120,80\) in Sample 2; gene E has counts \(30\) and \(30\). All counts are positive. For each of A–D, the geometric mean is the square root of the product of the two counts, so the ratios are \(1/\sqrt{2}\approx0.7071\) in Sample 1 and \(\sqrt{2}\approx1.4142\) in Sample 2. For gene E, both ratios are 1.
The medians of the five ratios are \(0.7071\) and \(1.4142\), respectively. Their geometric mean is 1, so these are also the centered size factors. Four genes support a twofold sample-wide scaling difference, while the fifth does not. Under the stated assumption that most genes provide an appropriate reference, the factors estimate the typical scaling rather than being pulled to the library-total ratio.
Indeed, the total counts are 310 and 590, whose ratio is \(590/310\approx1.903\), not 2. After dividing gene E’s counts by the size factors, its normalized values are \(30/0.7071\approx42.43\) and \(30/1.4142\approx21.21\). This remaining difference is consistent with gene E being lower in Sample 2 relative to the typical genes; the normalization has not forced every gene to match.
Diagnostics, Alternatives, and Limitations
Before using the factors, inspect whether their pattern is plausible and whether the calculation had a suitable reference. Factors that are extreme, highly sensitive to which genes are included, or inconsistent with known sample-processing information deserve investigation. A broad sample difference in ratios can signal a genuine global shift as readily as a technical exposure difference. Inspecting the factors cannot by itself decide which explanation is correct; experimental knowledge matters.
The basic formula also has a specific zero-count limitation: if a gene has a zero in any sample, its ordinary geometric mean is zero and its ratios are undefined. Do not silently add an arbitrary pseudocount and treat the resulting factors as the same estimator. Implementations may define alternative ways to form references when zeros occur, but those choices change the calculation and should be made explicitly.
| Approach | What it summarizes | Main caution |
|---|---|---|
| Total library-size scaling | The total count in each sample | Can be distorted when a small number of highly abundant genes or broad composition changes dominate totals. |
| Median-ratio factors | The median of gene-wise ratios to geometric-mean references | Needs a suitable majority or balanced reference among the genes used. |
| TMM factors | A different relative-scaling approach based on trimmed comparisons between samples | It has its own choices and assumptions; it is an alternative, not a guarantee against every composition problem. |
Unlike total library-size scaling, the median-ratio method does not let a few very large counts directly determine the factor, because it takes a median across genes. It is still a relative normalization method, not a cure for confounding, batch effects, gene-specific technical bias, or an invalid reference distribution. Factors should be interpreted in the context of the experiment and used consistently as sample offsets or divisors in subsequent analyses.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- For a gene with counts 25 and 100 in two samples, calculate its geometric-mean reference and its two ratios.
- Why are the size factors centered to have geometric mean 1? Does centering change the ratio of two factors?
- In a hypothetical two-sample matrix, most genes have twice as many counts in Sample 2. What assumption would support interpreting that pattern as a scaling difference, and what alternative explanation remains possible?
- Why can total library-size scaling and median-ratio scaling give different relative factors?
- What happens to the basic geometric-mean ratio for a gene that has a zero count in one sample?
Solutions. (1) The reference is \((25\times100)^{1/2}=50\). The ratios are \(25/50=0.5\) and \(100/50=2\). (2) Centering fixes an arbitrary common scale so the factors are comparable around 1; dividing every raw factor by the same constant leaves every pairwise ratio unchanged. (3) The pattern can represent technical scaling if most genes are unchanged in underlying expression, or if their changes are balanced around a stable center. A broad biological increase in Sample 2 could produce the same pattern and cannot be separated from technical scaling using the counts alone. (4) Library-size scaling uses each sample’s total, which may be affected by a few abundant genes or composition differences; median-ratio scaling summarizes gene-wise ratios by their median. (5) The gene’s geometric mean becomes zero, so division by that reference is undefined. The basic method therefore cannot use that gene’s ratio without an explicitly defined alternative.