Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Comparing Median-Ratio and TMM Factors with Diagnostic Plots

Normalization of Sparse Counts · Tutorial 85 of 700

Comparing Median-Ratio and TMM Factors with Diagnostic Plots

You will learn to center and compare median-ratio and TMM factors, read diagnostic plots and summaries, and decide when method disagreement calls for further investigation.

Intermediate 11 min read

What You'll Learn

  • Geometrically center factor vectors before comparing their sample-specific values.
  • Interpret a factor scatterplot relative to the line of equality.
  • Calculate per-sample TMM-to-median-ratio factor ratios and log differences.
  • Use sample-wise summaries without letting a single correlation conceal disagreement.
  • Recognize when preprocessing, zeros, or a few influential samples may explain a discrepancy.
  • Separate diagnostic evidence from conclusions about which normalization is correct.

Why Compare the Factors?

Median-ratio and TMM normalization estimate sample-specific factors that account for differences in the scale of observed counts. They use different summaries of cross-sample gene information, so their factor estimates need not match exactly. Comparing the estimates is useful as a diagnostic: a close match suggests that the two procedures give similar relative scaling for the samples, while a sample-specific discrepancy is a reason to inspect the data and the analysis settings.

A factor comparison is not a test that establishes which method is correct. Both methods use information from the observed genes, and neither factor vector is a direct measurement of the total RNA in a cell. The goal here is narrower: to identify how much the methods differ across samples, determine whether the difference is merely an arbitrary overall scale, and describe which samples account for any remaining discrepancy.

Definition: Let \(f_i^{MR}\) and \(f_i^{TMM}\) be the positive size factors for sample \(i\) from the median-ratio and TMM methods, respectively. For a set of \(n\) samples, the geometrically centered factor for method \(m\) is \[ f_{i,c}^{m}=\frac{f_i^{m}}{\left(\prod_{j=1}^{n} f_j^{m}\right)^{1/n}}, \] where \(m\) is \(MR\) or \(TMM\). The centered factors have geometric mean one. Their ratio \(R_i=f_{i,c}^{TMM}/f_{i,c}^{MR}\) measures the sample-specific difference between methods after removing each method’s overall scale.

Centering matters because size-factor vectors are generally meaningful only up to a common positive multiplier: multiplying every factor in one vector by the same constant does not change its relative pattern across samples. Some software already centers factors, while other implementations may report a differently scaled vector. Confirm that both methods use the same samples, the same factor orientation, and compatible preprocessing before comparing them. In particular, a larger factor must have the same interpretation in both outputs; some software reports a reciprocal or an offset rather than the factor itself.

Plots and Summaries for Comparing Factors

A direct diagnostic is a scatterplot with \(f_{i,c}^{MR}\) on the horizontal axis and \(f_{i,c}^{TMM}\) on the vertical axis. Add the reference line \(y=x\). Points near that line indicate similar centered factors for those samples. A point above the line has a larger centered TMM factor; a point below it has a smaller one. Label points by sample, or use color or shape for prespecified sample groups, so that a discrepancy can be traced back to its sample.

The factor scale is multiplicative. A log-scale plot is often easier to read when factors span a wide range. On that scale, the line of equality still represents agreement, and the vertical difference for sample \(i\) is \(\log(f_{i,c}^{TMM})-\log(f_{i,c}^{MR})=\log(R_i)\). A factor ratio greater than one means that TMM assigns a larger centered factor than median-ratio for that sample; a ratio less than one means it assigns a smaller one. This comparison alone does not say that the sample has more biological expression.

Useful sample-wise summaries include the factor ratio \(R_i\), its log \(d_i=\log(R_i)\), the median of \(|d_i|\), and the maximum of \(|d_i|\). The log difference treats reciprocal discrepancies symmetrically: ratios of \(2\) and \(1/2\) have log differences of equal magnitude and opposite sign. A table of these summaries, with sample labels and relevant sample metadata, can reveal whether disagreement is concentrated in one sample or follows a broader pattern.

Correlation between the two factor vectors is a secondary summary, not a substitute for these diagnostics. If one centered vector is a constant multiple of the other before centering, their correlation can be perfect even though the uncentered values differ. Conversely, a high correlation after centering can coexist with an important discrepancy for one sample. The plot and per-sample differences show where that discrepancy occurs.

Worked Example: Removing a Common Multiplier

Suppose three hypothetical samples have median-ratio factors \((0.8,1.0,1.25)\) and TMM factors \((0.4,0.5,0.625)\). The raw TMM factors are one-half of the median-ratio factors for every sample. Is there a sample-specific disagreement?

First, the median-ratio geometric mean is \(\left(0.8\times1.0\times1.25\right)^{1/3}=1\), so its centered vector remains \((0.8,1.0,1.25)\). The TMM geometric mean is \(\left(0.4\times0.5\times0.625\right)^{1/3}=(0.125)^{1/3}=0.5\). Its centered vector is therefore \((0.4/0.5,\,0.5/0.5,\,0.625/0.5)=(0.8,1.0,1.25)\).

The centered vectors match exactly, so \(R_i=1\) for each sample and \(d_i=0\). The raw factors differed by a common multiplier, not by a sample-specific pattern. A plot of the uncentered factors could obscure this distinction; the centered comparison answers the intended diagnostic question.

Deriving the Centered Comparison

The log scale gives a simple justification for geometric centering. For method \(m\), define the mean log factor across the samples as \(\bar{\ell}^{m}=n^{-1}\sum_{j=1}^{n}\log(f_j^{m})\). Taking logs of the centered factor gives \(\log(f_{i,c}^{m})=\log(f_i^{m})-\bar{\ell}^{m}\). Thus centering subtracts the same mean log factor from every sample in that method. The centered log factors have mean zero, equivalent to the centered factors having geometric mean one.

This also shows why centering removes arbitrary common scale. If a method’s reported factors are multiplied by a constant \(c>0\), each log factor increases by \(\log(c)\), and the mean log factor increases by the same amount. Their difference does not change: \[ \log(c f_i^{m})-\frac{1}{n}\sum_{j=1}^{n}\log(c f_j^{m}) =\log(f_i^{m})-\frac{1}{n}\sum_{j=1}^{n}\log(f_j^{m}). \] Consequently, the centered factor vector and its sample-wise comparison are invariant to that common rescaling.

For a pair of methods, subtracting their centered log factors yields \(d_i=\log(f_i^{TMM})-\log(f_i^{MR})-\left(\bar{\ell}^{TMM}-\bar{\ell}^{MR}\right)\). The final term is a constant shared across samples. The \(d_i\) values therefore describe relative, sample-specific disagreement after allowing each method its own overall scale. They sum to zero across samples, so a positive difference for some samples must be balanced by negative differences elsewhere, unless all differences are zero.

Worked Example: Locating Sample-Specific Disagreement

Suppose two methods give the following already geometrically centered factors for three hypothetical samples: median-ratio \((0.8,1.0,1.25)\) and TMM \((0.5,1.0,2.0)\). Both vectors have product one. Calculate the factor ratios and log differences, then interpret the largest discrepancy.

The ratios are \(R=(0.5/0.8,\,1.0/1.0,\,2.0/1.25)=(0.625,1.0,1.6)\). Taking natural logs gives \(d=(\log(0.625),\,\log(1),\,\log(1.6))\approx(-0.4700,0,0.4700)\). The median absolute log difference is \(0.4700\), and the maximum absolute log difference is also \(0.4700\).

For sample 1, TMM’s centered factor is \(0.625\) times the median-ratio factor; for sample 3, it is \(1.6\) times the median-ratio factor. Sample 2 agrees. The equal and opposite log differences are consistent with both vectors being centered. A scatterplot would show sample 1 below and sample 3 above the line of equality. This identifies where to investigate; it does not establish which factor is preferable.

Reading Patterns and Choosing What to Inspect

A useful comparison follows a reproducible sequence. First verify that factors refer to the same sample identities and have the same orientation. Then geometrically center each vector, plot one against the other with a line of equality, and calculate the sample-wise ratios or log differences. Finally, inspect the largest discrepancies alongside sample metadata and the count matrix. This process distinguishes a global scale mismatch from a disagreement tied to particular samples.

1
Check comparability.
Confirm that the same samples and input count data were used, and record choices such as gene filtering, reference selection, and zero handling. A mismatch in these settings can create differences that are not a meaningful comparison of the methods themselves.
2
Center and plot.
Geometrically center both positive factor vectors, plot them against each other, and include the line of equality. Label samples so outlying points can be followed up.
3
Summarize by sample.
Calculate \(R_i\) or \(d_i\), and report a typical discrepancy and the largest one. Examine whether the same samples are unusual in relevant quality summaries or experimental groups.
4
Investigate, do not automatically choose.
Check for low information, unusual count composition, or sensitivity to documented settings. A plot flags a pattern; it cannot on its own show which method better reflects the intended normalization target.

Worked Example: A Grouped Sample Pattern

Four hypothetical samples belong to two experimental groups, with samples A and B in group 1 and C and D in group 2. Their centered median-ratio factors are \((0.5,1.0,1.0,2.0)\), and their centered TMM factors are \((0.25,1.0,1.0,4.0)\). Calculate the factor ratios and explain the pattern.

The ratios are \(R=(0.25/0.5,\,1/1,\,1/1,\,4/2)=(0.5,1,1,2)\). Thus the log differences are approximately \((-0.6931,0,0,0.6931)\). The median absolute log difference is \((0+0.6931)/2=0.3466\), and the maximum absolute log difference is \(0.6931\).

The largest discrepancies occur for A and D, while B and C agree. If the pattern is shown in a plot colored by group, it should not be summarized simply as a difference between the two groups: one sample from each group has the largest discrepancy. The sample labels point to specific observations for follow-up. A group pattern, if present in a different data set, would also be a reason to examine the data and settings; it would not by itself prove a biological or technical cause.

Assumptions, Limitations, and Common Pitfalls

A meaningful comparison requires positive, finite factors for the same samples and a consistent factor convention. If a method returns a zero, missing value, or reciprocal factor, resolve that issue before taking logarithms. Also document the features and preprocessing used to produce each vector. Median-ratio estimation and TMM can respond differently to sparse genes, genes excluded from estimation, reference choices, and the trimming or zero-handling settings. Such choices may explain a discrepancy, but they do not make it automatically harmless or erroneous.

The comparison is descriptive, not an inferential test: there is no universal cutoff for how large \(|d_i|\) must be before a factor is concerning. Its practical importance depends on the data and downstream analysis. Nor can agreement demonstrate that either method has removed all unwanted scale variation. The factors are estimated from the observed data, and similar estimates can share limitations. These plots are best used with other data checks and a clearly stated normalization target.

  • Pitfall: comparing raw factors without centering. A learner sees every TMM factor half as large and concludes that TMM changes the relative scaling of every sample. Correction: remove each vector’s common scale by geometric-mean centering, then compare sample-wise values.
  • Pitfall: treating correlation as agreement. A high correlation is taken to mean that all samples have nearly identical factors. Correction: inspect the line-of-equality plot and ratios or log differences; correlation does not reveal the size and location of departures.
  • Pitfall: calling an outlying point proof that one method failed. The learner selects the method whose factor is closer to a preferred value. Correction: an outlier identifies a sample for investigation. Check comparability, data structure, and settings before drawing a conclusion.
  • Pitfall: interpreting a larger factor as higher expression. A sample’s factor is treated as a biological measurement. Correction: it is an estimated scaling quantity; the comparison concerns relative normalization factors, not gene expression itself.
Key takeaway: Center both factor vectors to geometric mean one, then assess agreement with a line-of-equality plot and sample-wise factor ratios or log differences. A common multiplier disappears on centering; remaining deviations identify samples and patterns worth investigating, not a verdict about which method is correct.

Check Your Understanding

Work through each question, then compare your reasoning with the solutions below.

  1. Two positive factor vectors are \((2,4)\) and \((20,40)\). What are their geometrically centered vectors, and do they show sample-specific disagreement?
  2. For one sample, the centered median-ratio factor is \(0.75\) and the centered TMM factor is \(1.20\). Calculate \(R_i\) and \(d_i\), and interpret their signs and magnitudes.
  3. Why can a high correlation between centered factor vectors fail to show whether the methods agree closely for every sample?
  4. A factor-comparison plot has one point well below the line of equality. What can be concluded, and what cannot be concluded from that point alone?

Solutions. (1) The geometric mean of \((2,4)\) is \(\sqrt{8}\), so its centered vector is \((2/\sqrt{8},4/\sqrt{8})=(1/\sqrt{2},\sqrt{2})\), approximately \((0.7071,1.414)\). The geometric mean of \((20,40)\) is \(\sqrt{800}=10\sqrt{8}\), giving \((20/(10\sqrt{8}),40/(10\sqrt{8}))=(1/\sqrt{2},\sqrt{2})\) as well. The centered vectors match, so there is no sample-specific disagreement. (2) \(R_i=1.20/0.75=1.6\), and \(d_i=\log(1.6)\approx0.4700\). TMM’s centered factor is 1.6 times the median-ratio factor for this sample, a positive log difference of about 0.4700. (3) Correlation summarizes linear association, not the size of each departure from the equality line; one or more samples can differ substantially even when the overall correlation is high. (4) The point indicates that the sample’s centered TMM factor is smaller than its centered median-ratio factor. It identifies a sample to check, but does not establish that either method is wrong or explain the source of the discrepancy.

Clinical Biostats