# Class "opls"

### Description

An S4 class to store PCA and (O)PLS(-DA) models: Objects can be created by calls of the form
`new("opls", ...)`

or by calling the `opls`

function

### Slots

`typeC`

character: model type (PCA, PLS, PLS-DA, OPLS, or OPLS-DA)

`descriptionMC`

character matrix: Description of the data set (number of samples, variables, etc.)

`modelDF`

data frame with the model overview (number of components, R2X, R2X(cum), R2Y, R2Y(cum), Q2, Q2(cum), significance, iterations)

`summaryDF`

data frame with the model summary (cumulated R2X, R2Y and Q2); RMSEE is the square root of the mean error between the actual and the predicted responses

`subsetVi`

Integer vector: Indices of observations in the training data set

`pcaVarVn`

PCA: Numerical vector of variances of length: predI

`vipVn`

PLS(-DA): Numerical vector of Variable Importance in Projection; OPLS(-DA): Numerical vector of Variable Importance for Prediction (VIP4,p from Galindo-Prieto et al, 2014)

`orthoVipVn`

OPLS(-DA): Numerical vector of Variable Importance for Orthogonal Modeling (VIP4,o from Galindo-Prieto et al, 2014)

`coefficientMN`

(O)PLS(-DA): Numerical matrix of regression coefficients (B; dimensions: ncol(x) x number of responses; B = W*C' and Y = XB + F

`xMeanVn`

Numerical vector: variable means of the 'x' matrix

`xSdVn`

Numerical vector: variable standard deviations of the 'x' matrix

`yMeanVn`

(O)PLS: Numerical vector: variable means of the 'y' response (transformed into a dummy matrix in case it is of 'character' mode initially)

`ySdVn`

(O)PLS: Numerical vector: variable standard deviations of the 'y' response (transformed into a dummy matrix in case it is of 'character' mode initially)

`xZeroVarVi`

Numerical vector: indices of variables with variance < 2.22e-16 which were excluded from 'x' before building the model

`scoreMN`

Numerical matrix of x scores (T; dimensions: nrow(x) x predI) X = TP' + E; Y = TC' + F

`loadingMN`

Numerical matrix of x loadings (P; dimensions: ncol(x) x predI) X = TP' + E

`weightMN`

(O)PLS: Numerical matrix of x weights (W; same dimensions as loadingMN)

`orthoScoreMN`

OPLS: Numerical matrix of orthogonal scores (Tortho; dimensions: nrow(x) x number of orthogonal components)

`orthoLoadingMN`

OPLS: Numerical matrix of orthogonal loadings (Portho; dimensions: ncol(x) x number of orthogonal components)

`orthoWeightMN`

OPLS: Numerical matrix of orthogonal weights (same dimensions as orthoLoadingMN)

`cMN`

(O)PLS: Numerical matrix of Y weights (C); dimensions: number of responses or number of classes in case of qualitative response with more than 2 classes x number of predictive components; Y = TC' + F

`coMN`

(O)PLS: Numerical matrix of Y orthogonal weights; dimensions: number of responses or number of classes in case of qualitative response with more than 2 classes x number of orthogonal components

`uMN`

(O)PLS: Numerical matrix of Y scores (U; same dimensions as scoreMN); Y = UC' + G

`weightStarMN`

Numerical matrix of projections (W*; same dimensions as loadingMN); whereas columns of weightMN are derived from successively deflated matrices, columns of weightStarMN relate to the original 'x' matrix: T = XW*; W*=W(P'W)inv

`suppLs`

List of additional objects to be used internally by the 'print', 'plot', and 'predict' methods

### Objects from the Class

Objects can be created by calls of the form
`new("opls", ...)`

or by calling the `opls`

function

### Author(s)

Etienne Thevenot, etienne.thevenot@cea.fr

Etienne Thevenot, etienne.thevenot@cea.fr

### See Also

`opls`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ```
#### PCA
data(foods) ## see Eriksson et al. (2001); presence of 3 missing values (NA)
head(foods)
foodMN <- as.matrix(foods[, colnames(foods) != "Country"])
rownames(foodMN) <- foods[, "Country"]
head(foodMN)
foo.pca <- opls(foodMN)
#### PLS with a single response
data(cornell) ## see Tenenhaus, 1998
head(cornell)
cornell.pls <- opls(as.matrix(cornell[, grep("x", colnames(cornell))]),
cornell[, "y"])
## Complementary graphics
plot(cornell.pls, typeVc = c("outlier", "predict-train", "xy-score", "xy-weight"))
#### PLS with multiple (quantitative) responses
data(lowarp) ## see Eriksson et al. (2001); presence of NAs
head(lowarp)
lowarp.pls <- opls(as.matrix(lowarp[, c("glas", "crtp", "mica", "amtp")]),
as.matrix(lowarp[, grepl("^wrp", colnames(lowarp)) |
grepl("^st", colnames(lowarp))]))
#### PLS-DA
data(sacurine)
attach(sacurine)
sacurine.plsda <- opls(dataMatrix, sampleMetadata[, "gender"])
#### OPLS-DA
sacurine.oplsda <- opls(dataMatrix, sampleMetadata[, "gender"], predI = 1, orthoI = NA)
detach(sacurine)
``` |