# "R" Chemometrics

February 22, 2012 |

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... ### Standard Normal Variate (SNV)

February 19, 2012 |

### Plotting the “Mean Spectrum”

February 17, 2012 |

### NIR "Cross Validaton Statistics" with "R"

February 16, 2012 |

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... ### "NIR Std. Dev. Spectra" with "R"

February 15, 2012 |

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

February 12, 2012 |

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 ... ### "R": Predicting a Test Set (Gasoline)

February 9, 2012 |

__ data(gasoline)__ #60 spectra of gasoline (octane is the constituent) __ #We divide the whole Set into a Train Set and a Test Set.__ gasTrain gasTest #Let´s develop the PLSR with the Tain Set ... ### "R": PLS Regression (Gasoline) – 005

February 8, 2012 |

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... ### "R": PLS Regression (Gasoline) – 004

February 7, 2012 |

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 ... ### "R": PLS Regression (Gasoline) – 003

February 3, 2012 |

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 ... ### "R": Plotting the spectra (Gasoline) – 002

February 2, 2012 |

"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 | 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(... ### NIPALS: Principal Components Analysis with "R" (Part: 002)

January 1, 2012 |

We started some posts based on the tutorials of:"Multivariate Statistical Analysis using the R package chemometrics"The first post was:Principal Components Analysis with "R" (Part: 001)Now we continue with a second part.The graphics help us to dec... ### IRIS Flower Data Set (R-003)

December 19, 2011 |

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 ... ### IRIS Flower Data Set (R-002)

December 17, 2011 |

Ver  primero: IRIS Flower Data Set (R-001)See first:        IRIS Flower Data Set (R-001)El comando "summary" nos ayuda a comprender la importancia de cada componente principal:Los "eigenvalues" son las desviacion... ### IRIS Flower Data Set (R-001)

December 17, 2011 |

IRIS Flower Data SetEste es el Link a Wikipedia donde podéis encontrar los datos que utilizó Fisher en su trabajo de 1936. Ya hemos trabajado con estos datos en Excel y los continuaremos usando en nuevas entradas.En este link, podemos ver las fotos de las flores (IRIS en castellano ... December 12, 2011 |

Ver primero: PCA file calculation with "R"See first:         PCA file calculation with "R"Podemos ver los diferentes planos que forman los PCs entre sí, con la función "Pairs" de "R".We can see all the combinat... ### Principal Components Analysis with "R" (Part: 001)

December 7, 2011 |

This is the first "post" of my new adventure with a software that I consider very interesting and that give to people the oportunity to work with Chemometrics ("R" is free).To follow these examples, yo can download the following article:"Multivariate S...  