From Raw Signal to Resolved Signal
Techniques:
Guidelines:
Modalities:
The one idea
A model compares numbers in columns. Before that comparison means anything, the same column has to mean the same chemistry in every sample, and a single peak has to be a single compound.
Remove nuisance variation without removing chemical information. A predictive model cannot tell a change in the measurement system from a change in the product unless the data and the experimental evidence allow it to.
Reading 1 introduced preprocessing for tables and spectra, reading 2 compared predictive models, and reading 3 showed why designed experiments matter. Here we return to the analytical measurement itself. A chromatogram is a time-ordered signal, not a collection of interchangeable predictors. It needs two more steps: alignment, so that column 1,402 is the same peak in every run, and resolution, so that one peak is one compound. This reading works through both, then shows that the resolution mathematics reaches as far as flow cytometry.
The case: stability profiles that will not line up

Product T’s stability study has 90 HPLC-DAD chromatograms from three column lots over 18 months. QA wants a PCA of the impurity profiles to see whether any time point drifts from the pattern. The first attempt clusters perfectly, by column lot. Retention times on lot 3 run about 4% later, so every peak sits in a different column of the data matrix. The PCA has found the column, not the chemistry. A high-quality statistical fit is not necessarily a useful analytical result: the model has found real variation, but not the variation it was meant to find.
The response is not to delete every source of variation that makes the scores plot inconvenient. First understand the measurement. Then decide which sources of variation should be corrected, which should be retained and which need an investigation.
| Operation | What changes? | What should be preserved? |
|---|---|---|
| Cleaning | Baseline or high-frequency noise | Real peak area, shape and small features |
| Alignment | The time coordinate of comparable features | Chemical identity and genuine differences |
| Resolution or unmixing | Estimated contributions to a composite measurement | Chemically defensible component information |
Physical separation and mathematical resolution are complementary. The chromatographic method creates differences in retention; a multivariate detector may add differences in spectral response. If the measurements do not distinguish the components, no algorithm can reliably recover their individual contributions without further assumptions or evidence.
Step 1: clean the signal
A gradient can produce a drifting baseline, detector noise can hide small peaks, and peak detection depends on the processing settings. These are the same tools as for spectra in reading 1, applied along the time axis.
| Operation | Principle | Risk if overapplied |
|---|---|---|
| Baseline correction | Estimate a slowly varying background, for example by asymmetric least squares (a smooth curve fitted mostly under the signal), and subtract it | Removing a broad chemical peak |
| Smoothing | Fit local polynomials (Savitzky–Golay) or otherwise attenuate noise | Changing peak height, width or area; merging nearby peaks |
| Peak detection | Local maxima above a noise threshold, or zero-crossings of the first derivative | Missing weak impurities or treating noise as peaks. Thresholds decide what a “peak” is, so they are method parameters |
A baseline correction is not a justification for deleting an unexplained signal. Choose parameters using representative blanks, standards, low-level impurities and stressed samples. Compare the processed result with the original trace, especially where a small peak sits next to the main API peak.
The controls should match the intended use. An exploratory fingerprinting workflow can tolerate processing choices that would need much more supporting evidence in an impurity quantitation or release procedure. Keep the original signal, and record the processing settings and software version.
Step 2: align the peaks

Retention time drifts with column age, column lot, mobile-phase preparation and temperature. A detector sampling at regular intervals produces columns indexed by time, so if the same compound elutes at two different times, comparing raw columns manufactures an apparent difference. Alignment corrects that coordinate mismatch.
Choose the least flexible correction that works
| Method | How it works | When to consider it |
|---|---|---|
| Relative retention time (RRT) | Divide retention time by a reference peak’s retention time | Approximately proportional shifts |
| Parametric time warping (PTW) | Fit a smooth, low-order polynomial transformation of the time axis | Global shifts, stretching or modest nonlinear drift1 |
| Correlation optimized warping (COW) | Stretch or compress segments to maximize correlation with a reference | Local changes in retention behaviour2,3 |
| Dynamic time warping (DTW) | Find a constrained point-by-point matching path through two ordered sequences | More complicated timing differences4,3 |
RRT is the entry point, and you have used it all term: a one-parameter alignment, a stretch anchored on one peak. Suppose a reference chromatogram has its API at 5.00 min and an impurity at 4.85 min. A second column elutes both 4% later: 5.20 and 5.044 min. In both cases the impurity’s RRT is 0.970, because the relative timing is unchanged. (This arithmetic example is separate from the Product T minor component below.) If early and late peaks shift by different proportions, RRT alone is not enough.
reference <- c(impurity = 4.85, api = 5.00)
lot3 <- reference * 1.04 # column lot 3 elutes 4% later
reference / reference["api"]
lot3 / lot3["api"]
# impurity = 0.97; api = 1.00 for both
PTW models the time axis of each sample as a low-order polynomial, usually quadratic, of the reference time axis, and finds the coefficients that best match the reference. Few parameters means the warp is smooth and hard to overfit.
library(ptw)
fit <- ptw(ref = reference_trace, # a representative chromatogram
samp = lot3_traces, # rows = chromatograms
init.coef = c(0, 1, 0), # start from "no warp": shift 0, stretch 1, curve 0
warp.type = "global") # one warp for all samples of this lot
aligned <- fit$warped.sample
fit$warp.coef # the warp itself, which you inspect
In a predictive workflow, reference selection and any learned alignment parameters belong inside the training procedure, as in reading 1’s recipe; assessment samples must not be used to tune them. A new sample is then mapped to the frozen reference by the predefined procedure.
COW and DTW, the latter borrowed from speech recognition, handle uneven drift that a polynomial cannot. Both are more flexible, which brings the danger below.
The danger: warping away a real difference
A stability-indicating procedure exists to reveal a peak that was not there before. If a flexible algorithm slides an unfamiliar shoulder onto a neighbouring known peak, the mathematical agreement improves while the chemical interpretation gets worse. Tomasi and colleagues showed how unconstrained DTW in particular can distort peak shapes3.
- Warp on anchor peaks chosen on scientific grounds and known to be present in every sample.
- Constrain the permitted time displacement, and use the least flexible method that works.
- Inspect the warping function. It should be smooth and monotonic, and similar across samples from the same column lot. Monotonic preserves peak order, but does not on its own establish chemical equivalence.
- Run the analysis aligned and unaligned. A feature that appears in only one of them needs explaining.
- Where peak areas matter, check the effect of resampling: integration on a warped time axis need not preserve area.
Follow the evidence: scores and loadings

After the timing correction, the column-lot clustering disappears and one 18-month sample stands apart on PC3. The scores identify which sample is unusual; the loading identifies where in the signal to look. Compare the candidate with the reference on both time axes: the lot 3 API is observed near 5.22 min (5.02 × 1.04), and once the shift is corrected, excess absorbance remains on the API’s leading edge. That is an investigative lead, not the identity of a new impurity. The next step is the DAD peak window and orthogonal evidence, not a name assigned from PCA.
Try it in R: the Product T exercise
Download the R scripts and simulated data (ZIP, 0.4 MB). Extract it into a working folder and, from the folder that contains examples/, run:
source("examples/product_t_signal.R")
The core exercise needs only base R 4.1 or later. It reads 90 simulated chromatograms (three column lots × six stability time points, 0 to 18 months × five replicates), cleans and aligns them, and runs the PCA behind Figure 2B. Lot 3 has a 4% proportional timing shift, and one sample, L3-M18-R5, contains the simulated minor component. To keep the exercise transparent, alignment uses known anchor ratios from the metadata rather than a fitted warp; PTW is an optional extension. The script creates time, clean, aligned_time, aligned, reference_trace, lot3_traces, peak_window, pca_after, pc3, scores3 and candidate, and writes two plots to examples/output/.
plot(aligned_time, pc3, type = "l",
xlim = c(4.65, 5.4), xlab = "Aligned time (min)",
ylab = "PC3 loading")
abline(v = 4.98, col = "red", lty = 2) # simulated minor-component centre
Expected results: candidate L3-M18-R5, the largest absolute PC3 loading near 4.97 min, and a candidate PC3 score far outside the other 89. This PCA includes all 90 samples by design: it is an investigation, not a validated anomaly detector. For monitoring, fit the preprocessing and PCA on an independent reference population, then project new samples and assess detection performance.
For the optional extension, install ptw and mdatools and source examples/optional_ptw_mcr.R. It fits the global PTW warp and the two-component MCR shown in this reading to the exercise data. Compare the estimated warp with the known 4% mapping, and the MCR solution with the simulation’s true profiles; they need not match exactly, for the reasons in Step 3.
Classroom question: if the aligned scores plot looks better, what evidence would convince us that we have not removed the very signal the stability study was meant to detect?
Step 3: resolve what overlaps
DAD peak purity flags the API peak at 18 months as possibly impure. Week 8 was clear that peak purity is supporting evidence, not proof: similar spectra, low impurity levels and noise all limit its ability to detect co-elution. Mathematical resolution can support the investigation, interpreted alongside chemical evidence.
MCR-ALS: separating overlapping compounds

A single-wavelength detector records absorbance against retention time. A DAD records many wavelengths at each time. Arrange the data for the peak window as a matrix : rows are time points, columns are wavelengths. If absorbance is additive and each component’s spectral shape is stable, the data follow a bilinear model:
| Matrix | Dimensions | Scientific interpretation |
|---|---|---|
| time points × wavelengths | Observed absorbance | |
| time points × components | Elution (concentration) profiles | |
| wavelengths × components | Pure-component spectra | |
| time points × wavelengths | Residual the model does not explain |
Multivariate curve resolution by alternating least squares (MCR-ALS) estimates both and 5. Start from a guess at , solve for by least squares, use to solve for , and repeat until stable. Chemical knowledge enters as constraints, used only where chemically justified:
- Non-negativity: concentrations and absorbances cannot be negative.
- Unimodality: a chromatographic elution profile has one maximum.
- Known spectra: if a pure standard is available, fix its spectrum.
- Closure is a different kind of constraint, appropriate only when a total is known.
library(mdatools)
m <- mcrals(peak_window, ncomp = 2,
cont.constraints = list(constraint("nonneg"), constraint("unimod")),
spec.constraints = list(constraint("nonneg")))
plotSpectra(m) # resolved pure spectra
plotContributions(m) # resolved elution profiles
At any one retention time the API and a small overlapping degradant add up to a single absorbance. Across many wavelengths their relative absorbances differ, which gives more information, though not automatically a unique answer. For Product T, a two-component model resolves a minor component eluting about 0.04 min before the API, with a shifted spectral maximum. It is a candidate degradant: LC-MS is the orthogonal test of identity, and a quantitative impurity claim would also need response factors or suitable calibration.
Rotational ambiguity: why chemistry has to choose
For any invertible matrix ,
so different combinations of elution profiles and spectra reproduce the same measured matrix equally well. A low residual cannot, on its own, show that the estimated profiles are pure compounds. There is generally a range of feasible solutions; constraints narrow it, and software can calculate the band that remains. When the band is wide, the resolved impurity level is uncertain by that much. Check sensitivity to initialization, number of components and constraints, and report the uncertainty. A candidate peak and an independently confirmed degradant are not the same claim.
Classroom question: what experiment would distinguish two chemically plausible decompositions that both reproduce the original absorbance matrix?
PARAFAC: add a third measurement dimension

A fluorescence excitation–emission matrix (EEM) records emission across many wavelengths for each of many excitation wavelengths. Stack EEMs from many samples and you have a cube: sample × excitation × emission. PARAFAC models it as a sum of components, each the product of three linked profiles6:
Here describes how component varies across samples, its excitation spectrum and its emission spectrum. Unlike MCR on a single matrix, the three-way structure can give an essentially unique decomposition, up to scaling and the order of components, because the third mode supplies information a matrix lacks.
In biologics, EEM with PARAFAC is used for cell-culture media raw-material checks and to follow tryptophan and tyrosine environments in proteins. The extra mode helps only when it carries independent information; simply adding a dimension does not guarantee identifiability. The condition is trilinearity: every component must keep the same spectral shape in every sample. Scatter peaks, inner-filter effects and, for LC-DAD cubes, retention-time shifts all break it. That is one more reason alignment comes first.
Evaluate residual structure, component stability and the chemical plausibility of the recovered profiles. Where possible, use independent samples or split-half comparisons to test whether the interpretation is reproducible.
Classroom question: why can another measurement dimension reveal more than simply repeating the same measurement more often?
The same equation in a flow cytometer

Week 9 introduced compensation: correcting each detector for spillover from fluorophores it was not meant to see. A spectral flow cytometer generalizes this. It records each cell’s emission across dozens of detectors, and every fluorophore has a full spectral signature. For each cell:
measured emission = Σ (abundance of fluorophore f × signature of f) + autofluorescence + noise
That is again, one row per cell, with a different reading of the matrices:
| HPLC-DAD MCR-ALS | Spectral flow unmixing | |
|---|---|---|
| Row of | Chromatographic time point | Individual cell event |
| Column of | Wavelength | Detector channel |
| Component spectra, possibly unknown | Measured reference signatures | |
| Estimated elution profiles | Estimated fluorescence contributions | |
| Main challenge | Identifiability and chemical constraints | Reference quality and spectral similarity |
Here is known: the signatures come from single-stained reference controls, so the abundances are found by ordinary or weighted least squares. Chemometricians call this classical least squares. Autofluorescence is treated as one more component, with a signature from an appropriate unstained control7. This self-contained base R demonstration uses the same 24 detector channels, three dyes and autofluorescence as Figure 5. The signatures are idealized, not real dye reference controls:
channel <- 1:24
g <- function(x, mu, sigma) exp(-0.5 * ((x - mu) / sigma)^2) # Gaussian signature
S <- cbind(A = g(channel, 8, 3),
B = g(channel, 13, 3),
C = 0.7 * g(channel, 19, 2.8),
Auto = 0.6 * g(channel, 5, 5)) # autofluorescence
truth <- c(A = 1.20, B = 0.65, C = 0.90, Auto = 0.40)
y <- drop(S %*% truth) # one cell's measured emission
estimate <- qr.solve(S, y) # least-squares unmixing
round(estimate, 2)
# A B C Auto
# 1.20 0.65 0.90 0.40
barplot(estimate, ylab = "Relative component contribution")
Least squares recovers the known coefficients in this noiseless, full-rank example. The values depend on how the reference signatures are scaled; they are not concentrations or molecule counts. Add noise to y, or move two signature maxima closer together, and repeat to see the uncertainty grow.
The chemometric cautions carry over.
- Wrong reference signature, wrong answer. A tandem dye that has degraded in the stained sample, but not in its reference control, unmixes into the wrong channels.
- Similar signatures amplify noise. If two signatures are nearly proportional, the matrix is poorly conditioned, and small changes in measured emission cause large changes in the estimates: the same instability collinear predictors cause in regression. Panel design software reports a similarity or complexity index for exactly this reason.
- Unmixing removes spillover, not spread. As Week 9 said of compensation, measurement noise propagates into the resolved values. Negative values after unconstrained unmixing are expected, not necessarily a faulty event.
Where the analyst sits
The analyst decides what is information and what is measurement variation. They decide how much warping is acceptable before a real difference could be hidden, choose and justify MCR constraints, report a range when rotational ambiguity is wide, and know that a spectral cytometer’s unmixed value is only as good as its reference controls. In each case the mathematics produces an answer; chemical knowledge decides whether it is the right one.
A processing sequence is not just code. Its reference selection, parameters, acceptance criteria, software versions and review steps all shape the reported result, so it is part of the analytical procedure. Under ICH Q14 and Q2(R2)8, define the intended use and performance criteria, assess the risks, challenge preprocessing choices with representative samples, and demonstrate the performance of the complete procedure. Use the designed experiments of reading 3 to investigate sensitive settings such as smoothing window, permitted time shift and reference-signature selection. Preserve raw data, processing history and reviewable evidence; changes to a controlled procedure need appropriate assessment.
In practice: what is the instrument software doing?
Commercial chromatography data systems (CDS), including Waters Empower, Thermo Scientific Chromeleon and Agilent OpenLab CDS, run processing methods for peak detection, integration and identification; some configurations add spectral processing such as peak purity. Spectral-cytometer software such as Cytek SpectroFlo unmixes using reference controls. Exact capabilities depend on the product, version, options and configured method: do not assume that a platform implements PTW, MCR-ALS or PARAFAC.
Ask the same questions of vendor software that you would ask of an R pipeline:
- Which processing parameters and reference controls are specified?
- Which are locked or permission-controlled, and which changes need documented justification and review?
- Which steps have supporting analytical performance evidence?
- Can a reviewer reconstruct the result from the original signal, method version and processing history?
System qualification or software validation alone does not show that the selected processing procedure is fit for its analytical purpose. Vendor documentation for discussion: Waters Empower processing methods, Thermo Fisher on Chromeleon data-processing controls, Agilent OpenLab processing methods and Cytek SpectroFlo.
Physical separation creates differences we can measure. Chemometrics extracts information from differences we have measured. Neither replaces chemical understanding or evidence of analytical performance.
For discussion
- When is relative retention sufficient, and when should a more flexible alignment method be considered?
- A DTW-aligned PCA shows no stability trend; the unaligned chromatograms show a new shoulder at 12 months. Which do you believe, and what should the analyst investigate?
- Why is a low MCR residual insufficient to demonstrate the identity and amount of a degradant?
- What assumptions must hold for PARAFAC to give an essentially unique decomposition, and why is MCR on a single matrix not unique?
- What happens to the uncertainty of each unmixed value when two fluorophore signatures are nearly collinear, and what is the regression analogue?
- How would you use a designed experiment to establish smoothing or alignment settings for a stability-indicating workflow?
Bridge back to the week
Next: Watching a Biologic Batch Grow, where time warping returns to align bioreactor runs. Return to Week 12.
Sources
Product T’s stability profiles, the column-lot drift, the resolved component and all five figures are constructed for teaching, not experimental findings.
P. H. C. Eilers, “Parametric Time Warping,” Analytical Chemistry 76(2) (2004) 404–411. DOI. R package: ptw on CRAN. ↩︎
N.-P. V. Nielsen, J. M. Carstensen and J. Smedsgaard, “Aligning of single and multiple wavelength chromatographic profiles for chemometric data analysis using correlation optimised warping,” Journal of Chromatography A 805 (1998) 17–35. DOI. ↩︎
G. Tomasi, F. van den Berg and C. Andersson, “Correlation optimized warping and dynamic time warping as preprocessing methods for chromatographic data,” Journal of Chemometrics 18(5) (2004) 231–241. DOI. ↩︎ ↩︎ ↩︎
H. Sakoe and S. Chiba, “Dynamic programming algorithm optimization for spoken word recognition,” IEEE Transactions on Acoustics, Speech, and Signal Processing 26(1) (1978) 43–49. DOI. ↩︎
R. Tauler, “Multivariate curve resolution applied to second order data,” Chemometrics and Intelligent Laboratory Systems 30(1) (1995) 133–146. DOI. R implementation: mdatools. ↩︎
R. Bro, “PARAFAC. Tutorial and applications,” Chemometrics and Intelligent Laboratory Systems 38(2) (1997) 149–171. DOI. ↩︎
L. M. Park, J. Lannigan and M. C. Jaimes, “OMIP-069: Forty-Color Full Spectrum Flow Cytometry Panel for Deep Immunophenotyping of Major Cell Subsets in Human Peripheral Blood,” Cytometry Part A 97(10) (2020) 1044–1051. DOI. ↩︎
ICH, Q14 Analytical Procedure Development (2023) and Q2(R2) Validation of Analytical Procedures (2023). ICH quality guidelines. ↩︎