Best Practices: Sample Planning for Quantitative NIR Methods

The focus of this post is NIR project and sample planning, a critical step in the NIR method development process that often gets rushed through in the eagerness to have our NIR instruments pump out measurement results.  Putting some extra effort in sample planning could pay off big dividends in terms of two things I suspect are really important to you – accuracy and robustness. So, let’s get into it.

Let’s start our discussion by framing it in an example. You work at The Cheese Factory, and you want to measure the fat content in your cheese using NIR.

Fat is incredibly important to you for a few reasons. For one, fat is the vehicle for the flavors of your cheese and creates a creamy mouth feel. If you don’t have enough fat, your cheese will be hard and corky.  No one wants corky cheese.  However, fat isn’t cheap, so you don’t want any more in there than you need—that’s money down the drain.  The formulation people have been tasked to establish what amount of fat is “Just Right” but you need to make sure that’s what comes off the conveyor belt.

What do you do?

Defining a property range

Your first thought might be to grab a few samples of cheese that span a range of fat content, each with reference measurements confirmed by your primary method. That’s a good start.  There are some general recommendations that you should consider when it comes to the range of the property you want to calibrate for. Whether it’s fat in cheese or active ingredient in a pharmaceutical formulation, first consider the primary method you’re using as a reference for the property. That method has a standard error associated with it. Take 20x that error and that is the minimal range over which your calibration property values should span to reduce the impact of the reference error on your NIR model.

Whatever property range you might expect to see as a reflection of normal process variation is what we can your working range. The calibration range should be broader than the working range to avoid extrapolation; that is, avoiding measurement predictions outside of the scope of the calibration.

When possible, the target value (e.g. label claim) of your property should fall in the middle of the calibration range, and all of your concentration points would be more or less evenly distributed across the calibration range. At the very least, avoid a situation where you have one large cluster of points at one end of the range and only a few points at the opposite end.

As an example:

  • Target (Label Claim) = 50% Property (e.g. “Fat”)
  • Standard Error of Lab (SEL) = 1% Property
  • Calibration Range, Suggested =  SEL x 20 = 1% x 20 = 20%
  • Calibration Range, Min. =  Target – (Calibration Range/2)  = 50 – 20/2 = 40% Property
  • Calibration Range, Max. = Target + (Calibration Range/2) = 50 + 20/2 = 60% Property

Accounting for production variation

Keep in mind, even though your primary objective is to build a calibration model for fat in cheese, there is other “stuff” in there that is going to absorb or scatter NIR light, impacting the spectra you collect (e.g. giving it “extra” peaks and valleys or offsetting baselines). And if it impacts the spectra you collect, it could impact the accuracy or precision of your fat measurement by NIR.

In this example, let’s consider other components in the cheese formulation: Moisture, protein, lactose and salt.  Sample temperature, consistency and the mode of sample preparation can also impact the spectra we collect.

So, in total, this example is suggesting that there are 7 additional factors to consider outside of FAT when developing an NIR calibration for fat in cheese.  Let’s take a look at an example method planning worksheet to see how we can accommodate known product variations into our NIR model.


This is one tool you might consider when you are looking to start a new NIR project or to optimize a current project. I highly recommend applying this type of table to your method planning. Let’s start with our example of fat in cheese. The first thing to record is your formulation target as input A. This number is based on your label claim and determined by formulation scientists. Next, record your current reference method for that property. Here, we might have an extraction. This method should be kept constant throughout the NIR method development cycle, as different laboratory methods have different accuracy and precision relative to one another.  Input C should reflect the standard error of the laboratory for whatever reference method you select. Take 20 times that number to get your recommended range for that property, as shown in the previous slide.

The working range, input D, is your typical property variation. Regardless of the calibration range recommendation, your working range needs to be within the boundaries of the calibration method.

The sample prep and presentation should be well-defined and kept constant. There may be some trial and error here at the beginning of your project, depending on limitations of practicality and desired calibration performance.  In general, the more uniform the sample is, the better the method precision.

The last column shown here is a catch-all for all other known sources of chemical and/or physical property variation expected in your sample.

Let’s dig a little bit deeper into the product variations that should be captured within the sample plan, as shown in the Table below:


Write out the min and max values for each component in the matrix and be intentional with identifying samples that span the full range of possibilities.  As indicated here, each ingredient or component of a sample has a minimal and maximal value associated with it. Perhaps there are also various vendors supplying these components and vendors have slightly different particle size specifications that can impact our NIR signal.  For optimal method robustness, be sure to collect calibration samples that have been produced with materials sourced from multiple vendors to account for any chemical or physical property differences in those materials.

If your production involves heating or cooling, you’ll need to either (a) standardize the temperature at which NIR spectra are collected or (b) build the temperature variation into your model. For the latter, I would suggest collecting spectra of a single sample at multiple temperatures. For actively cooling samples, collect the first spectra when the sample is hot, then collect spectra of the block after it’s reached room temperature.

If your plant has several different production lines, it would be a good idea to collect samples that were produced from each process line, as equipment aging or servicing may impact things like finished product particle size, morphology or packing density.

If your product is very hygroscopic it is likely to be more sensitive to seasonal variations in temperature and humidity, so calibration data collection across seasons may be required in order to optimize model robustness.  If  your sample is very compressible, it is likely to be more sensitive to sample handling and so exhibit greater operator-to-operator variation during sample prep. I use the example of Boris the Strong-Man tapping a powder sample into a vial and the powder forms a near-solid puck. Then there is Gentle Jim, who gently taps the vial so that the powder flows to the bottom of the vial. Boris and Jim’s samples have very different packing density which will show up as baseline offsets in the spectra, so randomizing calibration data collection across several operators is good practice.

As you consider your own project, be sure to include any additional sources of variation. Talk to plant operators and plant managers or formulation chemists to uncover variables that may be impacting your method performance.

Also keep in mind that method precision is likely to be better when factors outside of your property of interest, such as sample temperature, are held constant (or as constant as is practical) rather than varied.

Sample uniformity and dynamics

Other critical sample characteristics that often get overlooked during the method development process are sample consistency and stability.

Consider the physical state of your samples. Does it phase separate, forming oily or watery layers? Is moisture easily driven off or absorbed? If so, it’s important to create standard operating procedures to limit the impact of those sample characteristics on your method performance. Something as simple as adding a stirring step to a hot or oily sample (to homogenize the sample) could pay huge dividends with regard to method performance.

We also want to keep in mind how well the sample sent for reference testing matches the sample analyzed by the NIR.  Ideally, we would take advantage of the non-destructive testing of the NIR and use the actual NIR sample for the reference laboratory testing. Even if you’re able to do that, the sample size for each method may differ, and the following points should be considered to obtain our goal, which is that the reference laboratory sample is representative of the NIR sample:

Below, I have 5 illustrations representing different sampling situations.  Solid blue represents the sample matrix, yellow circles represent our property of interest, and the light blue drops represent moisture. The solid black box indicates the sample volume by NIR, while the red hashed box represents the sample submitted for reference testing.


In the leftmost box, the sample is uniform throughout. The sample submitted for reference testing matches the sample for NIR. There is no problem here and the precision of both methods should be very good.

In the second box, the sample is non-uniform. Our property of interest is accumulating at the bottom of the sample cup, maybe due to phase separation or particle segregation. If the reference sample is drawn off the top, the results will not represent the NIR sample measurement well. The precision of our method will be poor unless some sort of mixing or homogenizing step is added.

In the third box we introduce moisture as an added variable.  Here again, moisture is evenly distributed in the sample and there is no issue with reference and NIR data correlation.

In the fourth box we have a hygroscopic material that readily absorbs moisture from the environment. If the reference sample is taken from the top it will be biased toward higher water content than is representative of the sample as a whole. The sample requires stirring prior to removal of the sample for the reference method as well as prior to measurement by NIR.

The final box illustrates non-uniformity of moisture. This could be a hot block of cheese coming off the conveyor belt or a powder pulled from a fluid bed dryer. If water is actively being evaporated or you see water pooling on the surface, you risk biasing your moisture data by simply collecting a sample from the top of your product. In this case, it may be useful to wait until the sample has reached a steady-state temperature and/or mixing the sample bed (e.g. for powders) before analyzing by either the reference or NIR methods, respectively.

Sample collection

After going through these slides with your own products in mind, you may have identified all of the product variations you anticipate in routine production. You are starting to formulate a plan to ensure that the sample submitted for reference testing is representative of your NIR sample.  The next question is… where are these samples coming from?

The first answer is: from production. However, your routine production is likely to have pretty tight control and you’re building the NIR model to look for rare process deviations. You might be able to get some more extreme values of property range or other factors like particle size by pulling samples close to process start-up or run-off.

In many cases, it is not very efficient to wait for out-of-spec samples from production. If your production process is small-scale, you may consider intentionally creating out-of-spec materials using your actual production equipment. For example, creating high-fat cheese by adding an excess of butterfat to one batch or by intentionally over-drying a granulation run.  In other situations, you may find it more economic and efficient to perform “spiking” or dilution steps to your products to produce adequate property ranges.

How many samples are required to build a robust NIR method? The simple answer is… it depends. Typically, the more complex the sample matrix and the more sources of variation you’ve identified using the prior tables, the more samples are needed.  Generally, a start-up model may require 50 unique samples. There are plenty of exceptions to this rule.  For example, if you’re quantifying something with a very unique NIR peak you may be able to get away with fewer samples. If your sample matrix has a lot of ingredients with spectral overlap, as typically seen with foodstuffs, you may need more than 100 samples.

Calibration in itself should be considered a continuous process. You can be reactive or proactive in extending that calibration to improve robustness to unforeseen or un-modeled sources of variation.

Sample failure, calibration update

Samples failing your NIR method may indicate that calibration update is necessary! But, not every time. So, how do you know a measurement has failed, and what does that failure mean?

The NIRWare Operator software makes it fairly easy to identify which samples should be used to update an existing calibration model – see the samples with the red X! There are two types of outliers that the Operator software will flag: spectral residuals and property outliers.

When you have a spectral residual outlier, the Operator will not obtain an NIR measurement result, only a visible red X.  Spectral residuals indicate that the sample that was just measured had spectral features – that is, the peaks and valleys – that did not match up with the calibration data set. This could be the result of the original calibration being over-fit, leading to very tight tolerances, or it could be that the sample that was just measured has property combinations (like high fat, low moisture) that were not part of the calibration.  Worse case is that a spectral residual is due to a contaminant that was not present in the calibration data set.

A property outlier indicates that the current sample has a property value prediction that is outside of the calibration range.  This is considered an extrapolation.

However, the “failed” result may also be an issue with the way the sample was collected!  In order to verify that you truly have a calibration outlier, please run through the following check-list.

  1. Check that sample (or probe) is positioned properly during the measurement
  2. Check that the optical path (window, sample container) is clean and retry measurement
  3. Check that a good reference was collected and that reference material is clean
  4. Sample may have new variation that wasn’t used in the calibration training set (e.g., higher moisture content due to seasonal humidity, new vendor with different particle size)

If all signs are pointing to the sample truly being unique (i.e. out-of-specification and out of the range of the calibration model), then send this sample for primary analysis, add to the calibration data set and recalculate the model.

Identification of spectral outliers or range extrapolations is one way to plan for samples for calibration model update! This is a reactive approach but reasonable.

To be more proactive when time and resources allow, you can look for gaps in your current design space. Take a look at your reference vs. predicted plot to see if you are adequately covering the calibration range with samples or if gaps exist. Create scatter plots of the calibration properties (e.g. Property 1 vs. Property/Variable 2)  to identify gaps in the design space when multiple variables are considered. Once holes are identified, flag samples that match your missing criteria in routine production, or manually create those samples using small batch processing, spiking or dilution experiments, when possible.


I hope this was helpful toward planning (or updating) your quantitative NIR methods. Be sure to check out our other FT-NIR user Best Practice Blogs for qualitative method development and quantitative methods for pre-calibration users. Should you have additional specific topics that you would like to see covered in this blog, please submit your ideas!

Best practices: Quantitative Methods (Pre-Cal users)

Even though the onus is on the BUCHI Applications team to crunch the numbers and create the mathematical models behind the BUCHI pre-calibration licenses, there are some key activities that need to happen on the customer end, sometimes in collaboration with BUCHI Applications, and sometimes in collaboration with BUCHI Service. These topics are: preparing and qualifying hardware, sample planning and pre-calibration use, how to decide when calibration update is needed, sample planning for calibration update and data handling.  I will provide some more details on each of these topics in today’s post.

Preparing & qualifying hardware

Sometimes when we skip over what we think is obvious, that can become the biggest obstacle to our success. So, let’s start with what may seem obvious. Before you begin any data collection, whether using pre-calibrated applications or not, you should be able to confirm that (1) the spectrometer (NIRMaster or N-500) installation is in a relatively stable environment and the spectrometer is warmed up prior to data collection.  A spectrometer should not be installed by a window or HVAC, where direct sunlight or the air flow will constantly change the instrument temperature; (2) the measurement cell  (i.e. the top of the NIRMaster or the front end of the N-500) should be clean of debris. All optical pathways (read: glass) should be unobstructed. This includes obstruction by an improperly placed measurement cell add-on;  (3) the spectrometer should pass the System Suitability Test, and (4) external references, where applicable, should be clean and in good condition (i.e. no cracks, abrasions or staining).

Should you need to clean any of the optical components, please take care to avoid any abrasive materials. Optical cloth and lint-free optical tissue paper are recommended. You may clean with water, then isopropyl alcohol, or alcohol only. Take care that all residual solvent has evaporated prior to any data collection.

Internal & external references

Internal and external references are a critical part of data collection. The detector inside the spectrometer is not measuring absorbance or reflectance or transmission directly. It’s measuring how many photons of light are hitting it after the light has a chance to interact with your sample. In order to get the spectrum that you see pop up on a screen, we have to divide the signal produced by your sample by a reference material. For diffuse reflectance measurements, that reference material is either a highly reflecting material, like the white Spectralon or gold. For transflectance measurements, the reference material is a diffusely scattering stainless steel adapter or cover. For transmission measurements, the reference is simply air.  When your sample scan is divided by a reference scan, you are normalizing your data to compensate for things like aging NIR light sources, variations in ambient conditions. Taking good references will improve the stability of your spectrometer performance and avoid so-called spectral drift.

There are 2 types of references: external and internal. The applicability of these references depends on the measurement cell and add-on being used for your NIR measurements, so don’t be concerned if you open an application and see one type is disabled!

An external reference is positioned in exactly the same place as your sample, so the path of the light is exactly matched. That is the best type of reference because it will compensate for all of the changes in your measurement system except for those produced by your sample itself. However, external references may be impractical in certain installations. Internal references are more convenient because there is no user interaction. The internal reference is applicable for only 3 types of installation: the solids measurement cell with petri dish add-on, the NIRMaster, and the fiber optic measurement cells.  An internal reference can be used at shorter intervals without negatively impacting workflow while still accounting for short-term changes to the environment of data acquisition.

So, what happens if you get a warning that the external reference spectrum deviates by more than 5% from the last accepted reference?  You’ll see that the pop-up window (screenshot below) gives you some possible reasons, as well as a plot of the last valid (green) and newly collected (red) external reference spectra.


The possible reasons for the deviation are listed in the green sidebar: (1) instrument maintenance was done recently. Obviously, if the lamp was changed or the spectrometer went other service, we can expect to see the light output increase. In that situation, our new reference should have higher intensity values relative to the last valid reference. (2) The Optical pathway is dirty or blocked. In this situation, you might see that you accidentally left your sample container on the instrument instead of collecting the reference spectra. That’s a pretty common scenario, especially before your morning or afternoon cup of coffee. Other possibilities are that you have a dirty window under the sample cup, or maybe you just cleaned the optical path but left residual solvent on the window, and that solvent is absorbing NIR light, causing the deviation.  The third possible reason is that the instrument temperature hasn’t reached its working level yet, and another reason not to install the spectrometer outside in December.

The workflow shown below may help you navigate the possibilities. Start in the upper right corner and work your way through, answering yes or no to each question. If you’ve gone through the list and everything is YES, then accept that new reference with confidence.  If you have some “no’s” and the deviation persists, consider contacting a BUCHI Service person.


System Suitability Test (SST)

System Suitability Tests, or SSTs, are another safeguard, something that should prohibit you from moving forward when there is a problem with your system. The SST essentially makes sure that the instrument is performing to manufacturer’s specifications. These specifications were constructed around analytical verification and qualification tests used by the pharmaceutical industry.  Typically, your application is set up to perform an SST once a day when the instrument is in use. So, what happens when that test fails?

First, take a look at the component of the test that failed. This is clearly indicated in the SST report. If the noise test failed, first try cleaning the optics and replacing the lamp.If the temperature test failed, check that your instrument is warmed up. If the temperature exceeded tolerance, look for an alternate location outside of the active volcano your lab is located in. If that doesn’t apply, check the airflow to the filters and see if filters need replaced. If the photometric linearity or wavenumber accuracy test failed, or if the noise or temperature issues can’t be rectified, submit the SST and NADIA to your local BUCHI Service Engineer.

It is important that data are not collected unless the SST has passed, as measurements may be inaccurate.

Sample planning

The next important task for pre-calibration users is to consider sample planning. First of all, what types of samples are applicable to the pre-calibration? You can see some of this information in our application brochures, where we publish calibration property ranges, as well as sample compatibility. If you’re already using a pre-calibrated application to generate measurement results, the range will also be in the table at the bottom of the default reports, as well as in the Application settings accessible via NIRWare Management Console.

If your samples fall outside of the property range (i.e. higher or lower than the published values), or if your sample is incompatible (read: not considered in the calibration data set yet), then you will need to team up with a BUCHI Application Specialist to have the calibration extended with your unique samples.

Calibration update

If you are using a pre-calibration, it may be that at some point you find yourself with samples that aren’t exactly well-described by the calibration samples. How do you know when to initiate calibration update?

There are 3 main observations indicated that calibration update may be needed: 1) a slope and/or bias is observed relative to the reference lab testing; 2) samples are falling outside of the calibration property range; (3) the sample spectrum residual exceeds the calibration limit. Let’s take a closer look into these three scenarios.

Case 1: Slope/Bias

Spot checking with a reference laboratory method an offset between NIR and Lab results. In the figure below, the blue symbols are the measurement results and the solid black diagonal line shows where the points would fall if there was 100% agreement between NIR and laboratory (reference) data. In this case, the bias, or difference between the reference and predicted values, is greater at lower concentrations, indicating a slope correction may also need applied.



Why does this happen?

There could be systematic differences in the samples being measured, whether something like sample preparation or particle size that wasn’t accounted for by the calibration model.  A simple solution to this problem is to apply a slope and/or bias correction to the NIR measurements.

This is the strategy. 1) Collect spectra of samples and then gather the reference laboratory data for those samples; 2) determine the slope and bias; 3) implement the corrections within the NIRWare application; 4) evaluation the updated application performance.

When you are collecting spectra and reference data, be sure to span the full range of the calibration. Ideally, collect 10 or more samples spaced evenly across the calibration range.  In order to calculate the needed slope or bias correction, create an Excel spreadsheet with NIR and LAB data in adjacent columns. The bias is the average difference between the columns. The slope can be calculated using the Excel function “Slope”.

Once the slope and bias corrects are calculated, enter their values in the NIRWare Application, as shown below. Now, the corrections will automatically be applied when you collect your sample measurements.ApplicationSlopeBiasUpdate

Property range outlier

In our second case, we have a property or range outlier. Here, the measured sample falls outside of the range of property values spanned by the calibration data set. The Operator will see these sample measurements in a red box on the Operator screen. What do you do? Our suggestion is to send the sample or samples out for reference testing, then submit the sample spectra with reference values to the BUCHI Group. We can recalculate the calibration model to accommodate the new range.

Spectral residual outlier

In the 3rd case, you have a spectral outlier, or spectral residual outlier. In essence, the sample you’ve just collected does not match the characteristics (i.e. peaks, or lack thereof) of the calibration spectra.  There is left-over, or residual, character to the sample spectra. The Operator sees a red X and no measurement value on the Operator screen. Here, first check that the sample was positioned properly and that the last reference measurement was good. If both check out, then send that sample off for reference testing and submit those results to BUCHI for calibration update.

Sample planning for calibration update

Contact a BUCHI Application Specialist to discuss more frequent observations of property or spectral outliers, as well as upcoming formulation changes are expected to result in unique samples relative to the existing pre-calibration.

When you are planning to collect NIR spectra and reference laboratory values for calibration update, make sure to span as many of the product variations expected in routine measurement as you can. These may include:

  • Sample composition (incl. degree of sample uniformity, raw material sourcing)
  • Sample temperature (e.g. frozen, warming, hot, cooling)
  • Particle size (e.g. product streams from older vs newer milling equipment)
  • Sample packing, preparation (i.e. between-operator variability)
  • Residual moisture from processing or environmental conditions

One of the keys to getting an optimal calibration (low error, good precision) is making sure that the samples collected on the NIR match the samples sent for laboratory testing. Because NIR is non-destructive, the same sample can (and should) be used for both methods. Also keep the sample’s stability and uniformity in mind. If the sample is oily or hygroscopic or prone to particle segregation, give it a stir before collecting spectra or pulling off your sample for the reference test.

Collaboration with BUCHI

The BUCHI Pre-calibrations are a great way to jump-start your NIR program! Be sure to take advantage of our calibration update program to get the best possible method performance for your installation. For additional support or information on available pre-calibration products, please contact us!