Learn R Programming

ropls (version 1.4.2)

opls-class: Class "opls"

Description

The opls object class

Arguments

Objects from the Class

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

Methods

print
signature(object = "opls"): print method for (O)PLS(-DA) models
show
signature(object = "opls"): show method for (O)PLS(-DA) models
plot
signature(object = "opls"): plot method for (O)PLS(-DA) models
predict
signature(object = "opls"): plot method for (O)PLS(-DA) models
coef
signature(object = "opls"):
fitted
signature(object = "opls"): returns predictions of the (O)PLS(-DA) model
residuals
signature(object = "opls"): returns the residuals of the (O)PLS(-DA) regression model
tested
signature(object = "opls"): returns the predictions of the (O)PLS(-DA) trained on the 'subset' observations only
getSummaryDF
signature(object = "opls"): returns summary information about the model
getPcaVarVn
signature(object = "opls"): returns the variance of the components (score vectors)
getScoreMN
signature(object = "opls"): returns the (orthogonal) score matrix of the PCA/(O)PLS(-DA) model
getLoadingMN
signature(object = "opls"): returns the (orthogonal) loading matrix of the PCA/(O)PLS(-DA) model
getWeightMN
signature(object = "opls"): returns the (orthogonal) weight matrix of the (O)PLS(-DA) model
getVipVn
signature(object = "opls"): returns the (orthogonal) VIP values of the (O)PLS(-DA) model
getSubsetVi
signature(object = "opls"): extracts the indices of the samples used for building the model (when a subset argument has been specified)

See Also

opls,

Examples

Run this code

#### 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)

Run the code above in your browser using DataLab