multiClassCM | R Documentation |
Calculates summaries from cross-tabulated reference and prediction labels for a multi-class variable.
multiClassCM(
x,
y,
seed = 20,
num.boot = 1000,
conf.level = 0.95,
digits = 2,
method = "wilson"
)
x |
a vector of reference classes |
y |
a vector of predicted classes |
seed |
random seed for bootstrapping |
num.boot |
number of times to bootstrap. Defaults to 1000. |
conf.level |
confidence level. Defaults to 95%. |
digits |
number of digits to round summaries to |
method |
method for obtaining confidence intervals for binomial
probabilities. See |
Given two multi-class variables summarized in a confusion matrix, this function provides performance summaries. It provides overall accuracy with confidence intervals, as well as per class accuracy, sensitivity, specificity, positive predictive value (PPV), negative predictive value (NPV). if variable entered is binary, it will automatically call binaryCM
A confusion matrix for the predicted and reference classes. Then the estimated statistics along with bootstrapped confidence intervals. A list with the following elements
Accuracy |
Accuracy point estimate, lower bound and upper bound for bootstrapped CI |
Sensitivity |
Sensitivity point estimate, lower bound and upper bound for bootstrapped CI |
Specificity |
Specificity point estimate, lower bound and upper bound for bootstrapped CI |
PPV |
PPV point estimate, lower bound and upper bound for bootstrapped CI |
NPV |
NPV point estimate, lower bound and upper bound for bootstrapped CI |
kappa |
kappa point estimate, lower bound and upper bound for bootstrapped CI |
Aline Talhouk, Derek Chiu
Other confusion matrix functions:
binaryCM()
,
binaryCMAsHTML()
### 95% CI from 1000 bootstraped samples
set.seed(23)
k <- 3
(x <- factor(sample(1:k, 100, replace = TRUE, prob = c(0.15, 0.25, 0.6))))
(y <- factor(sample(1:k, 100, replace = TRUE, prob = c(0.05, 0.4, 0.65))))
prop.table(table(y))
multiClassCM(x, y)
### 90% CI from 500 bootstrapped samples
multiClassCM(x, y, num.boot = 500, conf.level = 0.90)
### Round to 2 digits
multiClassCM(x, y, digits = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.