Learn R Programming

mdatools (version 0.14.1)

plsdares: 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)

Value

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

and plsres.

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.

See Also

Methods for plsda objects:

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

Methods, inherited from classres class:

showPredictions.classresshow table with predicted values.
plotPredictions.classresmakes plot with predicted values.
plotSensitivity.classresmakes plot with sensitivity vs. components values.
plotSpecificity.classresmakes plot with specificity vs. components values.
plotPerformance.classresmakes plot with both specificity and sensitivity values.

Methods for plsres objects:

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

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

plotPredictions.regresshows predicted vs. measured plot.
plotRMSE.regresshows RMSE plot.

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

Examples

Run this code
### 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))

Run the code above in your browser using DataLab