Learn R Programming

mdatools (version 0.7.0)

simcam: SIMCA multiclass classification

Description

simcam is used to combine several one-class SIMCA models for multiclass classification.

Usage

simcam(models, info = "")

Arguments

models
list with SIMCA models (simca objects).
info
text with information about the the object.

Value

Returns an object of simcam class with following fields:
models
a list with provided SIMCA models.
dispower
an array with discrimination power of variables for each pair of individual models.
moddist
a matrix with distance between each each pair of individual models.
classnames
vector with names of individual classes.
nclasses
number of classes in the object.
info
information provided by user when create the object.
calres
an object of class simcamres with classification results for a calibration data.

Details

Besides the possibility for multiclass classification, SIMCAM also provides tools for investigation of relationship among individual models (classes), such as discrimination power of variables, Cooman's plot, model distance, etc.

When create simcam object, the calibration data from all individual SIMCA models is extracted and combined for making predictions and calculate performance of the multi-class model. The results are stored in $calres field of the model object.

See Also

Methods for simca objects:
print.simcam
shows information about the object.
summary.simcam
shows summary statistics for the models.
plot.simcam
makes an overview of SIMCAM model with two plots.
predict.simcam
applies SIMCAM model to a new data.
plotModelDistance.simcam
shows plot with distance between individual models.
plotDiscriminationPower.simcam
shows plot with discrimination power.
plotModellingPower.simcam
shows plot with modelling power for individual model.
plotCooman.simcam
shows Cooman's plot for calibration data.
plotResiduals.simcam
shows plot with Q vs. T2 residuals for calibration data.

Methods, inherited from classmodel class:

plotPredictions.classmodel
shows plot with predicted values.
plotSensitivity.classmodel
shows sensitivity plot.
plotSpecificity.classmodel
shows specificity plot.
plotMisclassified.classmodel
shows misclassified ratio plot.

Since SIMCAM objects and results are calculated only for optimal number of components, there is no sense to show such plots like sensitivity or specificity vs. number of components. However they are available as for any other classification model.

Examples

Run this code
## make a multiclass SIMCA model for Iris data
library(mdatools)

# split data
caldata = iris[seq(1, nrow(iris), 2), 1:4]
se = caldata[1:25, ]
ve = caldata[26:50, ]
vi = caldata[51:75, ]

testdata = iris[seq(2, nrow(iris), 2), 1:4]
testdata.cref = iris[seq(2, nrow(iris), 2), 5]

# create individual models
semodel = simca(se, classname = 'setosa')
semodel = selectCompNum(semodel, 1)

vimodel = simca(vi, classname = 'virginica')
vimodel = selectCompNum(vimodel, 1)

vemodel = simca(ve, classname = 'versicolor')
vemodel = selectCompNum(vemodel, 1)

# combine models into SIMCAM objects, show statistics and plots
model = simcam(list(semodel, vimodel, vemodel), info = 'Iris data')
summary(model)
plot(model)

# show predictions and residuals for calibration data
par(mfrow = c(2, 2))
plotPredictions(model)
plotCooman(model, nc = c(1, 2))
plotResiduals(model, nc = 1)
plotResiduals(model, nc = 2)
par(mfrow = c(1, 1))

# show different plots for the model
par(mfrow = c(2, 2))
plotModelDistance(model, nc = 1)
plotDiscriminationPower(model, nc = c(1, 2))
plotModellingPower(model, nc = 1)
plotModellingPower(model, nc = 2)
par(mfrow = c(1, 1))

# apply the SIMCAM model to test set and show statistics and plots
res = predict(model, testdata, testdata.cref)
summary(res)
plotPredictions(res)

Run the code above in your browser using DataLab