"R": PLS Regression (Gasoline) – 004

[This article was first published on 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.

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 the Cross Validation or to an independant test set for validation.
We decided 3 components to develop the PLS Regressions looking to the RMSEP plot. We can use other plots as the MSEP plot (changing RMSEP for MSEP), or to the RSQ plot.
> plot(R2(gas1),legendpos = “topright”)

We can see how after the 3th component becomes almost flat.
We can see it better with numbers:
> R2(gas1)
  (Intercept)    1 comps      2 comps      3 comps      4 comps      5 comps 
   -0.03419      0.23374      0.93684      0.97111      0.97474      0.97474 
    6 comps      7 comps      8 comps      9 comps     10 comps 
    0.97713      0.97914      0.97742      0.97453      0.97413 
We can see also the residuals in “R” for the different number of component (1, 2,…,10). In these values the calculation for the statistics are based.
These are the residual values for the PLSR model with 3 components:
         octane
1   0.100769634     
2   0.369121232
3   0.251715938
4  -0.209263557
5  -0.473107996
6   0.158305081
7   0.080218313
8  -0.141445641
9  -0.099252992
10 -0.077775217
11  0.561603527
12  0.488456018
13 -0.023514480
14 -0.106796820
15 -0.015477061
16  0.010451476
17  0.547102944
18  0.215613857
19 -0.290225797
20  0.238646916
21  0.115224011
22 -0.219819205
23 -0.040436420
24 -0.313450043
25 -0.161174139
26  0.065222607
27  0.032299933
28 -0.120728914
29 -0.394899511
30 -0.116389549
31 -0.242168963
32 -0.100928743
33 -0.003314534
34  0.152746720
35  0.092815472
36  0.029039668
37  0.020761125
38  0.339468953
39  0.019163788
40  0.192727538
41 -0.077437540
42 -0.267717370
43  0.161465598
44  0.101965851
45 -0.022411411
46 -0.322253768
47 -0.272445813
48 -0.151183595
49  0.063073375
50 -0.001254795
51  0.008358151
52  0.297159695
53  0.015659145
54  0.033326901
55 -0.141411827
56  0.280361574
57 -0.491022823
58 -0.332150710
59  0.269220723
60 -0.082606528


Bibliography:
Tutorials PLS Package for “R” :
Bjorn-Helge Mevik
Ron Wehrens

Radboud University Nijmegen
Norwegian University of Life Sciences

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.

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)