PCA for NIR Spectra_part 006: "Mahalanobis"
Outliers have an important influence over the PCs, for this reason they must be detected and examinee.
We have just the spectra without lab data, and we have to check if any of the sample spectra is an outlier ( a noisy spectrum, a sample which belongs to other population,……., an extreme sample for a particular constituent,..).
One way to detect outlier is the “Mahalanobis distance”. And we are going to calculate the Mahalanobis distance to the center of the population.
Previously we have calculated with the NIPALS algorithm the T score matrix, for three PCs.
Let´s calculate now the Mahalanobis distance (Library: Chemometrics) for a certain probability.
> Moutlier(T3pc_nipals,quantile =0.975, plot=TRUE)
 3.4506943 2.0677806 1.8554593 1.3493939 1.0093176 1.4537839 1.7177865
 0.8551981 1.9936152 1.7136093 1.6755040 1.0370122 0.6980203 1.0457686
 1.9107813 2.4836284 1.8483303 1.6226210 1.7422189 2.3278939 2.9407373
 1.0270963 0.8200505 1.3194672 1.0637166 0.7383098 0.9658263 1.1470021
We can see how the sample number “1” is out of the cutoff ratio.
To leave a comment
for the author, please follow the link and comment on their blog: NIR-Quimiometría
offers daily e-mail updates
news and tutorials
on topics such as: Data science
, Big Data, R jobs
, visualization (ggplot2
), programming (RStudio
, Web Scraping
) statistics (regression
, time series
) and more...
If you got this far, why not subscribe for updates
from the site? Choose your flavor: e-mail
, or facebook