Using preprocessing
Like for PCA, you can pre-define a sequence of preprocessing methods and provide it as argument prep to the DD-SIMCA model. In this case it will train the preprocessing model and apply the methods automatically every time you use the model for predictions:
p = list(
prep("savgol", width = 9, porder = 1, dorder = 1),
prep("norm", type = "snv")
)
m = ddsimca(xc, "Oregano", ncomp = 10, pcv = list("ven", 4), prep = p, exclrows = c("Drg12", "Drg13"))
r = predict(m, xtt, ctt)
par(mfrow = c(2, 2))
plotSensitivity(m, show.ci = TRUE)
plotAcceptance(m, res = "pv", ncomp = 1)
plotSensitivity(rtt, show.ci = TRUE)
plotAcceptance(rtt, ncomp = 1)