## S3 method for class 'default':
confusionMatrix(data, reference, positive = NULL, dnn = c("Prediction", "Reference"), ...)
table
. NOTE: do not include dnn
heretable
on data
and reference
positive
argumentFor two class problems, the sensitivity, specificity, positive
predictive value and negative predictive value is calculated using the
positive
argument. For more than two classes, these results are
calculated comparing each factor level to the remaining levels
(i.e. a "one versus all" approach). In each case, the overall accuracy and Kappa statistic are calculated.
The overall accuracy rate is computed along with a 95 percent confidence interval for this rate (using binom.test
) and a one-sided test to see if the accuracy is better than the "no information rate," which is taken to be the largest class percentage in the data.
sensitivity
, specificity
, posPredValue
, negPredValue
, print.confusionMatrix
, binom.test
numLlvs <- 4 confusionMatrix( factor(sample(rep(letters[1:numLlvs], 200), 50)), factor(sample(rep(letters[1:numLlvs], 200), 50))) numLlvs <- 2 confusionMatrix( factor(sample(rep(letters[1:numLlvs], 200), 50)), factor(sample(rep(letters[1:numLlvs], 200), 50)))
Run the code above in your browser using DataCamp Workspace