mod.SIMPLS: The Statistical Inspired Modification to Partial Least...

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.SIMPLS(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 SIMPLS algorithm

Author(s)

Opeoluwa F. Oyedele and Sugnet Gardner-Lubbe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
if(require(pls))
data(oliveoil, package="pls")
X = as.matrix(oliveoil$chemical, ncol=5)
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)
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")))
#final number of PLS components
RMSEP = mod.SIMPLS(X, Y, A=5)$RMSEP #RMSEP values
plot(t(RMSEP), type = "b", xlab="Number of components", ylab="RMSEP  values")
A.final = 2 #from the RMSEP plot
#PLS matrices R, P, T, Q, and Y.hat from SIMPLS algorithm
options(digits=3)
mod.SIMPLS(X, Y, A=A.final)

Example output

Loading required package: pls

Attaching package: 'pls'

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

    loadings

$X.scores
   Comp 1  Comp 2 
G1 -0.0393  0.7092
G2 -0.0738 -0.1350
G3 -0.2273  0.0203
G4  0.0357  0.4519
G5 -0.1578  0.2577
I1  0.4206 -0.0499
I2  0.1581 -0.0696
I3  0.4039 -0.1322
I4  0.1810  0.0130
I5  0.4748 -0.1019
S1 -0.2131 -0.2064
S2 -0.3941 -0.0776
S3 -0.0590 -0.1267
S4 -0.1744 -0.1864
S5 -0.1911 -0.2373
S6 -0.1443 -0.1292

$X.weights.trans
         Comp 1   Comp 2 
Acidity  0.05159  0.88272
Peroxide 0.99439 -0.03244
K232     0.09178  0.45582
K270     0.01021  0.10941
DK       0.00054  0.00407

$X.loadings
          Comp 1   Comp 2 
Acidity   0.03410  0.64688
Peroxide 12.95554 -0.05308
K232      0.84366  0.20570
K270      0.05108  0.05175
DK        0.00423  0.00455

$Y.loadings
       Comp 1  Comp 2 
Yellow  -31.38  -41.05
Green    31.04   51.58
Brown    15.44   -3.34
Glossy  -16.08   -6.09
Transp  -19.25  -10.10
Syrup     9.01    1.29

$Y.hat
, , 1 Comps

   Yellow Green Brown Glossy Transp Syrup
G1   52.1  32.3 11.72   81.4   79.0  47.6
G2   53.2  31.2 11.19   82.0   79.6  47.3
G3   58.0  26.5  8.82   84.5   82.6  45.9
G4   49.8  34.6 12.88   80.2   77.5  48.3
G5   55.8  28.6  9.89   83.3   81.2  46.6
I1   37.7  46.6 18.82   74.1   70.1  51.8
I2   45.9  38.4 14.77   78.3   75.2  49.4
I3   38.2  46.1 18.57   74.3   70.4  51.6
I4   45.2  39.1 15.13   77.9   74.7  49.6
I5   36.0  48.2 19.66   73.2   69.1  52.3
S1   57.6  26.9  9.04   84.2   82.3  46.1
S2   63.2  21.3  6.25   87.1   85.8  44.4
S3   52.7  31.7 11.42   81.8   79.3  47.4
S4   56.3  28.1  9.64   83.6   81.6  46.4
S5   56.9  27.6  9.38   83.9   81.9  46.3
S6   55.4  29.0 10.10   83.1   81.0  46.7

, , 2 Comps

   Yellow Green Brown Glossy Transp Syrup
G1   23.0  68.9  9.35   77.1   71.8  48.5
G2   58.7  24.3 11.64   82.8   81.0  47.1
G3   57.2  27.5  8.75   84.3   82.4  46.0
G4   31.2  57.9 11.37   77.5   72.9  48.9
G5   45.2  41.9  9.03   81.8   78.6  46.9
I1   39.7  44.0 18.99   74.4   70.6  51.7
I2   48.8  34.8 15.00   78.7   75.9  49.3
I3   43.6  39.2 19.01   75.1   71.8  51.4
I4   44.7  39.8 15.08   77.8   74.6  49.6
I5   40.2  43.0 20.00   73.8   70.1  52.1
S1   66.0  16.3  9.73   85.5   84.4  45.8
S2   66.4  17.3  6.51   87.6   86.6  44.3
S3   57.9  25.1 11.84   82.5   80.6  47.3
S4   64.0  18.5 10.26   84.8   83.4  46.2
S5   66.6  15.3 10.17   85.3   84.3  45.9
S6   60.7  22.4 10.54   83.9   82.3  46.5


$RMSEP
            1 Comps 2 Comps
RMSEP.value    28.7    23.3

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