Articles by jrcuesta

NIT: Fatty acids study in R – Part 001

March 1, 2012 | jrcuesta

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 | jrcuesta

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 | jrcuesta

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 002: "Score planes"

February 23, 2012 | jrcuesta

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...]

NIR "Cross Validaton Statistics" with "R"

February 16, 2012 | jrcuesta

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...]

"R" PLS Package: Multiple Scatter Correction (MSC)

February 12, 2012 | jrcuesta

MSC (Multiple Scatter Correction) is a Math treatment to correct the scatter in the spectra. The scatter is produced for different physical circumstances as particle size, packaging.Normally scatter make worse the correlation of the spectra with the constituent of interest.Almost all the chemometric software’s available include this ...
[Read more...]

"R": PLS Regression (Gasoline) – 005

February 8, 2012 | jrcuesta

Let´s see know how to plot the scores for the 3 PLS Components:  We can see the explained variance from each component in the diagonal.We can get it from R with:__ explvar(gas1)   Comp 1      Comp 2  &nbs...
[Read more...]

"R": PLS Regression (Gasoline) – 004

February 7, 2012 | jrcuesta

In the previous post we plot the Cross Validation predictions with:__ plot(gas1, ncomp = 3, asp = 1, line = TRUE)We can plot the fitted values instead with:__ plot(gas1, ncomp = 3, asp = 1, line = TRUE,which=train) Graphics are different:Of course, using "train" we get  overoptimisc statistics and we should look better at ...
[Read more...]

"R": PLS Regression (Gasoline) – 003

February 3, 2012 | jrcuesta

The gasoline data set has the spectra of 60 samples acquired by diffuse reflectance from 900 to 1700 nm. We saw how to plot the spectra in the previous post.Now, following the tutorial of Bjorn-Helge Mevik published in "R-News Volume 6/3, August 2006", we will do the PLS regression:gas1 summary(gas1)Data:   X ...
[Read more...]

"R": Plotting the spectra (Gasoline) – 002

February 2, 2012 | jrcuesta

"R" has a package called "ChemometricsWithR", where we can get data from different analytical instruments including Near Infrared (NIR).Follow the steps to plot the spectra of a gasoline data set:In this other case we plot the spectra of the NIR shootout 2002: __ data(shootout)__ wavelengths mattplot(wavelengths,shootout$calibrate.1[1,],...
[Read more...]

"R": Looking at the Data (Gasoline) – 001

February 1, 2012 | jrcuesta

As other softwares "R" has nice tools to look to the data before to develop the calibration.Statistics for the "Y" variable (in this case octane number) like Maximun, Minimun,..,standard deviation,...are important:__ library(ChemometricsWithR)__ data(gasoline)__ summary(gasoline$octane)   Min.  1st Qu.  Median    Mean   3rd Qu.    Max.   83.40   85.88    87.75    87.18   88.45    89.60__ sd(...
[Read more...]

IRIS Flower Data Set (R-003)

December 19, 2011 | jrcuesta

Centramos la matriz con el comando, generando a partir de A una nueva matriz que llamamos "Acentered"Acentered=scale(A,center=T)Ahora con la función "eigen":Esta es otra forma de proceder con el cálculo de los componentes principales (eigenvectors y ...
[Read more...]
1 2 3 4 5

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)