Learn R Programming

mdatools (version 0.5.3)

simca: SIMCA one-class classification

Description

simca is used to make SIMCA (Soft Independent Modelling of Class Analogies) model for one-class classification.

Usage

simca(x, classname, ncomp = 15, center = T, scale = F, cv = NULL, x.test = NULL, 
   c.test = NULL, alpha = 0.05, method = "svd", info = "")

Arguments

x
a numerical matrix with data values.
classname
short text (up to 20 symbols) with class name.
ncomp
maximum number of components to calculate.
center
logical, do mean centering of data or not.
scale
logical, do sdandardization of data or not.
cv
number of segments for random cross-validation (1 for full cross-validation).
x.test
a numerical matrix with test data.
c.test
a vector with text values (names of classes) of test data objects.
alpha
significance level for calculating limit for T2 and Q2 residuals.
method
method to compute principal components.
info
text with information about the model

Value

  • Returns an object of simca class with following fields:
  • classnamea short text with class name.
  • modpowera matrix with modelling power of variables.
  • calresan object of class simcares with classification results for a calibration data.
  • testresan object of class simcares with classification results for a test data, if it was provided.
  • cvresan object of class simcares with classification results for cross-validation, if this option was chosen.
  • Fields, inherited from pca class:
  • ncompnumber of components included to the model.
  • ncomp.selectedselected (optimal) number of components.
  • loadingsmatrix with loading values (nvar x ncomp).
  • eigenvalsvector with eigenvalues for all existent components.
  • expvarvector with explained variance for each component (in percent).
  • cumexpvarvector with cumulative explained variance for each component (in percent).
  • T2limstatistical limit for T2 distance.
  • Q2limstatistical limit for Q2 distance.
  • infoinformation about the model, provided by user when build the model.

Details

SIMCA is in fact PCA model with additional functionality, so simca class inherits most of the functionality of pca class.

References

1. S. Wold, M. Sjostrom. "SIMCA: A method for analyzing chemical data in terms of similarity and analogy" in B.R. Kowalski (ed.), Chemometrics Theory and Application, American Chemical Society Symposium Series 52, Wash., D.C., American Chemical Society, p. 243-282.

See Also

Methods for simca objects: ll{ print.simca shows information about the object. summary.simca shows summary statistics for the model. plot.simca makes an overview of SIMCA model with four plots. predict.simca applies SIMCA model to a new data. plotModellingPower.simca shows plot with modelling power of variables. }

Methods, inherited from classmodel class: ll{ plotPredictions.classmodel shows plot with predicted values. plotSensitivity.classmodel shows sensitivity plot. plotSpecificity.classmodel shows specificity plot. plotMisclassified.classmodel shows misclassified ratio plot. }

Methods, inherited from pca class: ll{ selectCompNum.pca set number of optimal components in the model plotScores.pca shows scores plot. plotLoadings.pca shows loadings plot. plotVariance.pca shows explained variance plot. plotCumVariance.pca shows cumulative explained variance plot. plotResiduals.pca shows Q2 vs. T2 residuals plot. }

Examples

Run this code
## make a SIMCA model for Iris setosa class with full cross-validation
library(mdatools)

data = iris[, 1:4]
class = iris[, 5]

# take first 20 objects of setosa as calibration set 
se = data[1:20, ]

# make SIMCA model and apply to test set
model = simca(se, 'setosa', cv = 1)
model = selectCompNum(model, 1)

# show infromation, summary and plot overview
print(model)
summary(model)
plot(model)

# show predictions 
par(mfrow = c(2, 1))
plotPredictions(model, show.labels = TRUE)
plotPredictions(model, res = 'calres', ncomp = 2, show.labels = TRUE)
par(mfrow = c(1, 1))

# show performance, modelling power and residuals for ncomp = 2
par(mfrow = c(2, 2))
plotSensitivity(model)
plotMisclassified(model)
plotModellingPower(model, ncomp = 2, show.labels = TRUE)
plotResiduals(model, ncomp = 2)
par(mfrow = c(1, 1))

Run the code above in your browser using DataLab