ConfMat: Confussion Matrices for classification results

View source: R/ConfMatrix.R

ConfMatR Documentation

Confussion Matrices for classification results

Description

‘ConfMat’ creates confussion matrices from two factor describing, respectively, original classes and predicted classification results

Usage

ConfMat(origcl, predcl, otp=c("absandrel","abs","rel"), dec=3)

Arguments

origcl

A factor describing the original classes.

predcl

A factor describing the predicted classes.

otp

A string describing the output to be displayed and returned. Alternatives are “absandrel” for two confusion matrices, respectively with absolute and relative frequencies, “abs” for a confusion matrix with absolute frequencies, and “rel” for a confusion matrix relative frequencies.

dec

The number of decimal digits to display in matrices of relative frequencies.

Value

When argument ‘otp’ is set to “absandrel” (default), a list with two confusion matrices, respectively with absolute and relative frequencies. When argument ‘otp’ is set to “abs” a confusion matrix with absolute frequencies, and when argument ‘otp’ is set to “rel” a confusion matrix with relative frequencies.

Author(s)

A. Pedro Duarte Silva

See Also

lda, qda, snda, Roblda, Robqda, DACrossVal

Examples


# Create an Interval-Data object containing the intervals for 899 observations 
# on the temperatures by quarter in 60 Chinese meteorological stations.

ChinaT <- IData(ChinaTemp[1:8],VarNames=c("T1","T2","T3","T4"))

#Linear Discriminant Analysis

ChinaT.lda <- lda(ChinaT,ChinaTemp$GeoReg)
ldapred <- predict(ChinaT.lda,ChinaT)$class

# lda resubstitution confusion matrix

ConfMat(ChinaTemp$GeoReg,ldapred)

#Quadratic Discriminant Analysis

ChinaT.qda <- qda(ChinaT,ChinaTemp$GeoReg)
qdapred <- predict(ChinaT.qda,ChinaT)$class

# qda resubstitution confusion matrix

ConfMat(ChinaTemp$GeoReg,qdapred)



MAINT.Data documentation built on April 4, 2023, 9:09 a.m.