Tutorials › Multi-Omics Data Integration › Choosing the Order of Transformation, Scaling, and Batch Adjustment

Preprocessing, Scaling and Block Weighting · Tutorial 55 of 597

Choosing the Order of Transformation, Scaling, and Batch Adjustment

Learn how to choose and justify an order for transforming, scaling, and adjusting multi-omics features, while checking what each sequence does to the resulting matrices.

Intermediate 11 min read

What You'll Learn

  • Define transformation, feature scaling, and additive batch adjustment as operations on a sample-by-feature matrix.
  • Identify why nonlinear transformations generally do not commute with batch adjustment.
  • Derive how global standardization and additive batch correction can produce different scales.
  • Calculate and compare outputs from two alternative preprocessing sequences.
  • Check assumptions, biological preservation, and matrix diagnostics before choosing an order.
  • Recognize when confounding or invalid transformed values make a preprocessing sequence unsuitable.

Why the Order Matters

A multi-omics block may contain features with skewed distributions, different units, and systematic technical variation across batches. Transformation, scaling, and batch adjustment address different aspects of that problem. But they are operations on the same measurements: changing their order can change the values, variances, and relationships that an integration method receives.

There is no universally correct sequence. The choice depends on the measurement scale, the proposed transformation, the batch-effect model, and the scientific contrasts that must be retained. The goal is not simply to make all processed features look similar. It is to obtain a matrix whose values are suitable for the planned analysis without removing meaningful biological variation.

Definition: Let \(X\) be an \(n \times p\) matrix, with samples in rows and features in columns. A transformation applies a function to feature values, often to reduce skew or make a variance pattern more suitable for modeling. Feature scaling changes each feature's location or scale, for example by subtracting its mean and dividing by its standard deviation. Batch adjustment estimates and removes a specified technical batch contribution while aiming to retain modeled biological covariates. The order of operations is the sequence in which these maps are applied to \(X\).

For a simple additive adjustment, suppose sample \(i\) belongs to batch \(b(i)\). For feature \(j\), one possible batch-mean adjustment is \(B(X)_{ij}=X_{ij}-\bar{X}_{b(i),j}+\bar{X}_{\cdot j}\), where \(\bar{X}_{b,j}\) is the mean in batch \(b\) and \(\bar{X}_{\cdot j}\) is the overall mean. This illustrative operation removes batch-specific mean differences and retains the overall feature mean. It assumes the batch effect is additive on the scale of the values being adjusted. Covariate-preserving linear batch adjustment and ComBat use more structured models, but the order question remains: the model is fitted to whichever scale it receives.

When batch effects are multiplicative on the original scale, a logarithmic transformation can sometimes express them more nearly as additive shifts. Conversely, additive adjustment on the original scale may be inappropriate for a feature whose technical variation grows with its mean. These are modeling considerations, not merely computational preferences. The earlier material on additive and multiplicative models of technical batch effects and covariate-preserving linear batch adjustment provides the relevant batch-model context.

Which Operations Commute?

Two operations commute if applying them in either order gives the same result. In general, a nonlinear transformation and batch adjustment do not commute. The batch means on the original scale are not generally transformed batch means, and subtracting a shift before applying a nonlinear function is not equivalent to subtracting a shift afterward.

Some affine operations have special relationships. Under the batch-mean adjustment above, applying the same constant shift and multiplier to every value of one feature before adjustment gives the correspondingly shifted and multiplied adjusted values. In symbols, for featurewise constants \(a_j\) and \(c_j\), \(B(a_jX+c_j)=a_jB(X)+c_j\). This equivariance does not mean that estimating a scale from the corrected data gives the same standardized values as estimating it before correction.

To see the distinction, let \(s_X\) denote the sample standard deviation of a feature before adjustment and \(s_B\) its sample standard deviation after adjustment. If standardization uses the feature's global mean and standard deviation, standardize first and then adjust gives residual deviations divided by \(s_X\). Adjust first and then standardize gives those deviations divided by \(s_B\). These generally differ because batch adjustment can remove between-batch variation, changing the standard deviation. If scale constants are fixed externally and held constant in both sequences, this particular difference need not occur.

$$ B\left(\frac{X-\bar{X}_{\cdot}}{s_X}\right) =\frac{X-\bar{X}_{b(i)}}{s_X}, \qquad \frac{B(X)-\overline{B(X)}_{\cdot}}{s_B} =\frac{X-\bar{X}_{b(i)}}{s_B} $$

Here the displayed expressions are for one feature, with batch means and overall means computed for that feature. They show why the order can change the final scale even when both sequences remove the same batch mean contrast. With a nonlinear transform, the difference can extend beyond a common rescaling: feature values, means, residual patterns, and even which values are defined may change.

Worked Example: Transforming Before Additive Batch Adjustment

Consider one hypothetical feature measured in four samples. Its original values are \(1,3,7,9\); the first two samples are in batch A and the last two in batch B. Suppose a log transformation \(T(x)=\log_2(x+1)\) is appropriate for these nonnegative values. Compare its transformed values with additive batch adjustment on that transformed scale.

Check the transformation's domain. All four observations are nonnegative, so \(x+1>0\) for every sample and the logarithm is defined. The transformed values, rounded to four decimal places, are \(1,2,3,3.3219\).

Calculate the batch and overall means. On the transformed scale, the batch means are \((1+2)/2=1.5\) for batch A and \((3+3.3219)/2=3.1610\) for batch B. The overall mean is \((1+2+3+3.3219)/4=2.330475\), which rounds to \(2.3305\).

Adjust each value. Subtract its batch mean and add the overall mean. For batch A, the adjusted values are \(1-1.5+2.3305=1.8305\) and \(2-1.5+2.3305=2.8305\). For batch B, they are \(3-3.1610+2.3305=2.1695\) and \(3.3219-3.1610+2.3305=2.4914\).

The adjusted values still have the original overall transformed mean, up to rounding, while the two batches now have equal means. This calculation establishes what this particular additive adjustment does; it does not show that it is an adequate model for every feature or that transforming first is always preferable. In particular, adjustment after transformation assumes that the relevant batch effect can be treated as additive on the log scale.

Scaling Before or After Batch Adjustment

Global scaling is often used so features measured in different units do not dominate an analysis solely because of their numerical scale. Scaling before batch adjustment expresses batch differences in units of the original feature's standard deviation. Scaling afterward expresses the corrected residual variation in units of the post-adjustment standard deviation. Those are different reference scales whenever adjustment changes variance.

Worked Example: Standardizing Before Versus After Adjustment

Suppose one hypothetical feature has values \(0,2,8,10\), with the first two samples in batch A and the last two in batch B. Use sample standard deviations, so the denominator in the variance is \(n-1\). Compare global standardization followed by batch adjustment with batch adjustment followed by global standardization.

Standardize first. The raw mean is \((0+2+8+10)/4=5\). The sample standard deviation is \(s_X=\sqrt{(25+9+9+25)/3}=\sqrt{68/3}=4.761\), to three decimal places. Thus the standardized values are approximately \((-1.050,-0.630,0.630,1.050)\).

The standardized batch means are \((-1.050-0.630)/2=-0.840\) and \((0.630+1.050)/2=0.840\). Subtracting each batch mean and adding the overall standardized mean, which is zero, gives \((-0.210,0.210,-0.210,0.210)\).

Adjust first, then standardize. The raw batch means are \(1\) and \(9\), and the overall mean is \(5\). Additive adjustment gives \((0-1+5,\;2-1+5,\;8-9+5,\;10-9+5)=(4,6,4,6)\). The adjusted mean is \(5\), and its sample standard deviation is \(\sqrt{(1+1+1+1)/3}=1.155\). Standardizing the adjusted values therefore gives approximately \((-0.866,0.866,-0.866,0.866)\).

Both sequences remove the batch mean difference, but they do not give the same standardized matrix. Standardizing first uses the pre-adjustment standard deviation; standardizing last uses the smaller post-adjustment standard deviation. The example also shows that standardization does not guarantee a feature has unit variance after a subsequent adjustment.

Justification: For this example, adjustment leaves within-batch deviations unchanged but removes the separation between batch means. The raw centered values have squared deviations summing to \(68\); the adjusted centered values have squared deviations summing to \(4\). Since both standard deviations divide by the same \(n-1=3\), the adjusted feature has a smaller standard deviation. Dividing by these different standard deviations therefore yields different standardized residuals.

Assumptions and a Practical Order-of-Operations Check

A sequence should be chosen only after stating what each operation assumes. A transformation must be defined for the observations and appropriate to their measurement scale; a log with a pseudocount, for example, requires that the offset and units be specified. Scaling requires a meaningful estimate of location and scale, and a feature with zero variance cannot be standardized by division by its standard deviation. Batch adjustment requires identifiable batch effects: if batch and a biological variable are perfectly confounded, their separate contributions cannot be estimated from these data alone.

For mean-based additive adjustment, the assumed batch effect is a feature-specific shift on the chosen scale. If the effect is multiplicative, varies with the mean, or differs across biological groups, that model may not describe it adequately. When covariate-preserving adjustment is used, its covariates need to be included appropriately and the design must contain enough overlap to distinguish their effects from batch. No choice of preprocessing order can resolve a lack of identifiability.

1
Specify the measurement scale.
Record the domain, units, and expected mean-variance relationship for each block. Decide whether a transformation is justified and verify that every transformed value is defined.
2
State the batch model on that scale.
Decide whether the adjustment assumes additive or multiplicative effects, identify covariates to preserve, and assess whether batch is separable from biology in the sample design.
3
Choose the scale reference.
Specify whether scaling constants are estimated before or after adjustment, or fixed externally. This determines which variation defines a standardized unit.
4
Compare candidate matrices.
Check dimensions, feature and sample alignment, missing or non-finite values, feature means and spreads, batch patterns, and preservation of the biological contrasts targeted by the analysis.
5
Document and test sensitivity.
Keep the sequence and parameters explicit. If more than one sequence is defensible, compare downstream results and report findings that depend materially on the choice.

The resulting matrices should be evaluated in context, not by one summary alone. Feature distributions before and after correction, batch patterns, and PCA diagnostics can reveal problems, but no single plot establishes that a sequence is correct. A batch separation that remains may reflect residual technical structure or genuine biological imbalance; disappearance of batch separation does not prove that biology was preserved. The earlier material on comparing feature distributions before and after correction and detecting overcorrection gives complementary diagnostic perspectives.

Comparing Plausible Strategies

SequenceWhat it can be useful forKey caution
Transform, then adjust, then scaleOften appropriate when the transformation makes technical effects more nearly additive or stabilizes the variance before adjustment.The batch model must be plausible on the transformed scale; scaling uses post-adjustment variation.
Transform, then scale, then adjustExpresses batch differences in pre-adjustment standardized units, which may be useful when relative feature scales are the intended reference.Adjustment can change variances, so the final features need not retain unit variance; standardization does not fix a misspecified batch model.
Adjust, then transformMay be considered when the adjustment model is justified on the original scale and corrected values remain in the transformation's domain.Additive correction can create zero or negative values, making a later logarithm undefined or requiring a scientifically defensible offset.
Adjust, then scale, without a nonlinear transformCan suit features already on a suitable scale when corrected residual variation should set the scale.Scaling afterward cannot repair nonlinearity, skew, or an inappropriate additive batch model.

These are not interchangeable recipes. In many settings, transformation before batch modeling is a defensible starting point because it can make variance more stable or multiplicative effects more nearly additive. But if the measurement scale and technical model support adjustment before transformation, that order may be reasonable too. The analysis plan should state why the chosen order matches those assumptions. Scaling is often placed after correction when the intention is to scale the remaining biological and residual variation; scaling before correction is defensible when pre-correction feature variability is the desired reference. The choice should be interpreted consistently with the later integration method.

Common Pitfalls and Limitations

  • Assuming the steps commute. Nonlinear transformations generally do not commute with additive correction, and global standardization before and after adjustment generally uses different standard deviations.
  • Applying an operation outside its domain. An additive correction can create nonpositive values. Applying a logarithm afterward without checking the corrected values can produce undefined results.
  • Treating a visually improved batch plot as proof. Batch separation can be confounded with biological composition. Reducing it indiscriminately can erase a real biological contrast; retaining it can also leave technical structure.
  • Confusing unit variance with comparability. Equal variances after scaling do not guarantee equal reliability, noise, or biological relevance across features or omics blocks.
  • Trying to fix complete confounding by reordering. If every sample in one biological group is in one batch and every sample in another group is in a different batch, the separate effects are not identified by the observed design.
  • Changing the scale without recording it. The order, transformation parameters, scaling reference, and adjustment model are part of the analysis and must be reproducible.

A limitation of any order comparison is that diagnostics cannot identify the correct sequence without scientific and design information. Different sequences may produce similar summaries while altering individual features or downstream relationships. Sensitivity analysis helps reveal dependence on choices, but it does not replace assumptions about measurement and batch assignment.

Key takeaway: Choose the order by matching the transformation, batch model, and scaling reference to the measurement process and scientific target. Then compare the resulting matrices and check both technical correction and biological preservation; no sequence is justified solely because its output looks more uniform.

Check Your Understanding

Answer each question, then compare your reasoning with the brief solutions.

  1. A feature has positive, strongly right-skewed values and a plausible multiplicative batch effect. Why might transforming before additive batch adjustment be reasonable, and what assumption still needs checking?
  2. In the worked standardization example, why did scaling after adjustment give different values from scaling before adjustment?
  3. An additive correction produces a value of \(-0.2\) for one sample. What must be checked before applying a logarithm to the corrected matrix?
  4. Batch A contains only controls and batch B contains only treated samples. Can changing the preprocessing order identify separate treatment and batch effects? Explain.

Solutions. (1) A suitable transformation may stabilize variance and make multiplicative effects more nearly additive, but the additive model and covariate structure must be plausible on the transformed scale. (2) Adjustment reduced the feature's sample standard deviation from \(4.761\) to \(1.155\); the two sequences divide residual deviations by different scale estimates. (3) Check the transformation's domain for every corrected value and justify any offset scientifically; \(\log(-0.2)\) is not defined on the real scale. (4) No. Treatment and batch are perfectly confounded, so their separate contributions are not identifiable from these observations; reordering cannot supply the missing design overlap.

Clinical Biostats