Continue from posts:
"Analyzing Soy meal in transmitance (part 3)"
"Analyzing Soy meal in transmitance (part 2)"
"Analyzing Soy meal in transmitance (part 1)"
"Analyzing Soy meal in transmitance (part 3)"
"Analyzing Soy meal in transmitance (part 2)"
"Analyzing Soy meal in transmitance (part 1)"
I am use to look for outliers using the Mahalanobis distance (MD), which is based in the scores values for the samples in the Principal Component Space.
There are several packages in R, to see the value of the MD, and one of them is the package "Chemometrics", so we load this package and run sam script wit the values we have get from the previous post.
We can fit to ablines to configure the MD, one for Warning with a vaue of 3.00 and another for the Action with a value of 4.00. The line for warning is orange and for action is orange.
library(chemometrics)
X_msc_pca<-princomp(X_msc,cor=TRUE)
res<-pcaDiagplot(X_msc,X_msc_pca,a=2)
plot(res$SDist,ylim=c(0,8),ylab="score distance",
X_msc_pca<-princomp(X_msc,cor=TRUE)
res<-pcaDiagplot(X_msc,X_msc_pca,a=2)
plot(res$SDist,ylim=c(0,8),ylab="score distance",
xlab="sample number")
identify(res$SDist)
abline(h=4,col="red")
abline(h=3,col="orange")
identify(res$SDist)
abline(h=4,col="red")
abline(h=3,col="orange")
and we get this plots, where we can see how samples 298 and 373 appear as outliers, specially for their high scores values in the PC number 2 as we have seen in the previous posts.
No hay comentarios:
Publicar un comentario