NIR spectra often exhibit baseline offset and curvilinear trend caused, for example, by changes in illumination angle or optical path length. Baseline removal aims at resetting all spectra on a common baseline. Baseline correction methods are generally simple and often preserve the main spectral shape. However, this is not always the case with more advanced baseline removal methods. In some cases, baseline removal techniques can distorts the real proportions between absorbance peaks and therefore, caution should be used when interpreting the results (Sandak et al., 2016).
There are plenty of ways to compute the baseline of a spectrum, the most simple using a linear fitting. In this tutorial, we propose using the polynomial fitting method implemented in the hyperSpec package. The function spc.fit.poly.below performs a least squares fitting of a polynomial curve to the base of the spectrum. The curve is then removed from the original spectrum to obtain the baseline corrected spectrum. The baselines of our spectra can be calculated and plotted as follows:
The baselines can then be removed from the original spectra as follows: