I use the same Tecator Meat data which comes with the package. Spectra is treated with MSC (Multiple Scatter Correction) and I represent the plane of the scores with the two terms chosen by the PCA processing:
absorp_pca<-preProcess(absorpTrainMSC,
method = c("center", "scale","pca"),
thresh = 0.95)
PC_scores_train<-predict.preProcess(absorp_pca,absorpTrainMSC)
plot(PC_scores_train[,1],PC_scores_train[,2],col="blue",
xlim=c(-15,11),ylim = c(-20,11),
xlab = "PC1",ylab = "PC2")
PC_scores_test<-predict.preProcess(absorp_pca,absorpTestMSC)
par(new=TRUE)
plot(PC_scores_test[,1],PC_scores_test[,2],col="red",
xlim=c(-15,11),ylim = c(-20,11),
xlab = "",ylab="")
Now we get the plot of the scores for the training set in blue and for the test set in red.
No hay comentarios:
Publicar un comentario