Conf(x, ...)
## S3 method for class 'table':
Conf(x, pos = NULL, ...)
## S3 method for class 'matrix':
Conf(x, pos = NULL, ...)
## S3 method for class 'default':
Conf(x, ref, pos = NULL, na.rm = TRUE, ...)
## S3 method for class 'rpart':
Conf(x, ...)
## S3 method for class 'multinom':
Conf(x, ...)
## S3 method for class 'glm':
Conf(x, cutoff = 0.5, ...)
## S3 method for class 'randomForest':
Conf(x, ...)
## S3 method for class 'svm':
Conf(x, ...)
## S3 method for class 'regr':
Conf(x, ...)
## S3 method for class 'Conf':
plot(x, main="Confusion Matrix", ...)
## S3 method for class 'Conf':
print(x, digits = max(3, getOption("digits") - 3), ...)
Sens(x, ...)
Spec(x, ...)
table
.table
on data
and reference
positive
argumentpositive
argument. Also, the prevalence of the "event" is computed from the
data (unless passed in as an argument), the detection rate (the rate of true events also
predicted to be events) and the detection prevalence (the prevalence of predicted events).
Suppose a 2x2 table with notation
mcnemar.test
(which can produce NA
values with sparse tables).
The overall accuracy rate is computed along with a 95 percent confidence interval for this rate (using BinomCI
) 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.
The sensitivity is defined as the proportion of positive results out of the number of
samples which were actually positive. When there are no positive results, sensitivity is
not defined and a value of NA
is returned. Similarly, when there are no negative
results, specificity is not defined and a value of NA
is returned. Similar
statements are true for predictive values.OddsRatio
, RelRisk
# let tab be a confusion table
tab <- structure(c(233L, 29L, 56L, 74L), .Dim = c(2L, 2L),
.Dimnames = structure(list(pred = c("0", "1"), obs = c("0", "1")),
.Names = c("pred", "obs")))
Conf(tab, pos="1")
pred <- Untable(tab)[,"pred"]
obs <- Untable(tab)[,"obs"]
Conf(x = pred, ref = obs)
Conf(x = pred, ref = obs, pos="1")
Sens(tab) # Sensitivity
Spec(tab) # Specificity
Run the code above in your browser using DataLab