Really interesting the Resemble package so I am trying to work and understand it better even to help me in the case of Win ISI LOCAL calibrations.
We can get predictions for different combinations of local selected samples for the calibration to predict the unknown, so we can see the best option. We use a certain number of terms (min. and max.) and a weighted average is calculated.
In this case I use an external validation set of petfood Xu with Reference data (protein) Yu, and I want to know the statistics (RMSE and R square) for the case of 90 local samples selected:
predicted.local <- as.numeric(Yu_anl$Nearest_neighbours_90) > rmse.local <- sqrt(mean((Yu - predicted.local)^2)) > R2.local <- cor(Yu, predicted.local)^2 > R2.local > rmse.local