Blog Archives

NIT: Fatty acids study in R – Part 001

March 1, 2012
By
NIT: Fatty acids study in R – Part 001

This time I´m going to use my own data to develop a model to predict some fatty acid in the solid fat (pork).Samples had been analyzed in a NIT (Near Infrared Transmittance) instrument. The range of the wavelengths is from 850 to 1048 nm (100 data poi...

Read more »

PCA for NIR Spectra_part 006: "Mahalanobis"

February 28, 2012
By
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 ...

Read more »

PCA for NIR Spectra_part 005: "Reconstruction"

February 27, 2012
By
PCA for NIR Spectra_part 005: "Reconstruction"

We saw how to plot the raw spectra (X), how to calculate the mean spectrum, how to center the sprectra (subtracting the mean spectrum from every spectra of the original matrix X). After that we have developed the PCAs with the NIPALS algorithm, getting...

Read more »

PCA for NIR Spectra_part 004: "Projections"

February 26, 2012
By
PCA for NIR Spectra_part 004: "Projections"

This plot in 2D, help us to decide the number of PCs, it is easy to create in R, once we have discompose the X matrix into a P matrix (loadings) and a T matrix (scores).For this plot, we just need the T matrix.> CPs<-seq(1,10,by=1)>  matp...

Read more »

PCA for NIR Spectra_part 003: "NIPALS"

February 25, 2012
By
PCA for NIR Spectra_part 003: "NIPALS"

> X<-yarn$NIR> X_nipals<-nipals(X,a=10,it=100)Two matrices are generated (P and T)As in other posts, we are going to look to the loadings & scores, for firsts three principal components:> wavelengths<-seq(1,268,by=1)> matplot(w...

Read more »

PCA for NIR Spectra_part 002: "Score planes"

February 23, 2012
By
PCA for NIR Spectra_part 002: "Score planes"

The idea of this post is to compare the score plots for the first 3 principal components obtained with the algorithm “svd” with the scores plot of  other chemometric software (Win ISI in this case). Previously I had exported the yarn spectra t...

Read more »

PCA for NIR Spectra_part 001: "Plotting the loadings"

February 22, 2012
By
PCA for NIR Spectra_part 001: "Plotting the loadings"

There are different algorithms to calculate the Principal Components (PCs). Kurt Varmuza & Peter Filzmozer explain  them in their book: “Introduction to Multivariate Statistical Analysis in Chemometrics”.I´m going to apply one of them, to...

Read more »

Standard Normal Variate (SNV)

February 19, 2012
By
Standard Normal Variate (SNV)

(This article was first published on NIR-Quimiometría, and kindly contributed to R-bloggers) This is another pretreatment used quite often in Near Infrared to remove the scatter. It is applied to every spectrum individually. The average and standard deviation of all the data points for that spectra is calculated. Every data point of the spectra is substracted from the mean and...

Read more »

Plotting the “Mean Spectrum”

February 17, 2012
By
Plotting the “Mean Spectrum”

(This article was first published on NIR-Quimiometría, and kindly contributed to R-bloggers) Mean spectrum calculation is important: To center a matrix of spectra, we subtract the mean spectrum, from every spectrum in the matrix. There are also many options to use the mean spectrum, like average subsamples. Let´s calculate and plot the mean spectra for the Yarn NIR Data:...

Read more »

NIR "Cross Validaton Statistics" with "R"

February 16, 2012
By
NIR "Cross Validaton Statistics" with "R"

We have to check different options before to decide for one model:Configure different cross validations.Configure different math  treatments.Configure number of terms.With the Yarn NIR data, I have develop 4 models, for a simple exercise.Of course...

Read more »