In this post I calculate the scores of a validation set using the NIPALS loadings (Matrix P) calculated in the post: Using R: NIPALS Spectra Reconstruction
Xval_orig<-scale(sflw.msc3.val$NIRmsc,center=TRUE,scale=FALSE)
matplot(wave.NIR,t(Xval_orig),type="l",lty=1,xlab="nm",
+ ylab="log 1/R")
Calculation of the scores is just a matrix multiplication of the centered validation matrix, by the P loadings matrix.
Tval_nipals<-Xval_orig %*% P_nipals
We have seen the loadings in the post: NIPALS: Correlation of the Scores with the Constituents
matplot(wave.NIR,t(Xval_recon),type="l",lty=1,xlab="nm",
+ ylab="log 1/R")
matplot(wave.NIR,t(Eval),type="l",lty=1,xlab="nm",
+ ylab="log 1/R")
No hay comentarios:
Publicar un comentario