simcares: Results of SIMCA one-class classification

Description Usage Arguments Details Value See Also Examples

View source: R/simcares.R

Description

@description simcares is used to store results for SIMCA one-class classification.

Usage

1
simcares(class.res, pca.res = NULL)

Arguments

class.res

results of classification (class classres).

pca.res

results of PCA decomposition of data (class pcares).

Details

Class simcares inherits all properties and methods of class pcares, and has additional properties and functions for representing of classification results, inherited from class classres.

There is no need to create a simcares object manually, it is created automatically when build a SIMCA model (see simca) or apply the model to a new data (see predict.simca). The object can be used to show summary and plots for the results.

Value

Returns an object (list) of class simcares with the same fields as pcares plus extra fields, inherited from classres:

c.pred

predicted class values (+1 or -1).

c.ref

reference (true) class values if provided.

The following fields are available only if reference values were provided.

tp

number of true positives.

fp

nmber of false positives.

fn

number of false negatives.

specificity

specificity of predictions.

sensitivity

sensitivity of predictions.

See Also

Methods for simcares objects:

print.simcares shows information about the object.
summary.simcares shows statistics for results of classification.

Methods, inherited from classres class:

showPredictions.classres show table with predicted values.
plotPredictions.classres predicted classes plot.
plotSensitivity.classres sensitivity plot.
plotSpecificity.classres specificity plot.
plotPerformance.classres performance plot.

Methods, inherited from ldecomp class:

plotResiduals.ldecomp makes Q2 vs. T2 residuals plot.
plotScores.ldecomp makes scores plot.
plotVariance.ldecomp makes explained variance plot.
plotCumVariance.ldecomp makes cumulative explained variance plot.

Check also simca and pcares.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## make a SIMCA model for Iris setosa class and show results for calibration set
library(mdatools)

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

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

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

# show infromation and summary
print(model$calres)
summary(model$calres)

# show plots
layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE))
plotPredictions(model$calres, show.labels = TRUE)
plotResiduals(model$calres, show.labels = TRUE)
plotPerformance(model$calres, show.labels = TRUE, legend.position = 'bottomright')
layout(1, 1, 1)

# show predictions table
showPredictions(model$calres)

Example output

Result for SIMCA one-class classification (class simcares)

Major fields:
$scores - matrix with score values
$T2 - matrix with T2 distances
$Q - matrix with Q residuals
$ncomp.selected - selected number of components
$expvar - explained variance for each component
$cumexpvar - cumulative explained variance
$c.pred - predicted class values
$c.ref - reference (true) class values
$tp - number of true positives
$tn - number of true negatives
$fp - number of false positives
$fn - number of false negatives
$specificity - specificity of predictions
$sensitivity - sn of predictions
$misclassified - misclassification ratio for predictions


Summary for SIMCA one-class classification result

Class name: Se
Number of selected components: 1

       Expvar Cumexpvar TP FP TN FN Spec. Sens. Accuracy
Comp 1  77.11     77.11 28  0  0  2    NA 0.933    0.933
Comp 2  13.88     90.99 28  0  0  2    NA 0.933    0.933
Comp 3   7.20     98.19 27  0  0  3    NA 0.900    0.900

      Se
 [1,]  1
 [2,]  1
 [3,]  1
 [4,]  1
 [5,]  1
 [6,]  1
 [7,]  1
 [8,]  1
 [9,]  1
[10,]  1
[11,]  1
[12,]  1
[13,]  1
[14,]  1
[15,] -1
[16,]  1
[17,]  1
[18,]  1
[19,]  1
[20,]  1
[21,]  1
[22,]  1
[23,] -1
[24,]  1
[25,]  1
[26,]  1
[27,]  1
[28,]  1
[29,]  1
[30,]  1

mdatools documentation built on Sept. 13, 2021, 9:07 a.m.