Week 12 — Nov 30: Chemometrics & Miscellaneous Methods, Final Paper Presentations
Week 11 used one instrument on one product; this week maps the rest of the field. Tidy data and tidymodels preprocessing, Kuhn and Johnson’s model panels and ensembles, designed experiments as the route from correlation to cause, chromatogram alignment and curve resolution, multivariate monitoring of a biologic batch, and high-dimensional flow cytometry for CAR-T, plus ICH M7 as the clearest case of a prediction accepted in place of an experiment. Final paper presentations run alongside.
**Clear your calendar for this session.** Final paper presentations run alongside the lecture, and the capstone problem is assigned here for the following weeks.
(Lecture 11.) Last week built the modeling vocabulary on one instrument and one product: NIR spectra on a small-molecule tablet line. That was deliberate depth. This week is breadth. The same discipline applies to tables of process data, to chromatograms, to a bioreactor’s 14-day trajectory and to millions of single cells in a CAR-T product. The six readings walk across that range, from a small-molecule tablet to a biologic to an advanced therapy.
The one idea
A predictive model is a hypothesis about data in exactly the way a method is a hypothesis about a molecule. It is fit on the evidence you have, valid only within its range, and tested by every new sample. Chemometrics is machine learning with a 40-year head start in regulated analytical science. Whatever the data look like, the questions are the same: what is one observation, what did the model learn, did it learn a cause or a coincidence, and where does it stop applying?
On teaching this honestly. Nobody in the department specialises in machine learning, and this session does not pretend otherwise. The goal is not to make you model builders. It is to make you competent clients and reviewers: able to say what a model must do, what data it needs, whether its output can be trusted, and where the regulations draw the line.
A map of the field
Chemometrics is easiest to navigate by the shape of the data and the question asked of it.
Data shape
Example
Typical question
Where
A table: one row per batch, one column per variable
Six readings, each about 15 minutes. Readings 1–3 share one constructed tablet, Product T, so the preprocessing, the models and the experiment build on the same data. Code is in R, written to be read even if you have never written it.
Hadley Wickham’s tidy-data rules decide what one observation is. A tidymodels recipe (zero and near-zero variance, correlation filter, imputation, transformation, scaling) is re-estimated inside every fold. SNV never looks at another sample; MSC does.
Kuhn and Johnson’s model panel: PLS, lasso, MARS, SVM, KNN, random forest, boosting and a neural network, on identical batch-grouped folds. Read the result as a distribution, choose the simplest model within one standard error, and weigh what an ensemble costs to keep validated.
The model blamed moisture; the experiment found particle size and blend time. Sir Ronald Fisher’s randomization and factorial designs, and a fractional factorial that screens seven factors in 8 runs instead of 128. Aliasing is the price, and it is written down.
Align drifting chromatograms (RRT, parametric time warping, COW, DTW) without warping away a new degradant. Then resolve co-elution with MCR-ALS and its rotational ambiguity, PARAFAC and its uniqueness, and spectral flow unmixing, which is the same equation.
A mAb fed-batch as a cube of batches × variables × time. Raman soft sensors, batch-wise vs observation-wise unfolding, aligning unequal batches, why one golden batch is not enough, and a day-6 Q alarm that says “unusual”, not “bad”.
A 25-colour CAR-T panel is a data matrix. Manual gating vs FlowSOM vs UMAP, a CAR+ CD3− population the release gates never examined, batch effects that look like biology, and one patient per lot.
How to use the readings
Presentations take much of the session, so the readings carry most of the content.
Signal processing is best read with a chromatogram in front of you.
(Instructor: adjust to the presentation schedule.)
Why R
Every snippet this week is R. Python is equally capable, and you will meet both at work. The case for R here is specific:
The modeling framework is R’s. Max Kuhn wrote caret and leads tidymodels; the recipe steps in reading 1 are tidymodels functions. Hadley Wickham’s tidyverse sets the conventions.
Statisticians tend to work in R. It was built for statistical analysis, and much statistical method development appears there first.
Cytometry analysis lives in R. flowCore, FlowSOM and CytoNorm are Bioconductor packages.
Chemometrics is well served. prospectr, mdatools, ptw and FrF2 cover readings 1–4.
The Python equivalents are scikit-learn (Pipeline, ColumnTransformer and VarianceThreshold play the role of a recipe) and pandas. The concepts transfer completely; the syntax does not matter much.
Worked case: where a prediction already replaces an experiment
ICH M7 (assessment of DNA-reactive impurities) is the clearest example of a computational prediction being formally accepted in lieu of data. For a new impurity, M7 allows a mutagenicity conclusion drawn from two complementary (Q)SAR systems, one expert-rule-based and one statistical, to substitute for an Ames test. If both predict non-mutagenic and there is no conflicting knowledge, no bacterial assay is run. The conditions are two orthogonal models (the same instinct as orthogonal analytical methods), a defined scope, documentation and versioning, and expert review on top.
The principle generalizes. Regulators’ emerging position on AI and models, including FDA’s 2025 draft guidance on AI to support regulatory decisions, is credibility proportionate to consequence: the evidence a model needs scales with how much it influences the decision and how serious a wrong decision would be. Predictive stability (ASAP) is on the same trajectory, with a formal home in the modernized Q1 annex. So is the dissolution IVIVC biowaiver, where an in-vitro model stands in for a clinical study. Language models are held to the same standard in Week 11 reading 8.
Where the analyst sits
The analyst states what a model must do in measurable terms and decides what one observation is. They own the quality of the training data and ask whether a predictor caused the outcome or merely travelled with it. They also decide, sample by sample, batch by batch and lot by lot, whether a result is inside the domain the model knows. None of that is machine-learning expertise. All of it is analytical judgment, the STEAM “M” and “A” at once, and it is why Week 1 said every scientist is now a data scientist. The refrain: science → evidence → reduced uncertainty → control → regulatory confidence → patient trust.
On the job
You are far more likely to be handed a fitted model and asked to defend a day’s predictions than to build one. Know how to read resampled RMSE, a T²/Q chart and a contribution plot before you know how to fit anything.
When someone shows you a variable-importance plot and proposes a process change, ask two questions: did that variable actually vary in the data, and what varied with it?
If your lab exports instrument data, ask what one row is. Most data-integrity and modeling problems start with that answer being unclear.
Learn to read R or Python well enough to follow a colleague’s analysis. You will be reviewing it.
For discussion
M7 accepts two (Q)SAR predictions in place of an Ames test, but not one. Why two, and why does that mirror how you use analytical methods?
A random forest and a fractional factorial disagree about which factor drives dissolution. Which do you believe, and what would change your mind?
Alignment (reading 4), batch synchronization (reading 5) and batch normalization (reading 6) all make samples comparable. What is the shared risk?
Rank by the evidence they need: a (Q)SAR call on an impurity; a Raman glucose model driving a feed pump; a FlowSOM cluster in a characterization panel; an NIR model releasing tablets.
The capstone
An applied problem, worked in teams over the following weeks: a comparability exercise after a manufacturing change; an out-of-specification investigation; a method transfer to a second site; or a specification-setting exercise for a new attribute. Deliverable: a short analytical control strategy and a defence of it, the argument a regulator would have to follow.
Final paper presentations
The paper is a critical analysis of an analytical method, technique, or problem of the student’s choosing, argued the way the course has argued all term: what question does this measurement answer, what decision does it support, how is the result defended, and where does it fail? Strong papers interrogate a real method, incident, or guideline rather than survey a topic. They name the failure modes and their detectability (Week 2), connect the technique to a regulatory expectation and a patient consequence, and say what would change the conclusion.
Format
(Instructor: fill in: capstone team size and deliverable format; presentation length and Q&A; whether the written paper is due before or after the talk; grading split across paper, presentation, and capstone; peer-review expectations. Confirm the pacing of six readings plus presentations in a single 3-hour slot, and consider whether presentations should spill into the make-up slot. Datasets for running the R snippets are still to be produced.)
Source note. Each reading carries its own sources. The modeling thread follows Kuhn and Johnson, Applied Predictive Modeling (2013), Kuhn and Silge, Tidy Modeling with R (2022), and Wickham, “Tidy Data” (2014). Experimental design follows Fisher (1935) and Box, Hunter and Hunter (2005). Signal processing, batch monitoring and cytometry cite the primary literature. The M7 case is anchored in ICH M7(R2) and the FDA draft guidanceConsiderations for the Use of Artificial Intelligence to Support Regulatory Decision-Making for Drug and Biological Products (2025). Product T, Batch 27 and Lot 0420 are constructed teaching cases. (Instructor: confirm current AI-guidance versions.)
1 - Tidy Data and the Preprocessing Recipe
Hadley Wickham’s tidy-data rules decide what one observation is before any model is fitted. A tidymodels recipe then removes zero- and near-zero-variance predictors, filters correlated ones, imputes, transforms and scales, and is re-estimated inside every resampling fold.
Product T's four data sources, and how 360 vessel results become a 60-row batch table because the prediction is made about batches. Constructed teaching case; photographs are illustrative.
The one idea
Decide what one observation is, then let every preprocessing step that learns from the data learn only from the training data.
Most modeling failures in regulated work start before the model is chosen. The table had the wrong rows, or a preprocessing step quietly looked at the test set. This reading treats both as part of the method. It also teaches you to read R, the language this week’s code is written in.
The case: Product T
Product T is a constructed immediate-release tablet. Development wants to predict % dissolved at 30 minutes from material and process data so that a slow batch can be anticipated before the dissolution test is run. The same dataset runs through the next two readings.
Source
What it records
Batch record
Granule moisture, lubricant blend time, compression force, tablet press
Certificate of analysis
API particle size (D50), API supplier and lot, disintegrant lot
In-process test
Tablet hardness, sometimes missing
Dissolution
Six vessels per batch, % dissolved at 30 min
Sixty batches; 360 vessel results.
Hadley Wickham and tidy data
Hadley Wickham, a New Zealand statistician who is now chief scientist at Posit (formerly RStudio), wrote the paper that gives this reading its name. Tidy Data (2014) set out three rules1:
Each variable is a column.
Each observation is a row.
Each type of observational unit is its own table.
The rules sound clerical. They are not. Rule 3 forces the question that decides whether a model can be trusted: what is the unit you are making a prediction about?
Product T has two observational units. A vessel is one dissolution result. A batch is one set of process conditions and one release decision. Putting 360 vessel rows into a model with the batch’s process settings copied onto each row creates six near-identical rows per batch. Random cross-validation will then put vessel 1 of batch 17 in training and vessel 2 in testing, and the model will appear to predict batch 17 when it has, in effect, already seen it.
The classic version of this failure is spectroscopic. An NIR tablet-assay model with three spectra per tablet reported RMSECV 0.9% when random spectra were left out, and 2.1% when whole batches were. The spectrum was not the observational unit; the tablet, and above it the batch, was. Week 11, reading 2 made the same point with whole-batch cross-validation on granule moisture.
Wickham also built much of the toolkit for this: ggplot2 for graphics and dplyr for data manipulation, gathered with other packages as the tidyverse. Max Kuhn’s tidymodels packages, used below, follow the same conventions2,3.
Reading R in five minutes
The code on this site reads top to bottom as a sequence of verbs:
library(tidyverse)batches<-vessels|># start with the vessel tablegroup_by(batch_id)|># one group per batchsummarise(diss_30=mean(pct_30min))|># batch mean of six vesselsleft_join(batch_record,by="batch_id")# add the process settings
<- assigns a result to a name.
|> is the pipe: “take what’s on the left and pass it to the next function”. Read it aloud as then.
group_by(), summarise(), left_join() are verbs; each does one thing to a table and returns a table.
# starts a comment.
That is enough to follow every snippet this week. The output is a tidy batch table: 60 rows, one per batch, one column per variable.
A recipe is a written preprocessing plan
Kuhn and Johnson’s central argument is that preprocessing is part of the model, not housekeeping done beforehand4,5. tidymodels makes this concrete. A recipe lists the steps; it does not run them until it is estimated on a particular set of data:
library(tidymodels)rec<-recipe(diss_30~.,data=batches)|>update_role(batch_id,api_lot,new_role="id")|># keep, but don't modelstep_impute_median(hardness)|># fill missing hardnessstep_YeoJohnson(api_d50)|># tame a skewed predictorstep_dummy(all_nominal_predictors())|># supplier, press -> 0/1step_zv(all_predictors())|># drop constant columnsstep_nzv(all_predictors())|># drop near-constant onesstep_corr(all_numeric_predictors(),threshold=0.9)|>step_normalize(all_numeric_predictors())# centre and scale
Each step answers a question the data raise.
Step
The problem in Product T
What it does
step_impute_median
Hardness missing for 7 batches
Fills with the training-set median, which is learned from the data
step_YeoJohnson
API D50 is right-skewed; a few coarse lots dominate
Estimates a power transformation that makes the distribution more symmetric
step_dummy
Supplier and press are categories
Converts each category to 0/1 indicator columns
step_zv
A column is constant in this fold
Removes it; many models fail on a zero-variance column
step_nzv
Press B made 2 of 60 batches
Removes predictors dominated by one value
step_corr
Hardness and compression force correlate at r = 0.94
Removes one of each highly correlated pair
step_normalize
Force is in kN, moisture in %
Centres each predictor and scales it to unit variance
The seven recipe steps applied to Product T, in the same order as the code above, and where the recipe is estimated in each resampling fold. The figure shows log or Box–Cox as examples of a transformation; the code uses Yeo-Johnson, which also handles zero and negative values.
Near-zero variance, specifically
Kuhn’s rule flags a predictor when both are true: the most common value is far more frequent than the second most common (by default a ratio above 95/5), and few values are unique (by default under 10% of rows)4. “Press B” fails both: 58 zeros, 2 ones. It carries almost no information, and in a five-fold split there is a good chance a fold contains no Press B batches at all. At that point it is a zero-variance column inside the fold, which breaks some models and destabilises others.
Removing it is a modeling decision, not a scientific one. If the two Press B batches are the slow ones, you have lost a signal. Check what step_nzv removed, then decide with process knowledge.
Correlation filters and spectra
step_corr suits a table of process variables, where two columns measuring nearly the same thing make coefficients unstable. It is the wrong tool for a spectrum. Neighbouring NIR wavelengths correlate above 0.99, so a correlation filter would discard most of the spectrum. For spectra, the answer to collinearity is to model it with latent variables (step_pca, or a PLS model), as Week 11 reading 3 showed.
Spectral preprocessing: what learns, and what doesn’t
Method
Removes
Learns from other samples?
SNV (standard normal variate)
Multiplicative scatter and offset, spectrum by spectrum
No: each spectrum is centred and scaled by its own mean and SD
Savitzky–Golay smoothing and derivatives
Noise; baseline offset (1st derivative) and slope (2nd)
No: a fixed local polynomial filter
MSC (multiplicative scatter correction)
Scatter, relative to a reference spectrum
Yes: the reference is usually the training-set mean
Mean-centring, autoscaling, PCA
Offsets; magnitude differences; collinearity
Yes
That last column is the one that matters for honest validation. SNV and Savitzky–Golay can be applied once, before splitting, because they never look at another sample. Anything that learns a mean, a median, a reference spectrum, a set of removed columns or a set of components has to be learned inside each fold, from that fold’s training data only. The R package prospectr provides SNV and Savitzky–Golay6; derivatives amplify noise, so the window width is itself a tuning choice.
The common spectral preprocessing steps, and which of them learn from other samples and must therefore be estimated inside each fold.
SNV and MSC: the same problem, two different references
SNV and MSC are easy to confuse, because they fix the same physical problem. In diffuse-reflectance NIR, particle size, tablet surface roughness, packing density and the effective optical path length all change how light scatters. Scatter shifts a spectrum up or down (an additive effect) and stretches or shrinks it (a multiplicative effect) without any change in chemistry. Both methods try to remove that physical variation and leave the chemical variation behind.
The difference is where each method gets its correction:
SNV corrects a spectrum using information from itself. Each spectrum x is centred on its own mean and divided by its own standard deviation:
MSC corrects a spectrum using information from a reference spectrum. Each spectrum is regressed against a reference xref
, usually the mean spectrum of the training set, as x≈a+bxref
. The fitted offset a and slope b are then removed:
xMSC=bx−a
Every corrected spectrum is pulled toward the shape of the reference8.
In practice the two usually give very similar results; Dhanoa and colleagues showed that they are closely related, linear transformations of each other9. The choice matters more for validation than for chemistry. Because the MSC reference is calculated from the training data, it must be recalculated inside each fold and then frozen with the model, and a new sample is corrected against that frozen reference. SNV needs no stored reference at all. Try both during development and choose on cross-validated performance and on the physics of the samples.
SNV standardizes each spectrum against itself; MSC fits each spectrum to a reference spectrum and removes the fitted offset and slope. The 'common use' row is a tendency, not a rule: both are used for quantitative and qualitative models.
Estimate inside the fold, every time
A recipe is estimated with prep() and applied with bake(). You will rarely call either directly. When the recipe is combined with a model and resampled, tidymodels re-estimates it on each fold’s analysis set:
folds<-group_vfold_cv(batches,group=api_lot,v=5)
group_vfold_cv keeps every batch from one API lot in the same fold. Product T’s realistic future is a new API lot, so that is what the held-out fold should look like. The choice of grouping is a statement about how the model will be used.
Three ways to split Product T, and the question each one actually tests. The stricter the grouping, the higher and more honest the error. RMSE values are illustrative, echoing the NIR example above.
To see what a fitted recipe actually did, ask it:
prepped<-prep(rec,training=batches)tidy(prepped,number=5)# which columns did step_nzv remove?
The reading on one page
The reading in one figure: tidy-data rules, Product T's two observational units, why random cross-validation by vessel leaks, the recipe estimated inside each fold, and the end-to-end workflow. The figure groups folds by batch; the code above groups by API lot, a stricter version of the same idea.
Where the analyst sits
The analyst decides what one observation is, which grouping makes cross-validation resemble real use, and whether a column removed by an automatic filter carried a process signal. Under ICH Q14, the preprocessing sequence is part of the procedure. It is locked with the model, documented and revalidated if changed, just as a column and mobile phase are in an HPLC method.
For discussion
Product T’s vessel table has 360 rows. Give one modeling question for which the vessel is the right observational unit.
step_nzv removes Press B. What evidence would make you put it back?
Why can SNV be applied before splitting, but MSC cannot?
Grouping folds by API lot gives a worse cross-validated error than random folds. Which number do you report, and why?
Bridge back to the week
Next: Many Models, One Question, which puts this recipe in front of eight models built on different mathematics. Return to Week 12.
Sources
Product T and its numbers are constructed for teaching. The NIR leakage example is a composite of commonly reported failures.
H. Wickham, “Tidy Data,” Journal of Statistical Software 59(10) (2014). DOI. ↩︎
H. Wickham, M. Çetinkaya-Rundel and G. Grolemund, R for Data Science, 2nd ed. (O’Reilly, 2023). Free online at r4ds.hadley.nz. ↩︎
M. Kuhn and J. Silge, Tidy Modeling with R (O’Reilly, 2022). Chapter 8 on recipes. Free online at tmwr.org. ↩︎
M. Kuhn and K. Johnson, Applied Predictive Modeling (Springer, 2013). Chapter 3, data pre-processing, including the near-zero-variance criteria. DOI. ↩︎↩︎
M. Kuhn and K. Johnson, Feature Engineering and Selection (CRC Press, 2019). Free online at feat.engineering. ↩︎
A. Stevens and L. Ramirez-Lopez, prospectr: Miscellaneous functions for processing and sample selection of spectroscopic data, R package. CRAN. ↩︎
R. J. Barnes, M. S. Dhanoa and S. J. Lister, “Standard Normal Variate Transformation and De-trending of Near-Infrared Diffuse Reflectance Spectra,” Applied Spectroscopy 43(5) (1989) 772–777. DOI. ↩︎
P. Geladi, D. MacDougall and H. Martens, “Linearization and Scatter-Correction for Near-Infrared Reflectance Spectra of Meat,” Applied Spectroscopy 39(3) (1985) 491–500. DOI. ↩︎
M. S. Dhanoa, S. J. Lister, R. Sanderson and R. J. Barnes, “The Link between Multiplicative Scatter Correction (MSC) and Standard Normal Variate (SNV) Transformations of NIR Spectra,” Journal of Near Infrared Spectroscopy 2(1) (1994) 43–47. DOI. ↩︎
2 - Many Models, One Question
Kuhn and Johnson’s practice of fitting a panel of models built on different mathematics (PLS, penalized regression, MARS, SVM, KNN, random forest, boosting and a neural network) on the same resamples, comparing them honestly, stacking them into an ensemble and choosing what a regulated setting can defend.
The one idea
No single algorithm is right in advance. Fit several that explain the outcome in different mathematical ways, compare them on identical resamples, and let the evidence, then the intended use, choose.
Kuhn and Johnson make this the backbone of Applied Predictive Modeling1. Their worked case studies do not pick an algorithm and tune it to death. They fit a panel: linear, nonlinear, tree-based, kernel-based. They compare the resampled performance distributions and only then decide. Judging a model by how well it predicts held-out data, rather than by how plausible its assumptions look, is what Leo Breiman called the algorithmic modelling culture2. The reason is not fashion. Each model makes different assumptions about how predictors relate to the outcome, so a panel is a set of competing hypotheses about the data.
The eight-model panel for Product T, grouped into four families. Every model sees the same batches and answers the same question; they differ only in how they assume the inputs relate to % dissolved. Constructed teaching case; photographs are illustrative.
Eight models, eight explanations
Product T, from reading 1: predict % dissolved at 30 minutes from material and process data.
A weighted sum of a few latent variables chosen to covary with y
Roughly linear; collinearity is fine
Centring, usually scaling
Penalized regression (lasso, elastic net)
A weighted sum of predictors with coefficients shrunk toward zero; lasso sets some exactly to zero
Linear, additive
Scaling (the penalty is scale-dependent)
MARS
Joined straight-line segments (“hinges”), with interactions added automatically
Piecewise linear
Little
Support vector machine (radial kernel)
A smooth surface in a transformed space, ignoring errors inside a tolerance band
Smooth, possibly curved
Scaling, essential
k-nearest neighbours
The average of the k most similar training batches
Similar inputs give similar outputs
Scaling, essential (it is all distances)
Random forest
The average of hundreds of decision trees, each grown on a bootstrap sample with random subsets of predictors
Step-like relationships; interactions are natural
Almost none
Boosted trees
Many shallow trees, each fitted to the errors of the trees before it
Same as forest, built sequentially
Almost none
Neural network (single hidden layer)
Weighted sums passed through nonlinear functions, layered
Very flexible; needs data
Scaling, essential
Three practical consequences follow from the table.
Different preprocessing for different models. Trees need almost nothing; KNN, SVM and neural networks are useless without scaling. tidymodels handles this by pairing recipes with models.
Different extrapolation behaviour. A tree ensemble cannot predict outside the range of outcomes it was trained on; it plateaus. A linear model extrapolates confidently, and can be confidently wrong. Neither is safe outside the applicability domain, which is why T² and Q monitoring matter regardless of model.
Different explanations. If PLS, the lasso and a random forest all rank API particle size first, that is evidence about the data. If only the neural network finds a signal, ask what it is fitting.
Run the panel on the same resamples
A workflow joins one recipe to one model. A workflow set crosses several recipes with several models:
In practice you would pair the tree models with basic and the rest with scaled instead of fitting every combination. The point to see is the structure: one folds object (the batch-grouped folds from reading 1), used by every workflow. Each model is scored on exactly the same held-out batches, so the comparison is paired. Differences come from the models, not from luck in the split.
Read the result as a distribution, not a leaderboard
The constructed Product T panel gives these cross-validated RMSE values, in % dissolved:
Model
Mean RMSE
Spread across folds
Random forest
3.1
2.4–3.9
Boosted trees
3.2
2.3–4.2
MARS
3.3
2.6–4.0
PLS
3.4
2.8–4.1
Lasso
3.5
2.9–4.1
SVM
3.6
2.7–4.6
Neural network
4.0
2.9–5.6
KNN
4.4
3.3–5.8
The forest “wins” by 0.3 percentage points. The spread across folds is about 1.5 points. The top five are not meaningfully different on this evidence. Kuhn and Silge recommend formal paired comparisons of resampled metrics for exactly this reason3. Two things are clear: KNN and the neural network are worse, and the relationships appear to be mostly linear, since PLS and the lasso keep up with the flexible models.
The one-standard-error rule
When several settings perform within noise of each other, choose the simplest one within one standard error of the best. tune provides select_by_one_std_err(). In a regulated setting this rule has more force, because the simpler model is easier to explain, validate, monitor and transfer. Here PLS or the lasso is the defensible choice. The forest’s 0.3 points do not pay for what it costs to justify.
Ensembles: let models vote
Sometimes the models are wrong in different places. Then a combination beats any member. Stacking fits a second, simple model whose inputs are the out-of-fold predictions of the candidates, and learns how much weight each deserves3:
library(stacks)ens<-stacks()|>add_candidates(results)|># out-of-fold predictions from the panelblend_predictions()|># penalized weights; most get zerofit_members()# refit the survivors on all training data
add_candidates needs the tuning run to keep its predictions (control_grid(save_pred = TRUE, save_workflow = TRUE)). The blending step uses a lasso-type penalty, so most candidates get zero weight; a typical result keeps two to four members. Random forests and boosted trees are themselves ensembles of trees. Stacking is the same idea one level up.
For Product T the stack (PLS 0.55, random forest 0.30, MARS 0.15) reaches RMSE 2.9. Is that worth it? An ensemble is several locked models plus a blending model, each with its own preprocessing. Every one has to be validated, monitored for drift and change-controlled. Ensembles are common in research and in high-volume, low-consequence prediction. For a model that supports a release decision, the extra 0.5 points must be weighed against that lifecycle burden.
What the panel tells you that one model cannot
Is the problem linear? If PLS keeps up with the forest, yes, mostly.
Is there more signal to find? If every model plateaus near the same error, the limit is the data, not the algorithm. Compare the plateau with the reference method’s own noise. In Product T, vessel-to-vessel SD is about 3%, so a six-vessel batch mean carries roughly 1.2 points of noise, and run-to-run variation adds a little more. Every model stalls near 3, well above that floor. Something that drives dissolution is either not in the table or not varying enough in it to be learned.
Do the explanations agree? Variable importance from different model families that agrees is stronger evidence than one model’s ranking.
None of this establishes cause. Every model here learns associations in historical batches. Reading 3 is about that limit.
Where the analyst sits
The analyst sets the comparison up honestly (same folds, grouped the way the model will be used) and reads the result as a distribution. They also know the error floor set by the reference method, and choose the simplest model the evidence supports. The final choice is a judgment about intended use, consequence and lifecycle cost, not a sort by RMSE.
Why the best RMSE is not the whole decision. Models extrapolate differently, every added model carries lifecycle cost, and the evidence needed depends on whether the prediction advises the process or supports release.
The reading on one page
The reading in one figure: the model panel, how each model explains the outcome, a fair comparison on identical grouped resamples, reading results as distributions against the measurement noise floor, ensembles, and choosing a model for its intended use. The fifth panel is misnumbered '3' in the figure.
For discussion
Why must every model in the panel use the same resampling object?
The neural network has the widest spread across folds. Give two reasons a flexible model might be unstable with 60 batches.
A random forest is trained on batches with 70–90% dissolved. What does it predict for a batch whose true value is 60%? What does PLS predict?
Make the case for and against deploying the three-member stack for in-process prediction. Then do the same for release.
Product T and the panel results are constructed for teaching.
M. Kuhn and K. Johnson, Applied Predictive Modeling (Springer, 2013). Chapters 6–9 for the regression models; Chapter 10 compares a full model panel on one case study. DOI. ↩︎
L. Breiman, “Statistical Modeling: The Two Cultures,” Statistical Science 16(3) (2001) 199–231. The classic argument for judging models by predictive accuracy, with replies from statisticians who disagree. DOI. ↩︎
M. Kuhn and J. Silge, Tidy Modeling with R (O’Reilly, 2022). Chapter 11 on comparing models with resampling, Chapter 15 on workflow sets, Chapter 20 on ensembles and the stacks package. Free online at tmwr.org. ↩︎↩︎
3 - Correlation Is Not Causation: From Designed Experiments to Sustained Pharmaceutical Quality
Use ISA-88 process recipes, FMEA, screening and response-surface optimization to transform predictive associations into pharmaceutical process understanding, design space, lifecycle control and organizational learning.
The one idea
A model fitted to data you observed can tell you what goes together. Only data you caused, by changing a factor on purpose, can tell you what happens when you change it.
R&D deliberately introduces variation to generate knowledge. Manufacturing deliberately controls variation to deliver consistent quality. Quality by Design connects these activities through risk management, experimental evidence, technology transfer and continuous learning.
The organization learns when development evidence and commercial experience are connected, evaluated and reused. The goal is not merely to transfer a product into manufacturing, but to retain the knowledge that sustains its quality and improves future development programs.
In the preceding readings, we prepared historical manufacturing data and compared predictive models. Those models can identify patterns and anticipate a slow batch. They cannot, without additional causal evidence or assumptions, tell us what would happen if we changed a material attribute or manufacturing parameter. Design of experiments (DoE) provides a disciplined way to generate that evidence, rather than simply waiting for variation to occur.
Experiments also come in stages. You do not open the design software and ask “how many factors do I have?” You ask “what am I trying to learn?” Early on the question is which factors matter (screening). Later it is how do they behave, and where should we operate (optimization). Last, it is can we reliably operate there (confirmation). Each question needs a different design.
The case: the model blames moisture
The Product T random forest from reading 2 ranks granule moisture as its most important predictor. Wetter granules go with slower dissolution, and manufacturing proposes tightening the drying endpoint. Before anyone does, look at how moisture varied:
Moisture was higher in summer, because the dryer inlet air is more humid.
In the same summer, purchasing introduced coarser API from a second supplier (D50 about 85 µm instead of 50 µm).
Lubricant blend time never appeared in the importance ranking. It was held near 3.0 ± 0.2 minutes in every batch.
The moisture association could reflect the concurrent particle-size change. And blend time’s restricted range made its potential effect impossible to detect, although magnesium stearate over-blending is a well-known cause of slow dissolution1.
This is a paradox of controlled manufacturing: a critical parameter can appear unimportant precisely because it rarely varies. The absence of a strong historical association does not justify removing its control. R&D must deliberately investigate such parameters within scientifically appropriate ranges.
Variable importance measures how a fitted model uses a predictor, not what an intervention would accomplish. Before tightening the dryer endpoint, ask whether moisture is causal, whether it is a surrogate for API particle size, and which factors never varied enough to be evaluated.
Historical manufacturing data
Designed experimental data
Moisture, season, supplier and API D50 changed together
Moisture, API D50 and blend time are each set independently
Blend time sat in a 0.4-minute window
Blend time is deliberately run from 2 to 10 minutes
Answers “what went with slow batches?”
Answers “what happens if we change this?”
Good for predicting the next routine batch
Needed before changing the process
George Box put it in one sentence: “To find out what happens to a system when you interfere with it you have to interfere with it (not just passively observe it)”2.
Why Fisher changed the way we generate data
In 1919 Ronald A. Fisher joined Rothamsted Experimental Station in England to analyse decades of crop records. He found the problem every pharmaceutical data scientist eventually finds: weather, soil, field and treatment were tangled together in happenstance data, and no amount of analysis could untangle them. His answer was to change how the data were produced. The principles he set out, collected in The Design of Experiments (1935), remain the basis of pharmaceutical DoE3:
Principle
What it does
Product T version
Randomization
Reduces systematic bias in expectation: unknown factors cannot line up with the factor being studied
Run order randomized, so season, operator and API drum cannot track blend time
Replication
Independent repeat runs estimate the experimental variability effects must beat
Centre-point batches repeated
Blocking
Accounts for known nuisance sources
Runs grouped by API drum, if one drum cannot supply all runs
Factorial design
Investigates factors together, not one at a time
All seven candidate factors change in a planned pattern
Fisher argued that nature “will best respond to a logical and carefully thought out questionnaire; indeed, if we ask her a single question, she will often refuse to answer until some other topic has been discussed”4. One-factor-at-a-time experiments cannot see an interaction, where one factor’s effect depends on the level of another. He also warned that “to consult the statistician after an experiment is finished is often merely to ask him to conduct a post mortem examination”5.
A factorial design turns a scientific question into an experimental plan. A pharmaceutical scientist uses prior knowledge and the FMEA to choose which questions are worth the experimental cost.
1. Start with the product and the process
A risk-driven development workflow. The platform recipe structures the process-wide FMEA, and knowledge is reassessed after screening and confirmation. The 64-run calculation illustrates a six-factor, two-level screening problem; Product T below has seven candidate factors. The steps are stages of experimentation, not clinical trial phases or mandated regulatory phases.
Consider Product T, our constructed immediate-release tablet. One critical quality attribute (CQA) is dissolution at 30 minutes. Content uniformity, hardness and friability also influence the suitability of the product and its manufacturing process.
An ISA-88-inspired platform manufacturing recipe provides a consistent starting structure: dispense materials, granulate, dry, blend, compress and, if appropriate, coat6. This is a manufacturing recipe, distinct from the tidymodels preprocessing recipe of reading 1. Both specify repeatable procedures, but one defines product manufacture and the other defines data preparation.
R&D examines each unit operation using failure mode and effects analysis (FMEA), considering severity, occurrence and detectability where appropriate. The FMEA is a living representation of risk, not merely an initial ranking. What could go wrong? Which material attributes, formulation choices and process parameters might influence a CQA? What evidence supports our understanding, and where are we uncertain? For Product T the risk assessment puts seven candidates forward: API particle size, granule moisture, granulation water, magnesium stearate level, lubricant blend time, disintegrant level and compression force. Blend time is on the list because of pharmaceutics knowledge, even though the forest ignored it.
Screen, optimize, confirm
Development then moves through three experimental stages, each narrowing the problem7,8:
Central composite, Box–Behnken, three-level factorial
Confirmation runs, replicates, small deliberate perturbations
Output
The important factors
Response surfaces and a candidate operating region
Experimental evidence that the region works
The stages are defined by the scientific question, not strictly by the number of levels. Definitive screening designs, for example, run continuous factors at three levels and can investigate some quadratic effects while screening9.
What do I want to learn?
Design approach
Minitab
R
Which factors matter?
Screening or fractional factorial
Stat > DOE > Factorial, or Stat > DOE > Screening
FrF2::FrF2(), FrF2::pb()
Is there curvature anywhere?
Factorial with centre points
Stat > DOE > Factorial (add centre points)
FrF2::add.center()
What shape is the response?
Response surface design
Stat > DOE > Response Surface
rsm::ccd(), rsm::bbd()
Where are all CQAs acceptable?
Overlaid contours, multiple-response optimization
Overlaid Contour Plot, Response Optimizer
Predict each response on a grid and overlay
Does the predicted setting actually work?
Confirmation runs
Compare with the prediction interval
predict(..., interval = "prediction")
2. Phase 1: screening to reduce uncertainty
Factor types, the run cost of corners, centre points and a full three-level grid, and three hypothetical blend-time curves that share their endpoints. Centre points can detect overall curvature but cannot estimate each quadratic effect separately.
Screening begins by defining the experimental unit, responses, factors and factor levels. One independently manufactured experimental batch is a run; the six dissolution vessels from that batch are subsamples, not six independent manufacturing replicates. This is the same observational-unit question as in reading 1.
Product T’s seven candidate factors:
Factor
Low
High
API particle size (D50)
45 µm
90 µm
Granule moisture
1.5%
3.0%
Granulation water
28
34
Magnesium stearate
0.5%
1.5%
Lubricant blend time
2 min
10 min
Disintegrant level
2%
6%
Compression force
8 kN
16 kN
The granulation-water units are left unspecified in this constructed example; define the basis before execution. Disintegrant levels are illustrative percent by mass. These ranges are not approved manufacturing settings.
Continuous factors have meaningful intermediate values. Categorical factors, such as supplier or disintegrant type, have distinct alternatives but no numerical midpoint. For formulations where component proportions must sum to a fixed total, use an appropriate mixture or mixture-process design rather than assuming all ingredient amounts can vary independently.
Two-level screening estimates directional changes across selected ranges. A factorial arrangement also permits investigation of interactions, subject to the design’s alias structure. Longer blending may have little influence at low magnesium stearate concentration but substantially reduce dissolution at higher concentration; one-factor-at-a-time experimentation can miss this dependence. For two coded factors (−1 = low, +1 = high), the screening model is first-order with an interaction:
Y=β0+β1X1+β2X2+β12X1X2+ε
A two-level design cannot characterize individual quadratic effects from its corner points alone. The same endpoint contrast can hide very different response shapes:
Blend time
Linear
Interior maximum
Interior minimum
2 min
95%
95%
95%
6 min
90%
98%
82%
10 min
85%
85%
85%
Centre points are a cheap check. For three continuous factors, eight corner runs plus three independent centre runs give eleven experiments, against 27 for a three-level full factorial. The centre replicates estimate pure error, and their mean compared with the corner average tests for curvature. They cannot say which factor is curved, because every factor sits at its midpoint in the same runs. If one factor is a two-level categorical factor such as supplier, only the continuous factors are centred: three centre runs per supplier give fourteen runs in total10.
Screening tells you what matters. It does not tell you where to operate.
3. Fractionation: obtaining information at a practical cost
The Minitab six-factor example: start with 2⁶ = 64 runs and follow the six-factor column of the design-selection table. The 16-run resolution IV quarter fraction is an illustrative screening choice; the 8-run resolution III fraction on the right is a separate demonstration of aliasing. Resolution describes alias structure, not a complete measure of pharmaceutical risk.
Suppose six two-level factors are under investigation. A full factorial requires 26=64
runs. A half fraction requires 32, a quarter fraction 16 and an eighth fraction 8: savings of 50%, 75% and 87.5%11. A seven-factor full factorial requires 128 runs, or 2,187 if every factor is studied at three levels. Fractions work because of effect sparsity (only a few factors usually matter) and hierarchy (main effects are usually larger than interactions).
Six-factor design
Runs
Resolution for the illustrated designs
Full factorial
64
No aliasing among factorial effects
Half fraction
32
VI
Quarter fraction
16
IV
Eighth fraction
8
III
To make the software decision explicit, find the six-factor column in the design-selection table and read down it: 64 runs (full), 32 (resolution VI), 16 (resolution IV) or 8 (resolution III). For this teaching example, choose 16 runs when the priority is estimating main effects without aliasing them with two-factor interactions, accepting that some interactions remain aliased with each other. That saves 48 runs, 75% of the full factorial. If the screen leaves a consequential interaction unresolved, plan targeted follow-up experiments. The same logic applies in R: FrF2(nruns = 16, nfactors = 6) requests a six-factor regular fraction; inspect its generators and alias structure before execution.
We pay for efficiency with aliasing: different effects have identical design columns and cannot be separated using those runs. In the eight-run example, let A, B and C be independent two-level columns and define D = AB, E = AC and F = BC. Because the coded values are −1 or +1, B2=1
, so
BD=B(AB)=ACE=C(AC)=A
The main effect A is aliased with the interactions BD and CE, among higher-order terms. A large estimated effect cannot be attributed uniquely to A. This eight-run design shows what the more aggressive fraction costs; it is not the 16-run design chosen above.
Resolution is the length of the shortest word in a regular design’s defining relation; here I=ABD
, so resolution III.
Resolution
Main effects
Two-factor interactions
III
Aliased with two-factor interactions
Aliased with main effects and each other
IV
Clear of two-factor interactions
Aliased with each other
V
Clear
Clear of each other
Higher resolution does not eliminate all aliases, and a design with fewer runs is not automatically appropriate for a high-consequence question. If the FMEA says a particular interaction is plausible and serious, choose a design that can estimate it.
This is confounding again, but now it is known and written down. Historical data had unknown confounding you could not repair; a fractional factorial has documented confounding you can break with more runs. A full fold-over of the resolution III design reverses all factor signs in an additional set of runs. Combined with the original fraction, it separates main effects from two-factor interactions, although some interaction aliases remain. More selective follow-up designs may be preferable when specific interactions need resolution12. Plackett–Burman designs provide economical main-effects screening, often with partial rather than complete aliasing13.
In Minitab, use Stat > DOE > Factorial > Create Factorial Design, then Display Available Designs14. In R, FrF2 supplies regular fractional factorial designs and fold-over construction15. For Product T:
library(FrF2)screen<-FrF2(nruns=8,nfactors=7,randomize=TRUE,seed=1935,factor.names=list(api_d50=c(45,90),moisture=c(1.5,3.0),gran_h2o=c(28,34),mgst_pct=c(0.5,1.5),blend_min=c(2,10),disint=c(2,6),force_kN=c(8,16)))summary(screen)# inspect the actual generators and aliasesfollowup<-fold.design(screen)# 8 mirror-image runs that break main-effect aliasing
The six-factor matrix in Figure 3 is a separate illustration, not the generated seven-factor Product T matrix. Review the actual design before randomizing and executing runs.
An unreplicated, saturated seven-factor, eight-run screen has no residual degrees of freedom for estimating error. A half-normal effect plot (DanielPlot() in FrF2) can suggest active effects under sparsity assumptions, but follow-up runs are essential for resolving important ambiguity.
In the constructed Product T study, the eight-run screen followed by eight fold-over runs produced these illustrative effects on dissolution:
Effect
Change in % dissolved at 30 min, low → high
API D50, 45 → 90 µm
−9.8
Blend time, 2 → 10 min
−7.1
Lubricant level × blend time (alias group)
−3.4
Granule moisture, 1.5 → 3.0%
−0.9 (within noise)
All others
within noise
The interaction remains aliased with other two-factor interactions and requires further investigation. These are teaching results, not experimental measurements. They show how the apparently important historical moisture signal can be reconsidered in light of deliberate variation: moisture rode along with the coarse summer API lot. Tightening the dryer would have cost money and fixed nothing.
4. Phase 2: optimization from direction to curvature
Response-surface designs add levels so the model can estimate curvature. Inscribing the CCD keeps every blend time between 2 and 10 minutes, at the cost of moving the factorial points inward. The fitted surface is illustrative.
Screening helps decide which factors deserve further study. Optimization investigates how those factors behave across the relevant region. Two endpoint measurements cannot distinguish a straight line from a curve passing through the same endpoints, and replicated centre points detect overall curvature without separating individual quadratic terms.
A quadratic response-surface model for two coded continuous factors is:
The interaction term describes dependence between factors. The squared terms allow curvature along individual factor directions, so the model can describe local maxima, minima, ridges or saddle points. Each βii
needs at least three levels of its factor. Predictions remain conditional on model adequacy and the investigated region. Box and Wilson introduced this sequential, second-order approach in 195116.
Design
Geometry
Levels per factor
Runs (example)
Three-level full factorial
A full grid
3
9 for 2 factors, 27 for 3
Central composite (CCD)
Factorial points + centre points + axial (star) points
A circumscribed CCD typically has five distinct coded levels per continuous factor: −α, −1, 0, +1 and +α. A face-centred CCD uses α = 1 and therefore only three. The choice of α and physical bounds matters: unsafe or infeasible settings should never be chosen simply to obtain a mathematically convenient design. For a two-factor inscribed rotatable CCD, α = √2. With blend time bounded at 2–10 minutes, the five levels are 2.00, 3.17, 6.00, 8.83 and 10.00 minutes. The outer bounds are the axial settings and the factorial settings move inward18,19.
A CCD can be built sequentially from suitable prior factorial runs, if the factors, ranges, blocking and estimability remain compatible. Inscribing the design may prevent that reuse. Box–Behnken designs sample edge midpoints rather than corners, so they never run every factor at its extreme together. A fold-over resolves aliasing; axial points estimate curvature. They solve different problems.
For Product T, API particle size was the strongest screening effect. One scientifically plausible next step is to characterize and control D50 within a justified material range, then study magnesium stearate concentration and blend time jointly. If particle size remains variable or interactions with it are plausible, include D50 in the optimization instead. Neither a material specification nor a causal mechanism is established by the constructed screen alone.
library(rsm)set.seed(1951)opt<-ccd(~x1+x2,n0=c(3,2),alpha="rotatable",inscribed=TRUE,randomize=TRUE,coding=list(x1~(blend_min-6)/4,# axial points at 2 and 10 minx2~(mgst_pct-1.0)/0.5))# axial points at 0.5 and 1.5%opt# 13 runs: 4 factorial + 4 axial + 5 centre, in two blocks# after the runs, add the measured diss_30 to the design and fitfit<-rsm(diss_30~Block+SO(x1,x2),data=opt_results)summary(fit)# quadratic terms, lack of fit, stationary pointcontour(fit,~x1+x2,image=TRUE)
SO() fits the full second-order model: linear terms, the interaction and pure quadratics20. With inscribed = TRUE, the coded ±1 in coding are the axial settings, so every run stays within the screened ranges.
Screening tells you which direction to move. Optimization tells you how far to move and where to operate.
5. From response surfaces to a proposed design space
Illustrative overlay of CQA acceptance regions. The response models and criteria are hypothetical: dissolution ≥85%, hardness 70–115 N and friability ≤1%. The star maximizes an illustrative combined score; the dot is the proposed setpoint. The dashed ellipse is assumed normal process variation, not a statistical confidence region. The green region is not a demonstrated design space.
Pharmaceutical optimization rarely means maximizing one response. Increasing compression force may improve hardness while affecting disintegration or dissolution. More lubricant or longer blending can slow dissolution and soften tablets, while too little can cause sticking. An acceptable formulation and process must balance multiple CQAs. Fit suitable response models, evaluate their residuals and predictive uncertainty, and overlay the regions meeting the relevant criteria. Desirability functions combine the responses into a single score, as Minitab’s Response Optimizer does21.
The intersection provides a candidate operating region. Figure 5 uses three illustrative response functions and a combined score that rewards higher dissolution, hardness near a target and lower friability. Three kinds of point are worth distinguishing:
The predicted optimum (the star) maximizes the combined score.
The proposed robust setpoint (1.0% magnesium stearate, 6 minutes) is chosen so that normal variation, the dashed ellipse, stays inside the region.
The edge of failure is the boundary beyond which a quality attribute fails. ICH Q8(R2) notes that it can be useful to know where it lies22.
The robust setpoint differs from the score-maximizing point because distance from failure boundaries matters. The overlay is also drawn from mean predictions: near a boundary, a batch predicted to dissolve 86% has a real chance of falling below 85%. Draw edges using prediction intervals or the probability of meeting every criterion, as Week 8 did for the MODR.
The plotted region is conditional on the assumed material conditions; other CQAs, including content uniformity and disintegration, still need evidence. Select a robust setpoint sufficiently distant from failure boundaries, taking expected material, equipment and process variation into account. Independent confirmation runs test whether the model predicts adequately at the setpoint, and targeted robustness experiments test small deliberate perturbations around it. Scale-up, sampling and other practical sources of variability must also be addressed.
ICH Q8(R2) defines the design space as “the multidimensional combination and interaction of input variables (e.g., material attributes) and process parameters that have been demonstrated to provide assurance of quality”22. Demonstrated is doing the work: a fitted contour alone is not a demonstrated design space. ICH Q14 applies the same logic to analytical procedures23:
ICH Q8: manufacturing
ICH Q14: analytical procedures
Material attributes and process parameters
Analytical procedure parameters
Product CQAs
Performance criteria from the analytical target profile
Return to the FMEA. Which risks have been better characterized? Which remain uncertain? Screening reduces uncertainty; effective controls reduce actual risk. A negligible effect within the studied range does not establish irrelevance outside that range.
6. Technology transfer and sustained quality
Development knowledge informs technology transfer, manufacturing controls and continued process verification. The trend and dashed monitoring limits are schematic, not actual control limits.
The deliverable of R&D is not merely a statistical report. It is actionable knowledge that informs the manufacturing recipe and control strategy. Relevant material specifications, process setpoints and ranges, in-process checks, sampling requirements and monitoring procedures are transferred through a controlled process. The ISA-88 structure helps organize those decisions across unit operations, while the pharmaceutical quality system governs implementation and change.
ICH Q8 addresses pharmaceutical development and design space; Q9 addresses quality risk management; Q10 establishes the pharmaceutical quality system and emphasizes knowledge management; Q11 addresses drug-substance development and manufacture, including attributes such as API particle size; and Q12 provides a framework for post-approval lifecycle changes. ISA-88 is complementary process architecture, not a mandated element of those guidelines. For analytical procedures, ICH Q14 and Q2(R2) provide analogous development and validation concepts.
Technology transfer is a two-way exchange of knowledge, not simply a handoff of documents. The receiving site needs the scientific rationale for each material specification, process setting and monitoring requirement, as well as known interactions and unresolved risks. Scale-up and equipment differences may require further studies. In the FDA lifecycle approach, process design is followed by process qualification (including process performance qualification, PPQ) and continued process verification (CPV) during routine manufacture24. These validation stages are distinct from the screening and optimization stages of DoE. Qualification and later commercial evidence can refine the original understanding under appropriate change control.
Manufacturing experience then feeds back into development. Continued process verification, trend analysis and investigations identify emerging variability or drift. Changes are assessed through the quality system and supported by appropriate evidence. Predictive models can be strengthened with designed variation, reducing dependence on incidental historical associations; their own intended use and lifecycle controls still require attention, as reading 2 argued.
7. The learning pharmaceutical organization
Two connected feedback loops: product learning improves the existing product and its controls; platform learning informs future product development. The shared repository and ISA-88-inspired architecture are proposed implementation approaches, not system designs prescribed by ICH Q10.
The development program does not end when R&D transfers the recipe. A company may manufacture Product T for decades. During that time, production provides evidence about raw material variability, equipment differences, scale, process capability, analytical performance and product stability. The value of that experience depends on whether the organization can turn it into accessible, scientifically qualified knowledge.
Two feedback loops: product learning and platform learning
Product-specific learning begins with a defined product and its control strategy. Suppose continued process verification detects a gradual decrease in Product T dissolution, even though blend time and lubricant level remain within their established limits. A cross-functional team reviews API particle-size distributions, supplier changes, blending equipment, analytical method performance and the relevant development experiments. Historical associations generate hypotheses; a targeted experiment may be needed to distinguish competing explanations. The team records its conclusions and remaining uncertainty, reassesses the FMEA, and evaluates any proposed change through the quality system. A trend alone is not authorization to change a recipe or a registered condition.
Platform learning extends the benefit beyond Product T. Imagine thirty immediate-release tablet development programs, each investigating similar operations. The scientist developing Product 31 should be able to retrieve relevant prior studies of lubricant concentration, blend time and dissolution, including conditions that failed. That evidence can inform initial factor selection, experimental ranges, analytical targets and the initial FMEA, and so reduce unnecessary experiments. Prior knowledge is not a substitute for demonstrating suitability for the new product: transferability depends on the formulation, API properties, equipment, scale, process mechanism and intended quality attributes.
The platform recipe as a knowledge structure
The ISA-88-inspired recipe gives a consistent way to locate knowledge by unit operation. It connects development experiments with commercial experience without assuming that every product uses identical equipment or settings.
Unit operation
Development knowledge
Commercial evidence
Reusable platform knowledge
Dispense
API attributes and material studies
Supplier and lot variability
Material characterization strategy
Granulate
Water addition and mixing experiments
Equipment and scale effects
Candidate factors and scale-up considerations
Dry
Moisture endpoint studies
Seasonal and inlet-air trends
Drying risks and monitoring approaches
Blend
Lubricant level × blend time studies
Uniformity and dissolution trends
Lubrication mechanisms and prior experimental ranges
Compress
Force versus tablet properties
Tooling wear and press variability
Compression risk and control patterns
Coat
Spray rate and temperature studies
Coating defects and performance
Coating development and monitoring strategy
For each knowledge item, retain the product and process context, source study or batch record, experimental ranges, response methods, model version, uncertainty, conclusions, limitations, approval status and responsible owner. Link the record to the relevant failure mode, material attribute, process parameter and CQA. Preserve source evidence and version history rather than replacing them with an unsupported summary. Negative experiments and unresolved effects are knowledge too.
ICH Q10: the system that closes the loops
ICH Q10 names knowledge management and quality risk management as the two enablers of the pharmaceutical quality system (PQS). Its four system elements give practical routes for organizational learning across the lifecycle25:
PQS element
Contribution to learning
Process performance and product quality monitoring
Detect shifts and characterize process variability
Corrective action and preventive action (CAPA)
Investigate causes, address systemic issues and verify effectiveness
Change management
Evaluate proposed improvements, implement them under appropriate controls and assess their outcomes
Management review
Evaluate system performance, prioritize resources and identify improvements across products and sites
Knowledge management is how evidence is captured, assessed, shared and made available for future decisions. Quality risk management helps decide which evidence is needed and which actions are justified. Together they connect R&D, manufacturing, analytical science, quality, regulatory affairs and engineering. Product-specific changes remain subject to the appropriate quality and regulatory controls, and platform knowledge must be evaluated before reuse.
From data to organizational wisdom
Return to Week 1: Knowledge Management. Individual measurements are data; trends and model outputs provide information; experimentally supported explanations and qualified manufacturing experience become knowledge; applying that knowledge appropriately to a new product or control strategy is wisdom. DoE moves information towards knowledge, and the PQS makes that knowledge actionable and reusable.
This is the organizational return on investment from pharmaceutical development: every study can strengthen the current product and, where its applicability is justified, improve the next development program.
R&D creates knowledge. Manufacturing generates experience. Knowledge management turns both into organizational capability.
Machine learning and DoE work together
Machine learning and designed experiments answer different questions and feed each other.
Stage
Question answered
Output
Machine learning on historical data
What patterns exist?
Hypotheses
Risk assessment (FMEA)
Which hypotheses matter most?
Prioritized candidate factors
Screening DoE
Which factors matter?
The important factors
Optimization DoE
How do those factors behave?
Response surfaces
Multiple-response optimization
Where are all quality requirements met?
A candidate operating region
Confirmation and robustness
Can we reliably operate there?
Experimental evidence
Technology transfer and control strategy
How do we keep it there?
Sustained quality
Commercial data complete the cycle. A newly detected pattern can prompt a revised FMEA or a targeted experiment, while designed variation can improve future predictive models. A calibration set for an NIR potency model, for example, should vary API concentration independently of moisture and particle size where feasible, so that the model cannot lean on a correlation that will not hold in production. Model updates need their own assessment and lifecycle controls. Capture the experimental conditions, assumptions, limitations and evidence in a form other product teams can evaluate and reuse.
Where the analyst sits
The analyst is the person in the room who asks “did this factor vary, and what varied with it?” before a model’s importance ranking becomes a process change. They choose the experimental stage that fits the question, write down the aliasing, and do not let a convenient interpretation of an aliased effect stand in for a follow-up experiment, or a predicted optimum stand in for a demonstrated operating region. Their role is to translate uncertainty into purposeful experiments and translate experimental knowledge into reliable decisions.
For discussion
Why might the best-controlled process parameter appear unimportant in historical data?
When would a resolution III screen be insufficient given an FMEA finding?
How do a fold-over and axial points solve different scientific problems?
Why might a robust manufacturing setpoint differ from the mathematical optimum?
What additional evidence would be needed before controlling API particle size within a narrower range?
Why does a categorical supplier factor require separate pseudo-centre points?
What knowledge should transfer from development to the ISA-88 recipe, and how should manufacturing feed new knowledge back?
A commercial trend suggests slower dissolution despite a controlled blend time. What evidence should be reviewed, and when would a follow-up DoE be appropriate?
What knowledge from Product T could inform Product 31, and what differences would prevent direct reuse?
How do the four ICH Q10 system elements and its two enablers help turn commercial experience into organizational learning?
Product T, its factor ranges, response values, effect sizes and design-space diagrams are constructed for teaching. This reading does not establish a validated process or actual product specifications.
M. E. Aulton and K. M. G. Taylor (eds.), Aulton’s Pharmaceutics, 5th ed. (Elsevier, 2018), chapters on tableting excipients, for the effect of magnesium stearate blending on dissolution. ↩︎
G. E. P. Box, “Use and Abuse of Regression,” Technometrics 8(4) (1966) 625–629. DOI. ↩︎
R. A. Fisher, The Design of Experiments (Oliver and Boyd, 1935). ↩︎
R. A. Fisher, “The Arrangement of Field Experiments,” Journal of the Ministry of Agriculture of Great Britain 33 (1926) 503–513. ↩︎
R. A. Fisher, Presidential address to the First Indian Statistical Congress, Sankhyā 4 (1938) 14–17. ↩︎
ISA-88 (IEC 61512), Batch Control, series of standards. ↩︎
G. E. P. Box, J. S. Hunter and W. G. Hunter, Statistics for Experimenters, 2nd ed. (Wiley, 2005). ↩︎
Minitab, “Phases of a designed experiment,” Minitab Help. Link. ↩︎
B. Jones and C. J. Nachtsheim, “A Class of Three-Level Designs for Definitive Screening in the Presence of Second-Order Effects,” Journal of Quality Technology 43(1) (2011) 1–15. ↩︎
Minitab, “How Minitab adds center points,” Minitab Help. Link. ↩︎
Minitab Blog, “Design of Experiments: Fractionating and Folding a DOE.” Link. ↩︎
Minitab, “What is folding?,” Minitab Help. Link. ↩︎
R. L. Plackett and J. P. Burman, “The Design of Optimum Multifactorial Experiments,” Biometrika 33(4) (1946) 305–325. DOI. ↩︎
U. Grömping, “R Package FrF2 for Creating and Analyzing Fractional Factorial 2-Level Designs,” Journal of Statistical Software 56(1) (2014). DOI. ↩︎
G. E. P. Box and K. B. Wilson, “On the Experimental Attainment of Optimum Conditions,” Journal of the Royal Statistical Society B 13(1) (1951) 1–45. ↩︎
G. E. P. Box and D. W. Behnken, “Some New Three Level Designs for the Study of Quantitative Variables,” Technometrics 2(4) (1960) 455–475. ↩︎
Minitab, “Response surface central composite and Box-Behnken designs,” Minitab Help. Link. ↩︎
NIST/SEMATECH, “Central composite designs,” e-Handbook of Statistical Methods. Link. ↩︎
R. V. Lenth, “Response-Surface Methods in R, Using rsm,” Journal of Statistical Software 32(7) (2009). DOI. ↩︎
G. Derringer and R. Suich, “Simultaneous Optimization of Several Response Variables,” Journal of Quality Technology 12(4) (1980) 214–219. ↩︎
ICH, Q8(R2) Pharmaceutical Development (2009). The other quality guidelines cited (Q9(R1), Q10, Q11, Q12, Q14, Q2(R2)) are at ich.org. ↩︎↩︎
ICH, Q14 Analytical Procedure Development (2023). ↩︎
FDA, Process Validation: General Principles and Practices, Guidance for Industry (January 2011). Link. ↩︎
ICH, Q10 Pharmaceutical Quality System (2008), particularly sections 1.6 and 3.2. FDA page. ↩︎
4 - From Raw Signal to Resolved Signal
Clean and align analytical signals, investigate overlapping components with MCR-ALS and PARAFAC, and connect spectral flow cytometry to the same mathematical framework.
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 stability case: 90 HPLC-DAD chromatograms, three column lots and 18 months. Column lot 3 elutes about 4% later. The traces and the overview PCA panels are schematic; Figure 2B below is calculated from the exercise data. The overlap panel uses the same component centres as Figure 3: minor at 4.98 min, API at 5.02 min.
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
Alignment methods differ in flexibility. The time offsets illustrate possible correction shapes; they are not fitted warps from Product T. The new shoulder must be investigated, not forced into agreement with the reference.
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
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% laterreference/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 chromatogramsamp=lot3_traces,# rows = chromatogramsinit.coef=c(0,1,0),# start from "no warp": shift 0, stretch 1, curve 0warp.type="global")# one warp for all samples of this lotaligned<-fit$warped.samplefit$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
Calculated from the exercise's synthetic dataset, not a schematic. The minor component is centred at 4.98 min and the API at 5.02 min. The largest absolute PC3 loading is near 4.97 min: a loading maximum need not coincide exactly with the centre of a chemical peak. PCA signs are arbitrary.
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.
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
Multivariate curve resolution works on a matrix of absorbance across time and wavelength. The profiles and spectra shown are the simulation's ground truth (the exercise's DAD window), not an independently fitted MCR solution or identified Product T 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 D
: 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:
D=CST+E
Matrix
Dimensions
Scientific interpretation
D
time points × wavelengths
Observed absorbance
C
time points × components
Elution (concentration) profiles
S
wavelengths × components
Pure-component spectra
E
time points × wavelengths
Residual the model does not explain
Multivariate curve resolution by alternating least squares (MCR-ALS) estimates both C
and S5. Start from a guess at S
, solve for C
by least squares, use C
to solve for S
, 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 spectraplotContributions(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 T
,
CST=(CT)(T−1ST)
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 three-way array can supply structural information a single matrix lacks. The EEMs are simulated. Essential uniqueness depends on appropriate rank, distinguishable profiles and the model's assumptions holding.
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:
Xijk≈r=1∑Rairbjrckr
Here a
describes how component r
varies across samples, b
its excitation spectrum and c
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
Spectral flow cytometry uses reference signatures to estimate each cell's component signals. The signatures and bars are the idealized ones in the R example below: simulated relative abundances, not molecule counts or measured cell-therapy results.
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 D=CST+E
again, one row per cell, with a different reading of the matrices:
HPLC-DAD MCR-ALS
Spectral flow unmixing
Row of D
Chromatographic time point
Individual cell event
Column of D
Wavelength
Detector channel
S
Component spectra, possibly unknown
Measured reference signatures
C
Estimated elution profiles
Estimated fluorescence contributions
Main challenge
Identifiability and chemical constraints
Reference quality and spectral similarity
Here S
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:24g<-function(x,mu,sigma)exp(-0.5*((x-mu)/sigma)^2)# Gaussian signatureS<-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))# autofluorescencetruth<-c(A=1.20,B=0.65,C=0.90,Auto=0.40)y<-drop(S%*%truth)# one cell's measured emissionestimate<-qr.solve(S,y)# least-squares unmixinground(estimate,2)# A B C Auto# 1.20 0.65 0.90 0.40barplot(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?
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?
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. ↩︎
5 - Watching a Biologic Batch Grow
Follow a CHO fed-batch from Raman soft sensors and three-way batch data through maturity alignment, multivariate monitoring, investigation and lifecycle learning.
The one idea
A batch process is judged by its whole path, not its endpoint. Multivariate batch monitoring asks, at every hour, whether this batch is travelling the way good batches travelled, and points to which variables are off course.
Week 11 followed a continuous tablet line, where the question is whether this minute’s material is in control. A biologic fed-batch asks a different question: is this batch’s history so far normal? The tools from Week 11 reading 7, PCA scores, Hotelling’s T² and the Q residual, carry over. What changes is the shape of the data and the meaning of time. The aim is to understand and control the process while the product is being made, rather than depend entirely on tests after harvest.
The physical process and its measurement streams. The vessel is an illustrative rendering, not an engineering drawing. Capacitance responds to viable biomass; converting it to viable cell density needs calibration. Stage timing is product-specific.
A Chinese hamster ovary (CHO) cell line makes a monoclonal antibody in a 2,000 L fed-batch bioreactor over about 14 days. Feeds add nutrients during the run, without the continuous harvest of a perfusion process. The impeller and sparger provide mixing and gas transfer; pH, dissolved oxygen and temperature are controlled. The cells change their own environment as they grow, so the relationships among the variables shift over the batch.
Data stream
Frequency
Examples
Process sensors
Every minute
pH, dissolved oxygen, temperature, agitation, gas flows, base addition
These streams measure different things. A pH probe gives an electrochemical response. A Raman instrument gives a spectrum from which a concentration is inferred. A feed-pump record is an actuator setting, not a measure of metabolism. Treating them as interchangeable columns hides that difference.
A typical culture grows, shifts toward production as growth slows, keeps accumulating titer, and is harvested as viability falls. The exact profile depends on the cell line, medium and feeding strategy.
Batch 27 looks normal on every individual chart. Every variable is inside its own limits. At day 6, the multivariate monitoring screen flags it.
Teaching question: Is 2 g/L glucose acceptable? Before answering, ask about the product, the stage of the batch and the feeding strategy.
Raman as a soft sensor
The soft sensor turns a spectrum into an estimated concentration. Historical glucose and lactate rise together; a designed calibration breaks that correlation. The plots are simulated, and the feedback loop shows a possible application, not a validated control system.
Raman spectroscopy measures light scattered inelastically by molecular vibrations, through a probe in the vessel wall. Water is a weak Raman scatterer, which is why Raman suits aqueous culture better than NIR, although fluorescence and other matrix effects still matter. A culture spectrum holds contributions from many molecules, so a PLS model, built as in Week 11, converts each spectrum into metabolite concentrations, calibrated against off-line reference analysers. For one analyte the prediction is
y^=b0+xTb
where x
is the preprocessed spectrum, b
the fitted coefficients and y^
the predicted concentration.
This is a soft sensor: the probe, acquisition settings, preprocessing and calibration together. A Raman glucose value is an inference from a model, with an applicability domain, not a direct glucose measurement. Abu-Absi and colleagues showed in-line Raman estimation of several culture parameters at 500 L1. That shows the approach is feasible; it does not show that a model calibrated for one process will work in another.
Designed calibration versus happenstance data
In ordinary batches glucose and lactate move together. A model trained on those batches can learn to predict glucose from lactate’s spectral bands. It will cross-validate well and then fail on the first batch where the metabolic relationship changes, which is exactly the batch you most need it for.
That is reading 3’s lesson applied to a calibration set. Build in designed variation, such as glucose spiked independently of lactate, so that each analyte has to be predicted from its own signal. Cover the media lots, cell lines, stages and scales the model will meet. Spiked samples improve chemical discrimination but do not replace representative process samples. When estimating performance, keep all samples from one batch in the same fold, for the reason given in reading 1.
From prediction to control
The prize is control, not just monitoring: hourly glucose predictions can drive the feed pump in a closed loop. The controller must then cope with prediction error, measurement delay, pump limits and an invalid prediction. An applicability-domain check, sensor health checks and a predefined fallback belong in the design. A failed soft sensor must not silently drive the process.
Under ICH Q14 and Q2(R2)2, the model and its preprocessing are part of an analytical procedure whose performance must be shown for its intended use. A model good enough for trending is not automatically good enough for closed-loop control.
Batch data is a cube
Twenty aligned batches, ten variables and 336 hourly records, unfolded two ways. The heatmaps show matrix shapes, not measurements.
Each batch gives a table of variables over time. Stack the batches and you get a three-way array,
X∈RI×J×K
with I
batches, J
variables and K
aligned time points. Twenty batches, ten variables and 336 hourly records give 20×10×336=67,200
entries.
The choice of observational unit matters as much here as in reading 1, where a dissolution vessel was not a batch. An hour of a bioreactor run is not an independent run either. Instruments also report at different rates, so before building the cube, set rules for sampling or aggregating, handle missing values, and keep the batch and time stamp on every row. A daily lab result copied into 24 hourly rows is still one result.
Classical PCA needs a matrix, so the cube is unfolded. Unfolding rearranges the data; it creates no new observations. The two ways of doing it answer different questions3,4.
Unfolding
Shape
Example
One row is
Question it answers
Batch-wise
I×JK
20 × 3,360
A whole batch
Was this batch, taken as a whole, like the good ones? How does its trajectory relate to final quality (titer, glycan profile)?
Observation-wise
IK×J
6,720 × 10
One time point of one batch
Is this batch, right now, where good batches were at this stage? This is the batch evolution model
Nomikos and MacGregor introduced batch-wise multiway PCA for batch monitoring in 19943. Wold and colleagues developed the observation-wise batch evolution approach in 19984. A batch-wise model can be used on a running batch only with an established method for filling in the hours that have not happened yet; feeding it the batch’s real future values would be leakage.
In R: an observation-wise control chart
In tidy terms, the stored data are one long table with one row per batch, hour and variable. Unfolding is a choice of how to pivot it. The sketch assumes every batch, Batch 27 included, has already been aligned to a common time axis and is complete, and that good_batches was chosen in advance.
library(tidyverse)ref<-runs|># long, tidy: batch, hour, variable, valuefilter(batch%in%good_batches)|>pivot_wider(names_from=variable,# observation-wise: one row per batch-hourvalues_from=value)variables<-setdiff(names(ref),c("batch","hour"))pca<-prcomp(select(ref,all_of(variables)),# fit on reference batches onlycenter=TRUE,scale.=TRUE,rank.=3)envelope<-ref|>mutate(t1=pca$x[,1])|>group_by(hour)|>summarise(mid=mean(t1),lo=mid-3*sd(t1),hi=mid+3*sd(t1))# the normal path of PC1, with limitsbatch27<-runs|>filter(batch==27)|>pivot_wider(names_from=variable,values_from=value)chart<-batch27|>mutate(t1=predict(pca,select(batch27,all_of(variables)))[,1])|># frozen centring, scaling, loadingsleft_join(envelope,by="hour")
Plot t1 hour by hour against lo, mid and hi, and you have a batch control chart. Batch 27 is projected with the reference model’s centring, scaling and loadings; it never influences them. The mean ± 3 SD band is a teaching choice, not a validated limit. A full batch evolution model regresses on batch maturity with PLS rather than plain PCA, and adds T² and Q at every time point. In practice you would also remove constant variables before scaling, choose the number of components deliberately, and check the false-alarm rate on batches the model has not seen.
Teaching question: Are the 6,720 rows 6,720 independent observations? No. Rows from the same batch share a history, and neighbouring hours are correlated.
Batches are not the same length
A 10-hour delay, aligned by comparing equivalent stages of growth. The mapping here is a simple shift; real dynamic time warping can stretch and compress locally. The abnormal batch stays distinct after alignment.
Batch 27 was inoculated at a slightly lower cell density and is running about 10 hours behind. Comparing hour 140 with hour 140 compares different stages of growth. Two fixes:
Align on a maturity variable that tracks progress better than clock time, such as cumulative glucose consumed or integrated viable cell density (IVCD), the area under the viable cell density curve. Either works only if it suits the process and is measured reliably.
Align by dynamic time warping, the same algorithm used for chromatograms, applied to whole batch trajectories to match equivalent stages of growth rather than equivalent peaks. Kassidas, MacGregor and Taylor showed this for batch monitoring in 19985.
The caution from chromatography applies with more force: a warp flexible enough can make an abnormal batch look normal. The warping path itself is a diagnostic. A batch that needed severe warping is unusual, and a 10-hour delay may deserve investigation in its own right. Look at the original time axis, the aligned trajectory and the mapping together, and constrain the warp on scientific grounds. For online monitoring, compute the mapping only from data available so far, never from the batch’s future.
Teaching question: A batch lines up perfectly, but only after a large warp. Is it normal? Why might the delay itself matter for quality or for the manufacturing schedule?
The “golden batch” and why one is not enough
One reference batch gives a path but no spread. A population of good batches gives both. Right: T² and Q have separate limits. A large T² is an extreme position along the modelled direction; a large Q is variation the model does not explain. The envelope and geometry are illustrative, not established control limits.
The phrase golden batch means a reference trajectory to compare against. Taken literally, one best batch, it is a weak standard: a single batch has no variance, so it cannot say how far from it is still normal. The working version is a set of good batches, which defines both the normal path and the normal spread around it. That spread is the control limit. Twenty is an example, not a required minimum; what matters is that the set covers acceptable operation.
For a new biologic this is hard. A commercial product may make only a handful of batches a year, and development batches often come from smaller vessels where mixing, gas transfer and sensor response differ. Which batches count as reference needs written inclusion criteria and a scientific judgment, not whatever historical records are convenient.
Scores, T² and Q
For a centred and scaled observation x
, let P
hold the retained PCA loadings. Then
t=PTx,e=x−Pt
The scores t
locate the observation in the model; the residual e
is what the model cannot reconstruct. With Λ
the diagonal matrix of score variances,
T2=tTΛ−1t,Q=eTe=j∑ej2
Statistic
Asks
Scores
Where is this observation in the modelled space?
T²
Is it extreme along directions the reference batches vary in?
Q (SPE)
How much of it does the model fail to explain?
High T² with modest Q is an extreme case of a familiar pattern. High Q with modest T² is a combination the reference batches never showed. A change of equipment, calibration or stage can move either.
Control limits are not product specifications. Checking hundreds of correlated time points per batch produces false alarms, so the alarm rate has to be evaluated and every alarm needs a defined response.
What the day-6 alarm meant
The constructed Batch 27 case. Every variable stays inside its own limits and lactate is still rising; Q crosses its limit at day 6 while T² does not, and three variables carry most of the Q contribution. Schematic, not a fitted model.
Batch 27’s T² is inside its limit; its Q residual is not. In Week 11 terms, the batch is not extreme along the familiar directions of variation. It is moving in a direction the reference batches never moved. A contribution plot breaks the Q value into variables. Each ej2
is non-negative and together they sum to Q; the sign of the residual ej
then tells you which way the variable is off.
Variable
Contribution
Lactate (Raman)
Large; residual positive: still rising
Base addition
Large; residual positive: more base to hold pH
Ammonium (Raman)
Moderate; residual positive
All others
Small
In the reference batches, the cells switch from producing lactate to consuming it around day 4 to 6. That timing is process-specific, but here Batch 27 has not switched. Each variable alone is within range, because lactate at day 6 is normal in absolute terms. The combination, still rising alongside high base addition at this stage, is not. It suggests a metabolic or culture-environment difference; it does not prove a cause.
The monitoring system has detected that the batch is unusual. It has not shown that the product is bad. The next steps are the ones Week 11 practised:
Rule out the sensor. Is the Raman prediction in its applicability domain? Check against the off-line lactate result.
Investigate the cause. Inoculum, media and feed lots, a gas-transfer issue raising dissolved CO₂, and the alignment itself. Decide whether experiments are needed.
Connect to quality. Lactate accumulation and the changes that accompany it can affect quality attributes such as glycosylation. Characterization and release testing of the relevant critical quality attribute (CQA)s, such as glycan profile by liquid chromatography–mass spectrometry (LC–MS), aggregates by size-exclusion chromatography (SEC), charge variants and potency, decide the batch, not the control chart. The right panel depends on the product’s control strategy.
Feed the knowledge back. Update the risk assessment and decide whether the control strategy or the model should change. The model learns a new normal only through controlled change, as a model has a lifecycle.
The learning organization
Reading 3 followed knowledge from R&D’s designed experiments into manufacturing controls. Batch 27 runs the loop the other way: commercial manufacturing raises a new question about the biology, which may lead to targeted experiments, a better calibration set or a better control strategy.
Across many batches, the same scores and limits support continued process verification, Stage 3 of the US Food and Drug Administration (FDA)’s process validation lifecycle6. Monitoring results, investigations, CAPA and change management feed back into risk assessments through the pharmaceutical quality system (PQS). Before that knowledge is reused for another cell line, scale or site, it has to be checked there. A new reference population or model is a controlled change, never a quick response to an inconvenient alarm.
PAT makes process information available while it can still change a decision. The quality system turns that information into reliable action and knowledge that transfers.
Where the analyst sits
The analyst owns the soft-sensor calibrations and their applicability domain, and decides which batches count as reference and how time and missing data are handled. They judge whether alignment has hidden an anomaly, and read a contribution plot as a lead to investigate rather than a root cause. They decide which lessons from a batch are robust enough to inform future development. Above all, they keep two statements apart: “this batch is unusual” and “this batch’s product is unacceptable”.
For discussion
Why does a single golden batch make a poor control limit?
How could a batch-wise model monitor an incomplete batch without leaking future data?
Batch 27 is unusual on Q but normal on T². Explain the difference to a manufacturing supervisor in two sentences.
A Raman glucose model was calibrated at 200 L. What evidence would you need before trusting it at 2,000 L?
When could alignment hide a real difference in the biology, and how would you detect it?
How would you tell a Raman sensor problem from a real metabolic change?
What should be captured from Batch 27 for future development, and how would you decide whether it applies to other products?
Batch 27, its alarm, its contribution values and all trajectories, spectra and calibration plots in the figures are constructed for teaching.
N. R. Abu-Absi et al., “Real time monitoring of multiple parameters in mammalian cell culture bioreactors using an in-line Raman spectroscopy probe,” Biotechnology and Bioengineering 108(5) (2011) 1215–1221. DOI. ↩︎
ICH, Q14 Analytical Procedure Development (2023) and Q2(R2) Validation of Analytical Procedures (2023). ICH quality guidelines. ↩︎
P. Nomikos and J. F. MacGregor, “Monitoring batch processes using multiway principal component analysis,” AIChE Journal 40(8) (1994) 1361–1375. DOI. ↩︎↩︎
S. Wold, N. Kettaneh, H. Fridén and A. Holmberg, “Modelling and diagnostics of batch processes and analogous kinetic experiments,” Chemometrics and Intelligent Laboratory Systems 44 (1998) 331–340. DOI. ↩︎↩︎
A. Kassidas, J. F. MacGregor and P. A. Taylor, “Synchronization of batch trajectories using dynamic time warping,” AIChE Journal 44(4) (1998) 864–875. DOI. ↩︎
6 - Cells as Data: Flow Cytometry for CAR-T Release
A spectral flow panel gives every cell in a CAR-T product a 25-dimensional measurement. Manual gating, FlowSOM clustering and UMAP each see the data differently, batch effects masquerade as biology, and one patient per lot makes small-n honesty essential. The week’s chemometric discipline, applied to cells.
The one idea
A flow cytometry file is a data matrix: rows are cells, columns are markers. Everything this week, about observational units, preprocessing, unsupervised exploration, batch effects and small-n validation, applies to it.
Week 9’s flow cytometry readings treated the instrument and the gate as an analytical method: controls, compensation, template gating, counting and dose. This reading takes the next step. When a panel measures 25 markers on every cell, drawing gates by hand on two-dimensional plots stops scaling, and the analysis becomes a multivariate modeling problem.
The case: an autologous CAR-T lot
A chimeric antigen receptor T-cell (CAR-T) product is made from the patient’s own T cells. They are collected, engineered with a chimeric antigen receptor against CD19, expanded and returned to the same patient. Each lot is one patient.
Phenotype for process understanding and comparability
Exploratory, multivariate
The cell is both the product and the measured object. A focused release method and a broader characterization panel answer different questions.
Lot 0420 passes release. The characterization panel shows something the release gates never looked at.
Why gating by hand stops scaling
With n markers there are n(n − 1)/2 two-dimensional plots. Four markers give 6. Twenty-five give 300. Manual gating follows a hierarchy the analyst chooses in advance: live, then single cells, then CD3+, then CAR+. Every cell outside that path is never examined in the other dimensions. Gating is also a source of operator variability, which is why Week 9 insisted on templates.
A predefined gate is efficient for a defined analytical question; high-dimensional exploration can investigate populations outside that path.
Automated methods ask a different question: what populations exist in these 25 dimensions, without assuming the hierarchy? An international comparison of automated methods against expert manual gating (FlowCAP) found that the best algorithms reproduced manual results well. Combining several algorithms did better than any single one, the ensemble lesson from reading 2 again1.
Remove acquisition artefacts, doublets and dead cells
Removing bad spectra
Arcsinh transform
Fluorescence spans orders of magnitude, and unmixing gives values near and below zero. Arcsinh is log-like for bright signals and linear near zero
A transformation chosen for the measurement, like Yeo-Johnson
Per-marker scaling
Markers have different dynamic ranges
step_normalize
Batch normalization
Staining day, reagent lot and instrument shift intensities
Calibration transfer
library(flowCore)library(FlowSOM)ff<-read.FCS("lot_0420_unmixed_live_singlets.fcs")cols<-c("CD3","CD4","CD8","CAR","CD45RA","CCR7","CD27","PD-1","TIM-3","LAG-3","CD19","CD14","CD56")# marker channelsff<-transform(ff,transformList(cols,arcsinhTransform(b=1/150)))# cofactor 150fsom<-FlowSOM(ff,colsToUse=cols,scale=TRUE,xdim=10,ydim=10,# 100 small clusters on a self-organizing mapnClus=15,# merged into 15 metaclustersseed=2026)# clustering is stochastic, so fix the seedtable(GetMetaclusters(fsom))# cells per metaclusterPlotStars(fsom)# marker profile of each cluster
flowCore reads the FCS file and applies the transform2; FlowSOM does the clustering3. In practice the column names are the file’s channel names, mapped to markers. The reading here is what matters: transform, cluster, inspect.
FlowSOM and UMAP
Preprocessing determines the input to the model. FlowSOM groups cells by marker profiles; UMAP provides an exploratory view rather than a validated quantitative readout.
FlowSOM first assigns every cell to one of about 100 nodes on a self-organizing map, then merges those nodes into a chosen number of metaclusters3. It is fast enough for millions of cells and performed well in a benchmark of clustering methods for cytometry4. Each metacluster has a median marker profile that a biologist names: “CD8+ CAR+ effector memory”, “CD4+ CAR− naive”, and so on.
UMAP (and the older t-SNE) squeezes the 25 dimensions into a two-dimensional picture where similar cells sit near each other. It is excellent for seeing populations. It is not a measurement:
Distances between clusters, and cluster sizes, on a UMAP plot are not quantitatively meaningful.
The layout changes with random seed and settings.
Gating on a UMAP plot puts a validated decision on top of an unvalidated picture. Count events in the original marker space, using a defined procedure.
The rule is the same as for PCA score plots in Week 11: an exploration tool suggests where to look, and a defined, tested procedure makes the decision.
What the clustering found in lot 0420
One small metacluster, 0.3% of live cells, is CAR+ but CD3−. The release gating path (CD3+, then CAR+) never looks at CD3− cells for CAR expression, so these cells were invisible to it. They also stain dim for CD19.
An unexpected exploratory signal initiates investigation. It is neither proof of a malignant cell nor, by itself, a validated lot disposition criterion.
This is not an abstract worry. In one published case, a patient’s CAR-T product contained a single leukemic B cell that had been transduced with the CAR. The CAR bound CD19 on that same cell’s surface, masking it both from detection and from the patient’s CAR-T cells, and the clone expanded into a CAR-expressing, therapy-resistant relapse5. A marker that is supposed to identify a cell can be hidden by the product itself.
For lot 0420 the honest interim position is the one from Week 11’s capstone: separate what is known, what is inferred and what is unresolved. The cluster is real if it survives a different seed, a different number of metaclusters and a re-stain. Next come doublet and viability checks on those events. Its identity needs orthogonal evidence: B-cell markers not masked by CAR binding, and molecular methods. A 0.3% cluster in an exploratory panel does not by itself fail a lot. It does start an investigation, escalated through the quality system, and passing the routine specification does not remove the need to assess a credible new risk before disposition.
Batch effects masquerade as biology
Cluster products stained on different days, and you may find a cluster that is really a staining day: slightly brighter CD8 across every cell from one run. This is the column-lot problem from reading 4 in cytometry form. The defences are the same:
Run a shared reference sample (an aliquot of one control product, or beads) with every batch, as Week 9’s instrument trending did for single markers.
Normalize each batch to the reference before clustering. CytoNorm does this using the shared control6.
Randomize sample-to-batch assignment where you can (reading 3), so that run day cannot line up with the factor you are studying.
Normalization has its own risk. Applied carelessly, it can erase a genuine biological difference or hide an instrument that is out of control, so the reference sample’s own trend should be reviewed before it is used to correct anything.
One patient per lot: small n, many features
Millions of cells improve characterization within a patient, but a study with 40 patients still has only 40 patient-level observational units. Reference controls help reveal technical variation before modeling.
Autologous products break the assumptions behind reading 5’s “set of good batches”. Most lot-to-lot variability comes from the starting material: the patient’s age, disease and prior chemotherapy. It does not come from the process. There is no stable population of identical inputs from which to draw a normal envelope.
The pull, then, is to correlate product phenotype with clinical response. Studies have linked memory-like CAR-T phenotypes in the product with durable response7. But a typical dataset has 40 patients and hundreds of candidate features: every metacluster’s frequency, every marker’s intensity. With that ratio, some feature will correlate with response by chance alone. The safeguards are this week’s:
The patient is the observational unit. Cells are not; there are millions of them, and they are not independent evidence (reading 1).
Cross-validate by patient, and confirm in an independent cohort before believing a biomarker.
Prefer the simplest model that the evidence supports (reading 2).
A correlation between phenotype and response is a hypothesis about cause, to be tested by changing the process (reading 3).
Where release sits, and where this sits
Release decisions for cell therapy use validated, template-gated methods with defined controls. Clustering is itself a model, with a seed, a cluster count and a training set, so it would need its own validation before it could make a release call. Today high-dimensional analysis mainly supports characterization, process development, investigations and comparability after a process change, where ICH Q5E asks whether quality attributes are highly similar before and after. Panels and analyses that prove their worth there are how future release methods get designed. Moving one into release means fixing its intended purpose, locking the preprocessing and model settings, validating it and managing it over its lifecycle, the path ICH Q14 describes for any analytical procedure.
Exploration generates questions; scientific evidence and fit-for-purpose methods support decisions. The analyst remains responsible for connecting measurements, models and patient-relevant quality risks.
Where the analyst sits
The analyst decides what counts as an observation (cell, sample or patient), checks that a cluster survives reasonable changes to the analysis, and recognizes a batch effect before it is named as biology. They keep exploratory pictures out of release decisions and report a surprising population as an open question with a plan.
For discussion
Why could the release gating path never detect the CAR+ CD3− population?
Give two ways to tell a real rare population from a clustering artefact.
A study finds that 3 of 200 phenotype features predict response in 40 patients. What would you need before using any of them in a specification?
How is a staining-day batch effect like a column-lot effect in HPLC, and how is each corrected?
Bridge back to the week
This is the last reading. Return to Week 12 for the M7 case, the capstone and the presentations.
Sources
Lot 0420, its panels and the CAR+ CD3− cluster are constructed for teaching. The transduced-leukemic-cell case5 is real. The figures are schematic teaching illustrations, not experimental data.
N. Aghaeepour et al., “Critical assessment of automated flow cytometry data analysis techniques,” Nature Methods 10(3) (2013) 228–238. DOI. ↩︎
F. Hahne et al., “flowCore: a Bioconductor package for high throughput flow cytometry,” BMC Bioinformatics 10 (2009) 106. DOI. ↩︎
S. Van Gassen et al., “FlowSOM: Using self-organizing maps for visualization and interpretation of cytometry data,” Cytometry Part A 87(7) (2015) 636–645. DOI. R package on Bioconductor. ↩︎↩︎
L. M. Weber and M. D. Robinson, “Comparison of clustering methods for high-dimensional single-cell flow and mass cytometry data,” Cytometry Part A 89(12) (2016) 1084–1096. DOI. ↩︎
M. Ruella et al., “Induction of resistance to chimeric antigen receptor T cell therapy by transduction of a single leukemic B cell,” Nature Medicine 24 (2018) 1499–1503. DOI. ↩︎↩︎
S. Van Gassen et al., “CytoNorm: A Normalization Algorithm for Cytometry Data,” Cytometry Part A 97(3) (2020) 268–278. DOI. ↩︎
J. A. Fraietta et al., “Determinants of response and resistance to CD19 chimeric antigen receptor (CAR) T cell therapy of chronic lymphocytic leukemia,” Nature Medicine 24 (2018) 563–571. DOI. ↩︎