plsdares {mdatools}R Documentation

PLS-DA results

Description

plsdares is used to store and visualize results of applying a PLS-DA model to a new data.

Usage

plsdares(plsres, cres)

Arguments

plsres

PLS results for the data.

cres

Classification results for the data.

Details

Do not use plsdares manually, the object is created automatically when one applies a PLS-DA model to a new data set, e.g. when calibrate and validate a PLS-DA model (all calibration and validation results in PLS-DA model are stored as objects of plsdares class) or use function predict.plsda.

The object gives access to all PLS-DA results as well as to the plotting methods for visualisation of the results. The plsidares class also inherits all properties and methods of classres and plsres classes.

If no reference values provided, classification statistics will not be calculated and performance plots will not be available.

Value

Returns an object of plsdares class with fields, inherited from classres and plsres.

See Also

Methods for plsda objects:

print.plsda shows information about the object.
summary.plsda shows statistics for results of classification.
plot.plsda shows plots for overview of the results.

Methods, inherited from classres class:

showPredictions.classres show table with predicted values.
plotPredictions.classres makes plot with predicted values.
plotSensitivity.classres makes plot with sensitivity vs. components values.
plotSpecificity.classres makes plot with specificity vs. components values.
plotPerformance.classres makes plot with both specificity and sensitivity values.

Methods for plsres objects:

print prints information about a plsres object.
summary.plsres shows performance statistics for the results.
plot.plsres shows plot overview of the results.
plotXScores.plsres shows scores plot for x decomposition.
plotXYScores.plsres shows scores plot for x and y decomposition.
plotXVariance.plsres shows explained variance plot for x decomposition.
plotYVariance.plsres shows explained variance plot for y decomposition.
plotXCumVariance.plsres shows cumulative explained variance plot for y decomposition.
plotYCumVariance.plsres shows cumulative explained variance plot for y decomposition.
plotXResiduals.plsres shows T2 vs. Q plot for x decomposition.
plotYResiduals.plsres shows residuals plot for y values.

Methods inherited from regres class (parent class for plsres):

plotPredictions.regres shows predicted vs. measured plot.
plotRMSE.regres shows RMSE plot.

See also plsda - a class for PLS-DA models, predict.plsda applying PLS-DA model for a new dataset.

Examples

### Examples for PLS-DA results class

library(mdatools)

## 1. Make a PLS-DA model with full cross-validation, get
## calibration results and show overview

# make a calibration set from iris data (3 classes)
# use names of classes as class vector
x.cal = iris[seq(1, nrow(iris), 2), 1:4]
c.cal = iris[seq(1, nrow(iris), 2), 5]

model = plsda(x.cal, c.cal, ncomp = 3, cv = 1, info = 'IRIS data example')
model = selectCompNum(model, 1)

res = model$calres

# show summary and basic plots for calibration results
summary(res)
plot(res)

## 2. Apply the calibrated PLS-DA model to a new dataset

# make a new data
x.new = iris[seq(2, nrow(iris), 2), 1:4]
c.new = iris[seq(2, nrow(iris), 2), 5]

res = predict(model, x.new, c.new)
summary(res)
plot(res)

## 3. Show performance plots for the results
par(mfrow = c(2, 2))
plotSpecificity(res)
plotSensitivity(res)
plotMisclassified(res)
plotMisclassified(res, nc = 2)
par(mfrow = c(1, 1))

## 3. Show both class and y values predictions
par(mfrow = c(2, 2))
plotPredictions(res)
plotPredictions(res, ncomp = 2, nc = 2)
plotPredictions(structure(res, class = "regres"))
plotPredictions(structure(res, class = "regres"), ncomp = 2, ny = 2)
par(mfrow = c(1, 1))

## 4. All plots from ordinary PLS results can be used, e.g.:
par(mfrow = c(2, 2))
plotXYScores(res)
plotYVariance(res, type = 'h')
plotXVariance(res, type = 'h')
plotXResiduals(res)
par(mfrow = c(1, 1))


[Package mdatools version 0.14.1 Index]