Non classé 19.02.2026

Validating a chemometric model: R², RMSEP and RMSEC explained

Julie
valider un modèle chimiométrique : r², rmsec et rmsep
INDEX +

Are you trying to untangle what your metrics really say when it's time to validate a chemometric model: R², RMSEP and RMSEC explained? Behind these three acronyms, there are concrete decisions to make in order to deliver a reliable model, usable in the field and not merely appealing in a report. I have supported R&D and quality control teams for years; the same questions keep coming up. This guide gathers the guidelines that would have saved me time in my early days, with concrete examples and advice drawn from daily practice.

Validating a chemometric model: R², RMSEP and RMSEC explained

These three indicators answer different questions. measures the portion of variability explained by the model. RMSEC evaluates the average error during the fitting phase, on the set used to build the relationship. RMSEP looks at the error on new data, the ones that matter once the model is deployed. One can have an impressive R² and a disappointing RMSEP; this is even a classic scenario when the model overfits the training data. The art is to balance explanatory power and generalization capacity.

Two verification mechanisms serve as guardrails: a well‑designed cross‑validation to estimate internal stability, and an independent test set to gauge real performance. The two are complementary, not interchangeable. One helps you tune the complexity, the other confirms robustness under conditions close to application.

R² in practice: what the coefficient of determination says

When you read an R² of 0.92, you may be tempted to relax. Yet, this number does not guarantee accuracy or correctness. The coefficient of determination often increases with complexity; you can inflate it by stacking components, at the cost of out‑of‑sample fragility. The trick is to compare R² with the measurement scale and the intended use: predicting moisture contents to ±0.2% does not entail the same demand as a trace‑level measurement at the ppb level.

If you must set priorities, compare R² with a metric expressed in the same units as your property of interest. A mean prediction error in percent or in absolute units speaks immediately to an operator, much more than an abstract R². To ground the decision, also look at the residuals and their distribution: structure, drift, and asymmetry are valuable clues.

RMSEC and RMSEP: two errors, two questions different

The RMSEC answers: “Does the model fit the calibration data well?” The RMSEP answers: “Will it be good on new samples?”. If RMSEC ≪ RMSEP, the model “remembers” its training set; this is often a sign of a calibration bias or excessive complexity. Conversely, similar and low values suggest a healthy compromise.

I like to complement these figures with confidence intervals, obtained via bootstrap or resampling. The point estimate reassures; the interval tells the expected variability in production. Two models with identical RMSEP but different uncertainties are not equally valued for a pilot line subjected to fluctuating matrices.

How to validate a chemometric model without getting it wrong

Thoughtful sampling

The biggest lever is pulled before the algorithm. Represent the real variability: lots, sites, suppliers, seasons, operators, instruments. Mix calibrations and validations within coherent blocks rather than naive random draws. This design avoids over‑optimism and prepares the model to face its real life.

Tuning complexity

For multivariate regression, we choose the number of latent components based on the RMSE curve as a function of dimension. A clear elbow, stability in cross‑validation, and then confirmation on external test: this triple check helps avoid overdimensioning. The family of methods PLS and PCR respond differently to noise and collinearities; a reasoned comparison helps decide. A dedicated guide details the choices: PCR or PLS.

Test robustness

Evaluate RMSEP under “stress” conditions close to the extreme cases expected: changes in ambient humidity, twin spectrometers, and atypical lots. Document potential drift and sensitivity to preprocessing. A useful link to frame these steps: the preprocessing of spectral data. A model that stays stable when you tweak the sliders inspires greater confidence for quality control.

Interpréter les chiffres avec contexte

RMSEP is expressed in the business unit; compare it to the industrial tolerance. If the specification allows ±0.5% and your RMSEP is 0.18%, you have margin. If the margin tightens, look at the actual operating window: concentration ranges, matrix heterogeneity, surface state, and temperature. Metrics value context as much as we love smooth curves.

Also look at local linearity. A model may work well in the center of the range and struggle at the ends. Segment the range or recalibrate with enriched sampling at the edges, which often resolves this tendency without sacrificing overall simplicity.

Pièges courants et signaux d’alerte

  • RMSEC very low, RMSEP much higher: suspicion of overfitting or calibration‑test misalignment.
  • High R², structured residuals: incomplete model (missing reactive pathway, instrumental artifact, leaky baseline).
  • Performance drops after a new batch: non‑stationary distribution, need for a model maintenance plan.
  • Presence of influential outliers: imperative diagnostic before any rejection decision. A rare point is not necessarily an error; it may reveal a new regime.

Exemple pas à pas sur des spectres NIR

Real‑world case in agriculture: estimating flour moisture by near‑infrared spectroscopy. Data collected over six months, 180 samples, three wheat varieties, two instruments. Preprocessing SNV + first derivative, selection of 1100–2400 nm. Partition by production lots to separate calibration (70%) and test (30%). Operational objective: accuracy better than ±0.3%.

We build a PLS regression. Error curve as a function of dimension: elbow at 6 components. Calibration R² = 0.98; RMSEC = 0.12%. On the external test: RMSEP = 0.24%. Residuals are centered, no apparent structure, two samples at the ends of the range show a slight underestimation. We add 12 targeted samples at the extremes, recalculate: RMSEP drops to 0.20% and local linearity improves. The model goes into production with a quarterly monitoring plan.

Bonnes pratiques pour des métriques fiables

  • Document the sampling protocol: who, when, how, and under what conditions.
  • Stabilize acquisition: same cuvette, same layer thickness, same integration time.
  • Standardize the spectral preprocessing and record each parameter for traceability.
  • Set up an internal control batch to track drift over time.
  • Report metrics with uncertainties and business units; not just dimensionless indices.
  • Keep a frozen test set for key milestones; avoid “consuming” it through iterations.

Que faire si R² est haut mais RMSEP reste élevé?

First diagnose the match between calibration and test distributions: same concentration range, same matrices, same preparation? Then check sensitivity to preprocessing and the stability of the coefficients. A measured reduction in complexity (fewer components) sometimes limits out‑of‑sample variance. Another path: enrich the training base with the conditions that pose problems, rather than increasing algorithmic sophistication.

When the physics of the signal allows, revisit the spectral window and remove regions dominated by noise or interference. An instrumental alignment and a baseline check often yield more than any tuning of the latest generation.

Rappels rapides et tableau de synthèse

R² tells the explained proportion, RMSEC the quality of fit, RMSEP the predictive performance. The three are read together, with an eye on the final use and industry tolerances. A useful model is recognized as much by its stability as by its accuracy. Transparency of reporting and reproducibility of steps matter for credibility with operators and auditors.

Indicator What it measures When to use What to watch
Proportion of explained variance Use when comparing models of similar complexity May seem high even if prediction is mediocre
RMSEC Mean error on the calibration set Tune complexity, detect overfit Naturally optimistic; always compare it to RMSEP
RMSEP Mean error on new data Estimate real performance Sensitive to test design and distribution shift

If you are starting a new project, a simple through-line: frame the operational objective, build a representative set, choose the appropriate algorithm, validate honestly, document every choice. To deepen the choice of multivariate algorithms, the PCR or PLS comparison will give you clear guidelines. And for robust spectral data, take a look at the preprocessing of spectral data before touching the hyperparameters.

I close with a field‑tested conviction: a good model is judged less by the beauty of its curves than by the serenity it provides to the teams that use it. Let R², RMSEC and RMSEP speak together, in the language of your workshop. Decisions become simpler, and results more durable.

chimiometrie.fr – Tous droits réservés.