# What's in Your Fruit Juice?--Rapid Quality Screening Based on Infrared (FT-IR) Spectroscopy
## 2 Materials and Methods
### Multivariate Data Analysis  
The spectral data, imported as GRAMS (.spc) files from the FT-IR instrument, underwent analysis using Pirouette(r) multivariate statistical analysis software (version 4.5, Informetric Inc., Bothell, WA, USA). Partial least square regression (PLSR) models for soluble solids, sugars (sucrose, glucose, fructose, and total sugars), acids (ascorbic and citric acid), and titratable acidity were built using FT-IR-collected spectral data and reference values obtained through traditional methods. Following an evaluation of alternative preprocessing and transformation algorithms, the spectral data underwent mean-centering and second derivative transformation (Savitsky-Golay second-order polynomial filter with a 35-point window) prior to the PLSR analysis. Spectral data transformation techniques played a crucial role in enhancing the spectral features of the samples and extracting relevant information from the dataset. Specifically, the second derivative transformation can solve the scattering effect, separate overlapping peaks, and correct the baseline drifts [34].  
PLSR is a quantitative technique for spectral decomposition that condenses spectral data into orthogonal structures referred to as latent variables or factors. These latent variables characterize the highest covariance between the spectral data and the reference values associated with the quality attributes of FJ [34; 35]. PLSR analysis has demonstrated notable success in managing spectral data characterized by numerous, highly correlated, and noisy X-variables (spectra). This capability enables the simultaneous modeling of multiple dependent variables, such as sugars, acids, soluble solids, and titratable acidity [36]. Variable selection, a critical step in PLSR model generation, involves identifying and including informative band features in the spectral matrix while eliminating unnecessary variables [37].  
The latent variables that elucidate the spectral data are organized through a cross-validation (leave-one-out) technique and are arranged in descending order according to their impact on the model [37]. It is also essential to select an ideal number of latent variables to prevent the overfitting or underfitting of the model.  
Prior to conducting the multivariate analysis, the spectral data were randomly split into the two sub-groups calibration and external validation. The calibration samples, internally validated using the leave-one-out approach, comprised 80% of the total sample size. This subset was employed for constructing the training model, while the remaining 20% was reserved to assess the performance of the training model. Similar statistical performances between the training and test models, in terms of correlation coefficient (R) and standard error, indicated that the generated training model could successfully predict the tested quality trait parameters of the FJ for new samples in the future. Parameters, including latent variable (factor) numbers, the correlation coefficient of cross-validation (Rcv), the correlation coefficient of prediction for the external validation set (RPre), the standard error of cross-validation (SECV), the standard error of prediction (SEP), the residual predictive deviation (RPD), and the range error ratio (RER), were employed to evaluate the PLSR models' performances. The RPD was determined by dividing the calibration set's standard deviation of reference data by the SEP. Similarly, the RER represents the ratio of the range of reference data in the validation set to the SEP. Higher values for both RPD and RER generally indicate a model that is more precise and robust [38; 39].