ConfMat | R Documentation |
‘ConfMat’ creates confussion matrices from two factor describing, respectively, original classes and predicted classification results
ConfMat(origcl, predcl, otp=c("absandrel","abs","rel"), dec=3)
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. |
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.
A. Pedro Duarte Silva
lda
, qda
, snda
, Roblda
, Robqda
, DACrossVal
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.