confusion.matrix {StabPerf} | R Documentation |
Calculates a contigency matrix (also known as a confusion matrix)
Description
Calculates a contigency matrix (also known as a confusion matrix), given a vector of real
values and a vector of corresponding prediction
values.
Usage
confusion.matrix(real, prediction)
Arguments
real |
integer. |
prediction |
integer. |
Details
This function is intended to be similar to table
, but always returns a square matrix, which is the difference between a confusion matrix and a simple contingency table as returned by table
Value
table |
table. Confusion matrix. |
See Also
table
, accuracy
, RCI
Examples
confusion.matrix(c(1,2,3,2),c(1,3,4,2))
# returns:
# prediction
# real 1 2 3 4
# 1 1 0 0 0
# 2 0 1 1 0
# 3 0 0 0 1
# 4 0 0 0 0
[Package
StabPerf version 0.5
Index]