**2. Methodology**

#### *2.1. Roasting Tests and Sensory Evaluation*

Arabica coffee samples submitted to dry (natural coffee) and wet (pulped natural coffee) processing were employed in the present study. Detailed information regarding sample provenance and quality scores (ranging from 81 to 91) is presented as Supplementary Materials (Table S1) and discussed in our previous study on FTIR analysis of specialty coffees [3]. A summarized description of sample preparation is presented as follows. The samples were roasted in accordance with the SCA protocol for coffee sensory analysis, using an IKAWA® Sample Roaster Pro (London, UK). Individual samples consisted of 50 g of green coffee that were submitted to roasting at temperatures ranging from 170 ◦C to 227 ◦C. The roasting time was 4 min 34 s. Roasting tests were performed in duplicate. A total of 56 samples were obtained. These samples were ground using a Porlex Mini® grinder (Porlex Grinders, Osaka, Japan) in order to obtain a fine and homogeneous grind (particle diameter below 0.150 mm). The samples were then analyzed by six professional Q-graders according to the SCA protocol. Twenty-four hours prior to cupping, the coffee samples were submitted to a light/medium roast (#55 to #65 Agtron color scale). Once the coffee was ground, fragrance and aroma was evaluated. Filtered water (93 ◦C) was added to the sample cup (five per sample), let to rest for 4 min, and then the beverage was tasted and evaluated according to the quality attributes established in the protocol [5]. Sample classification was based on global scores and aromatic descriptors established by the protocol. It is noteworthy that, given that the goal of this study to evaluate the performance of NIR in comparison to FTIR, the same set of samples was employed for both techniques.

#### *2.2. ATR-FTIR and NIR Analysis*

After roasting and grinding, the samples were analyzed on a Shimadzu IRAffinity-1 FTIR Spectrophotometer (Shimadzu, Japan) with a DLATGS (Deuterated Triglycine Sulfate Doped with L-Alanine) detector, using an ATR (Attenuated Total Reflectance) sampling device. The spectra were recorded in the wavenumber range of 3100–800 cm<sup>−</sup><sup>1</sup> and a total of 224 spectra were obtained (56 samples × 2 aliquots × 2 measurements). The NIR measurements were conducted in a Red-Wave-NIRX-SD Spectrophotometer (StellarNet Inc, USA) with 25μm diameter and RFX-3D reflectance base. Samples were transferred to a petri dish and placed over this base. The spectra were recorded within 900 to 2300 nm, 16 nm resolution, and 8 scans. Each roasted and ground coffee sample was analyzed in duplicate, totaling 112 spectra (56 samples × 2 measurements). The background spectra was based on the RS-50 reflectance disk. Both FTIR and NIR analyses were performed at room temperature (20 ± 0.5 ◦C) and all readings were based on roasted and ground (D < 0.15 mm) coffee samples.

#### *2.3. Data Processing and Statistical Analysis*

The software employed for statistical analyses were MATLAB® software v7.9, 2009 (The MathWorks, Natick, MA, USA) and PLS Toolbox® 6.7.1, 2012 (Eigenvector Technologies, Manson, WA, USA). The ATR-FTIR and NIR spectra were used as chemical descriptors in order to build the PLS models for prediction of the sensory analysis scores. The Kennard– Stone algorithm was used to divide the 224 FTIR spectra from FTIR into calibration (70%) and validation (30%) sets, and the same for the 112 NIR spectra. Orthogonal Signal Correction (OSC) and Mean Centering (MC) were applied for reducing the effect of noise, enhancement sample-to-sample differences, and removal of redundant information. The number of latent variables was defined according to the lowest RMSECV value obtained by Random Subset cross-validation. Model performance was measured by calculating the root mean square errors for both calibration (RMSEC) and validation (RMSEP) errors [3]. Selected models were the ones with the smallest RMSEC and RMSEP values [12].
