Spectra Lab — chemometrics in your browser

Spectra Lab: chemometrics software for near-infrared calibration, in your browser

Partial least squares regression (PLS), principal component analysis and spectral preprocessing (SNV, MSC, Savitzky-Golay) for near infrared spectroscopy (near-infrared, NIR) data — upload spectra, compare SNV, MSC and derivatives, validate with RMSECV and RPD, and flag outliers with Hotelling T2. No install, no vendor lock-in.

Works with spectra from any NIR instrument — if you can export it as a table of numbers, Spectra Lab can calibrate on it.

Spectra Lab validation screen with PLS metrics, predicted versus reference plot and residuals, next to a benchtop NIR analyzer

Interactive demo: spectral preprocessing, PLS regression and model validation

Choose a preprocessing method and watch what it does to the spectra, the RMSECV-versus-components curve, the predicted-versus-reference scatter, and the validation metrics. Pick raw spectra first, then try SNV.

Sample spectra (5 of 80 samples) vs wavelength
    RMSECV vs number of PLS components
    Predicted vs reference moisture (%) with 1:1 line

    Results computed by the Spectra Lab engine on a simulated teaching dataset (80 samples, moisture %). Simulated data, not real grain measurements.

    What is a Savitzky Golay filter (Savitzky-Golay algorithm)?

    A Savitzky Golay filter (also written Savitzky-Golay; the Savitzky-Golay algorithm or Savitzky-Golay smoothing) fits a low-order polynomial to a short moving window of points along each spectrum. The fitted value smooths noise; the fitted slope or curvature gives the first or second derivative, which removes baseline offsets and slopes before partial least squares regression. Window size and polynomial order set the trade-off between noise removal and losing real absorption features. In the demo above, compare "SG 1st derivative" and "SG 2nd derivative" with the raw spectra to see that trade-off on real data.

    Tour the Lab

    Six screens take you from a raw CSV to a filed validation report. Pick a step on the left; on a phone the tabs scroll sideways.

    Spectra Lab import screen showing a CSV upload with one row per sample, reference values and a preview table

    Upload a CSV with one row per sample and your reference values alongside the wavelengths. Spectra Lab previews the table so you can check the columns, the row count and the reference range before anything is computed.

    Learn more: importing spectra into Spectra Lab

    Problems Spectra Lab solves

    These are the questions analysts and statisticians keep asking about calibration. Here is what the Lab does about each one today.

    “Which preprocessing should I use?”

    Compare methods side by side on your own spectra and see the error change; the demo shows SNV can destroy a signal.

    “How many PLS components should I keep?”

    The RMSECV-per-component curve and the chosen minimum, so over-fitting is visible.

    “My RMSECV looks good, will it hold on new samples?”

    RMSECV, R2 CV, RPD and bias side by side, plus Second Opinion on new spectra.

    Coming next: a separate test-set partition by lot or date.

    “Is this sample an outlier or a real product?”

    Hotelling T2 and Q residual flags per sample.

    “The software is expensive or tied to one instrument.”

    Runs in the browser on CSV from any instrument; no installation.

    “It worked on one instrument and fails on another.”

    The course lesson on calibration transfer is available today.

    Coming next: calibration transfer (slope/bias and standardization).

    Based on recurring questions from analysts and statisticians in public Q&A forums and the calibration literature.

    Free chemometrics resources on SpectroScience

    Interactive labs

    PLS factors, calibration, validation and troubleshooting

    Open the interactive labs

    Calculators

    Model diagnostics, calibration method selector and feasibility checker

    Open the calculators

    NIR Calibration and Chemometrics guide

    Read the guide

    NIR laboratory guide

    Read the guide

    NIR glossary

    Open the glossary

    NIR vs wet chemistry

    Compare the methods

    Practice quizzes

    Test yourself

    PDF: NIR cheat sheet

    Download the cheat sheet

    PDF: NIR glossary

    Download the glossary

    PDF: NIR troubleshooting guide

    Download the troubleshooting guide

    What you can do with Spectra Lab chemometrics software

    Import spectra (CSV)

    Upload your spectral data as a CSV file with one row per sample, alongside the reference values you already measured with wet chemistry.

    Preprocess (SNV, MSC, Savitzky-Golay, baseline)

    Standard normal variate, multiplicative scatter correction, Savitzky-Golay smoothing and derivatives, and baseline correction — applied consistently to every spectrum.

    Calibrate (PLS regression with cross-validation)

    Build partial least squares regression models against your reference values, with cross-validation that keeps the component count honest.

    Validate and second-opinion (RMSECV, RPD, bias, T2/Q outliers, PDF report)

    Get RMSECV, RPD and bias in one view, inspect Hotelling T2 and Q residual outlier diagnostics, and export a PDF report you can file with the method.

    From calibration curve to NIR calibration in near infrared spectroscopy

    A single-wavelength calibration curve goes back to the Beer-Lambert law: absorbance is proportional to concentration, so one wavelength and a linear fit can quantify one analyte in a clean matrix. Real samples are not clean. Scattering, particle size, temperature and overlapping absorption bands break the single-wavelength assumption.

    Multivariate calibration solves this by using hundreds of wavelengths at once and letting partial least squares regression find the combinations that carry the information and reject the rest. Spectra Lab walks that whole path for you: Beer-Lambert calculator, NIR calibration methods compared: MLR, PCR, PLS and ANN, and How to build a PLS model in practice: from raw spectra to validated calibration.

    Calibration curve versus multivariate NIR calibration One wavelength: calibration curve concentrationabsorbance Whole spectrum: multivariate (PLS) calibration wavelength (hundreds of points) PLS
    Left: one wavelength and a straight line, as in the Beer-Lambert law. Right: partial least squares regression uses the whole near-infrared spectrum, which copes with scattering, particle size and overlapping bands.

    What is partial least squares regression? PLS vs principal component analysis (PCA), in plain words

    PCA: what is in my spectra?

    Principal component analysis is exploration. It finds the directions of largest variance in the spectral data and shows you whether your samples cluster, drift or split into groups. There is no reference value involved. Use it to understand your set, find outliers and see whether your calibration population is really one population.

    How to run PCA on NIR spectra step by step · How to interpret a PCA score plot

    spectra latent reference

    PLS: what is in my spectra that predicts moisture?

    Partial least squares regression is prediction with a purpose. It rotates the same kind of components, but it chooses them so that they also explain your reference values. That is why PLS regression usually beats PCA followed by regression when you actually want a number out of the instrument.

    Comprehensive chemometrics: PLS regression tutorial

    Model validation like a lab manager: RMSECV, RPD, bias and Hotelling T2

    A calibration is only as good as its validation. Spectra Lab reports the numbers a lab manager asks for, and lets you pull them into a report you can defend in an audit.

    RMSECV
    Root mean square error of cross-validation: the error you should expect on new samples from the same population, computed by leaving samples out and predicting them back.
    RMSEP and bias
    When you have an independent test set you also get RMSEP, and the bias tells you whether the model is systematically high or low rather than just noisy.
    RPD thresholds
    RPD is the ratio of reference standard deviation to prediction error. As a rule of thumb, below about 2.5 a model is only good enough for screening, and above about 3 it can be considered for quantitative use.
    Hotelling T2 and Q outliers
    T2 flags samples that sit far from the calibration centre; Q residuals flag samples the model cannot reconstruct. Together they separate unusual samples from bad spectra.

    Read more: Cross-validation in NIR calibration: leave-one-out vs k-fold · Choosing the right NIR calibration validation approach · How to detect NIR spectral outliers.

    Learning path: the course lessons that teach each step

    Spectra Lab is the practice bench for the NIR spectroscopy course. Each stage of the workflow maps to a lesson that explains the theory behind it.

    New to NIR and chemometrics? Get learner access with the NIR course.

    Frequently asked questions

    What is partial least squares regression?
    Partial least squares (PLS) regression is a chemometric method that predicts a property, such as moisture or protein, from many correlated variables, such as the absorbances at every wavelength of a near-infrared spectrum. It finds a few latent components that explain the spectra and the property together, then regresses on them.
    What is a Savitzky-Golay filter used for in spectroscopy?
    It smooths spectra and calculates first or second derivatives by fitting a polynomial in a moving window. Derivatives remove baseline offsets and slopes, which often improves NIR calibration models.
    Is Spectra Lab free?
    You can try the Lab and its demo today by signing in; pricing for ongoing use is announced to signed-in users first.
    Which instruments' spectra work with Spectra Lab?
    It is instrument-independent. Any NIR analyzer or spectrometer whose spectra you can export as numbers will work, regardless of make or model.
    What file format does Spectra Lab accept?
    Spectra Lab accepts CSV files with one row per sample.
    Is my data private?
    Your uploads stay inside your own Spectra Lab account and are used only to run your calibrations; they are not shared with other users.
    PLS or PLS-DA?
    PLS regression predicts a continuous value such as moisture or protein, and that is what Spectra Lab does today. PLS-DA (discriminant analysis) predicts a class, such as pass or fail; it is on the Spectra Lab roadmap.
    How many samples do I need?
    As a working rule, start with at least 6 to 10 samples per PLS component you expect to need, spread across the whole range of the property you want to predict.
    How many components should I use in a PLS regression?
    Choose the minimum of the cross-validated error curve, and prefer fewer components when the curve is flat.
    What if RMSEP or RMSECV has no clear minimum?
    Pick the first component count after which the error stops improving meaningfully. A flat curve can mean the signal is weak or the preprocessing is unsuitable.
    Should I mean-center or autoscale spectra before PLS?
    Mean-centering is standard. Autoscaling gives noisy wavelengths equal weight and is usually avoided for spectra.
    How much variance should PCA capture?
    There is no fixed threshold. Use enough components to describe the systematic variation, checked with score and loading plots.
    How do I know a new sample is within my calibration?
    Check Hotelling T2 and Q residuals against the calibration limits; Spectra Lab flags both.
    Can I cross-validate with replicate scans?
    Keep all replicates of one sample in the same fold, otherwise the error looks better than it is.

    Open Spectra Lab and calibrate something real

    Sign in to work with your own spectra, or join the learner path with the NIR course and learn the chemistry behind every button.