# NIT: Fatty acids study in R – Part 005

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**NIR-Quimiometría**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

There are several algorithms to run a PLS regression (I recommend to consult the books:

*“Introduction to Multivariate Analysis in Chemometrics – Kurt Varmuza & Peter Filzmozer” and “Chemometrics with R – Ron Wehrens”*).We are going to use the PLS package, and we are going to develop, maybe the constituent which looks more promising: Oleic Acic (C18:1).

Of course we are going to use the MSC pretreatment. For vcross validation we are going to use “leave one out”.I decide a maximum of 16 PLS terms.

**> C18_1<- plsr(C18_1~NITmsc, ncomp = 16,data =fattyac_msc,**

**+ validation = “LOO”)**

**> plot(C18_1,ncomp=12,which=”validation”)**

We can see how from Term 12 the RMSEP increase.

We can see in the XY plot, how we have a few samples with a high residual (probably wrong lab value for one or two of them). We can delete these samples from the data set to develop the equation again (RMSEP will decrease a little bit and the RSQ will increase)

We have to consider the Lab error for this parameter of the reference method: Chromatography.

The extreme sample 66, fits well in the model, so we decide to keep it. The model seems quite good to predict “Oleic acid”. We will test it in a near future with new samples (independent test set).

To

**leave a comment**for the author, please follow the link and comment on their blog:**NIR-Quimiometría**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.