mod.NIPALS: The Nonlinear Iterative PArtial Least Squares (NIPALS)...

Description Usage Arguments Value Author(s) Examples

View source: R/AllFunctions.R

Description

Takes in a set of predictor variables and a set of response variables and gives the Partial Least Squares (PLS) parameters.

Usage

1
mod.NIPALS(X, Y, A, ...)

Arguments

X

A (NxP) predictor matrix

Y

A (NxM) response matrix

A

The number of PLS components

...

Other arguments. Currently ignored

Value

The PLS parameters using the NIPALS algorithm

Author(s)

Opeoluwa F. Oyedele and Sugnet Gardner-Lubbe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if(require(pls))
data(oliveoil, package="pls")
X = as.matrix(oliveoil$chemical, ncol=5)  #predictors
dimnames(X) = list(paste(c("G1","G2","G3","G4","G5","I1","I2","I3","I4","I5",
"S1","S2","S3","S4","S5","S6")),
paste(c("Acidity","Peroxide","K232","K270","DK")))
Y = as.matrix(oliveoil$sensory, ncol=6)  #responses
dimnames(Y) = list(paste(c("G1","G2","G3","G4","G5","I1","I2","I3","I4","I5",
"S1","S2","S3","S4","S5","S6")),
paste(c("Yellow","Green","Brown","Glossy","Transp","Syrup")))
mod.NIPALS(X, Y, A=5)

Example output

Loading required package: pls

Attaching package: 'pls'

The following object is masked from 'package:stats':

    loadings

$X.scores
       Comp 1      Comp 2      Comp 3       Comp 4      Comp 5 
G1 -0.03934534  0.70921860  0.18003306 -0.353762446 -0.07163914
G2 -0.07376958 -0.13494971  0.14611686  0.104165032  0.19401873
G3 -0.22726282  0.02026683  0.26113022  0.050784886  0.46766055
G4  0.03574200  0.45188193 -0.29601245  0.617640294  0.01593584
G5 -0.15782156  0.25772612 -0.21350971  0.009917198 -0.05322417
I1  0.42059739 -0.04992442  0.15463650  0.023953791 -0.29071621
I2  0.15807492 -0.06960157  0.14747721 -0.198084729 -0.14140178
I3  0.40392098 -0.13226261 -0.27336478 -0.014812432 -0.33617955
I4  0.18104261  0.01297352 -0.10655203 -0.421402287  0.16781958
I5  0.47477335 -0.10183879  0.32887461  0.263215347  0.37130414
S1 -0.21311564 -0.20640223  0.09547374  0.335176499 -0.20572758
S2 -0.39408933 -0.07753679  0.40252754  0.053488139 -0.45325359
S3 -0.05899759 -0.12670330 -0.19157698 -0.217344954  0.07072049
S4 -0.17437583 -0.18638869  0.11605614 -0.161706161  0.06169895
S5 -0.19112039 -0.23727908 -0.40201172 -0.035650070 -0.09177240
S6 -0.14425316 -0.12917981 -0.34929820 -0.055578109  0.29475616

$Y.scores
       Comp 1      Comp 2       Comp 3      Comp 4      Comp 5 
G1  0.37553943  0.41375597  0.396196797  0.41015149  0.39715745
G2  0.35537590  0.36806420  0.358752313  0.35947372  0.35844148
G3  0.16728511  0.21697710  0.208550834  0.22401742  0.21677180
G4  0.24152183  0.26626529  0.260498355  0.27457472  0.26420737
G5  0.04099311  0.01410060  0.001560646 -0.02367676 -0.03196306
I1  0.21306665  0.13534280  0.161498155  0.12508976  0.14567438
I2 -0.02710562 -0.03283571 -0.032502364 -0.04120548 -0.04718224
I3  0.33053897  0.34058029  0.342008419  0.35338540  0.34759471
I4 -0.20219831 -0.21646166 -0.219074838 -0.22560869 -0.20896021
I5  0.10295127  0.02087342  0.072572944  0.05009661  0.09559123
S1 -0.27786402 -0.25573141 -0.259533147 -0.24824490 -0.26330330
S2 -0.32576090 -0.28680840 -0.299301478 -0.28581089 -0.30669487
S3 -0.19371344 -0.22005904 -0.220821989 -0.23670334 -0.23374272
S4 -0.22014533 -0.22022539 -0.219882440 -0.21816125 -0.21306295
S5 -0.28793318 -0.26920108 -0.272582827 -0.25680603 -0.26010187
S6 -0.29255148 -0.27463697 -0.277939381 -0.26057180 -0.26042721

$X.weights
              Comp 1       Comp 2      Comp 3       Comp 4        Comp 5 
Acidity  0.0515883367  0.881173475 -0.46973909 -0.008400822  1.210648e-02
Peroxide 0.9943899374 -0.088501324 -0.05699718  0.010367577 -5.055367e-05
K232     0.0917757507  0.451442671  0.86107895 -0.214894608  1.183526e-02
K270     0.0102086013  0.109013729  0.18542802  0.970317388 -1.100564e-01
DK       0.0005403112  0.004042812 -0.01599996 -0.110119997 -9.937811e-01

$RMSEP
            1 Comps  2 Comps  3 Comps  4 Comps  5 Comps
RMSEP.value 28.7256 23.32551 22.91181 22.20788 22.05887

$X.weights.trans
              Comp 1       Comp 2     Comp 3      Comp 4        Comp 5 
Acidity  3.979794e-03  1.313185059 -0.6835222 -1.00306209  2.219011e+00
Peroxide 7.671243e-02 -0.048266641 -0.1305731  0.03155369  1.350275e-03
K232     7.080061e-03  0.678237631  2.0065100 -1.58772842  1.977919e+00
K270     7.875448e-04  0.162779840  0.4361420 19.06871999 -1.643714e+01
DK       4.168243e-05  0.006050276 -0.0327246 -2.14289691 -2.179297e+02

$X.loadings
             Comp 1       Comp 2        Comp 3        Comp 4        Comp 5 
Acidity   0.03409876  0.646865616 -0.2191932541 -0.0004621782  5.542407e-05
Peroxide 12.95553683 -0.053080020 -0.0273420880  0.0005432205 -2.314372e-07
K232      0.84366049  0.205726544  0.4168828876 -0.0112793136  5.418238e-05
K270      0.05107740  0.051755378  0.0232039479  0.0510329525 -5.038435e-04
DK        0.00423203  0.004549772 -0.0001985734 -0.0039561856 -4.549579e-03

$Y.loadings
          Comp 1     Comp 2       Comp 3       Comp 4     Comp 5 
Yellow -31.376561 -41.045787 -11.86820401 -14.77129577 -8.9768322
Green   31.039981  51.581371  11.44537208  16.12458596  3.3477801
Brown   15.438390  -3.343316   4.72804259   5.40584462  2.9286264
Glossy -16.076603  -6.093854  -2.94763207   0.84968342  0.2443098
Transp -19.252721 -10.096030  -1.77708282   0.17470909  0.2250705
Syrup    9.012331   1.285604  -0.06233971  -0.08301238  2.2486591

$Y.hat
, , 1 Comps

     Yellow    Green     Brown   Glossy   Transp    Syrup
G1 52.10952 32.29122 11.723821 81.44504 78.95125 47.62041
G2 53.18964 31.22269 11.192366 81.99846 79.61402 47.31016
G3 58.00573 26.45827  8.822678 84.46611 82.56918 45.92683
G4 49.75354 34.62193 12.883049 80.23789 77.50562 48.29712
G5 55.82690 28.61372  9.894739 83.34973 81.23224 46.55266
I1 37.67810 46.56784 18.824596 74.05072 70.09611 51.76556
I2 45.91515 38.41914 14.771672 78.27119 75.15038 49.39962
I3 38.20135 46.05020 18.567139 74.31882 70.41717 51.61527
I4 45.19451 39.13206 15.126256 77.90195 74.70819 49.60662
I5 35.97825 48.24946 19.660986 73.17976 69.05307 52.25381
S1 57.56184 26.89739  9.041088 84.23868 82.29681 46.05433
S2 63.24017 21.27997  6.247145 87.14812 85.78104 44.42334
S3 52.72614 31.68122 11.420422 81.76098 79.32961 47.44329
S4 56.34631 28.09988  9.639168 83.61587 81.55096 46.40347
S5 56.87170 27.58013  9.380659 83.88507 81.87334 46.25256
S6 55.40117 29.03488 10.104213 83.13160 80.97102 46.67494

, , 2 Comps

     Yellow    Green     Brown   Glossy   Transp    Syrup
G1 22.99909 68.87369  9.352679 77.12316 71.79096 48.53218
G2 58.72875 24.26180 11.643546 82.82083 80.97647 47.13667
G3 57.17386 27.50366  8.754920 84.34261 82.36456 45.95289
G4 31.20569 57.93062 11.372265 77.48419 72.94341 48.87806
G5 45.24833 41.90759  9.033079 81.77919 78.63023 46.88399
I1 39.72729 43.99267 18.991510 74.35495 70.60014 51.70138
I2 48.77200 34.82900 15.004372 78.69533 75.85308 49.31014
I3 43.63017 39.22791 19.009335 75.12481 71.75250 51.44523
I4 44.66200 39.80125 15.082882 77.82289 74.57721 49.62329
I5 40.15830 42.99647 20.001465 73.80035 70.08124 52.12289
S1 66.03378 16.25088  9.731156 85.49646 84.38065 45.78898
S2 66.42273 17.28052  6.506375 87.62062 86.56386 44.32366
S3 57.92678 25.14569 11.844031 82.53309 80.60881 47.28040
S4 63.99678 18.48569 10.262324 84.75170 83.43274 46.16385
S5 66.61101 15.34095 10.173958 85.33101 84.26891 45.94751
S6 60.70346 22.37161 10.536102 83.91880 82.27522 46.50887

, , 3 Comps

     Yellow    Green     Brown   Glossy   Transp    Syrup
G1 20.86242 70.93423 10.203883 76.59249 71.47103 48.52096
G2 56.99461 25.93416 12.334393 82.39013 80.71681 47.12756
G3 54.07471 30.49239  9.989554 83.57290 81.90051 45.93661
G4 34.71883 54.54265  9.972705 78.35672 73.46944 48.89651
G5 47.78230 39.46389  8.023596 82.40854 79.00966 46.89730
I1 37.89203 45.76254 19.722637 73.89914 70.32534 51.69174
I2 47.02171 36.51693 15.701651 78.26063 75.59100 49.30095
I3 46.87452 36.09915 17.716855 75.93059 72.23829 51.46227
I4 45.92658 38.58172 14.579099 78.13697 74.76656 49.62994
I5 36.25515 46.76056 21.556398 72.83095 69.49680 52.10239
S1 64.90068 17.34362 10.182560 85.21504 84.21098 45.78303
S2 61.64545 21.88760  8.409543 86.43411 85.84853 44.29856
S3 60.20045 22.95302 10.938247 83.09779 80.94926 47.29235
S4 62.61941 19.81400 10.811043 84.40961 83.22650 46.15661
S5 71.38216 10.73977  8.273229 86.51599 84.98332 45.97257
S6 64.84900 18.37376  8.884606 84.94841 82.89595 46.53064

, , 4 Comps

     Yellow    Green     Brown   Glossy   Transp    Syrup
G1 26.08795 65.22996  8.291499 76.29191 71.40922 48.55032
G2 55.45596 27.61378 12.897493 82.47864 80.73501 47.11892
G3 53.32455 31.31127 10.264090 83.61605 81.90939 45.93239
G4 25.59548 64.50184 13.311573 78.88152 73.57735 48.84524
G5 47.63581 39.62380  8.077207 82.41696 79.01139 46.89648
I1 37.53820 46.14878 19.852128 73.91950 70.32953 51.68975
I2 49.94768 33.32290 14.630836 78.09232 75.55639 49.31739
I3 47.09332 35.86031 17.636781 75.91800 72.23570 51.46350
I4 52.15124 31.78679 12.301064 77.77891 74.69294 49.66492
I5 32.36712 51.00480 22.979300 73.05460 69.54279 52.08054
S1 59.94968 22.74820 11.994472 85.49983 84.26954 45.75520
S2 60.85536 22.75007  8.698691 86.47956 85.85788 44.29412
S3 63.41092 19.44842  9.763314 82.91312 80.91129 47.31039
S4 65.00802 17.20655  9.936884 84.27221 83.19825 46.17003
S5 71.90876 10.16493  8.080511 86.48570 84.97709 45.97553
S6 65.66996 17.47759  8.584159 84.90118 82.88624 46.53526

, , 5 Comps

     Yellow     Green     Brown   Glossy   Transp    Syrup
G1 26.73104 64.990130  8.081694 76.27441 71.39310 48.38923
G2 53.71428 28.263314 13.465701 82.52604 80.77868 47.55520
G3 49.12644 32.876899 11.633693 83.73030 82.01464 46.98400
G4 25.45242 64.555192 13.358243 78.88542 73.58094 48.88108
G5 48.11360 39.445618  7.921333 82.40396 78.99941 46.77680
I1 40.14791 45.175529 19.000729 73.84847 70.26410 51.03603
I2 51.21702 32.849514 14.216723 78.05777 75.52457 48.99943
I3 50.11115 34.734852 16.652237 75.83587 72.16004 50.70755
I4 50.64475 32.348609 12.792545 77.81991 74.73071 50.04229
I5 29.03398 52.247847 24.066711 73.14531 69.62636 52.91547
S1 61.79647 22.059468 11.391972 85.44957 84.22324 45.29259
S2 64.92414 21.232679  7.371281 86.36883 85.75586 43.27491
S3 62.77607 19.685175  9.970428 82.93039 80.92721 47.46942
S4 64.45415 17.413109 10.117578 84.28728 83.21214 46.30877
S5 72.73259  9.857696  7.811744 86.46328 84.95644 45.76917
S6 63.02398 18.464369  9.447390 84.97319 82.95258 47.19806

PLSbiplot1 documentation built on May 2, 2019, 9:41 a.m.