binaryCM | R Documentation |
Calculates summaries from cross-tabulated reference and prediction labels for a two-class variable.
binaryCM(
x,
y,
seed = 20,
num.boot = 1000,
pcond = 1,
conf.level = 0.95,
digits = 4,
method = "wilson",
verbose = FALSE
)
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. |
pcond |
a string or value to be considered positive condition; defaults to 1. |
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 |
verbose |
logical; if |
Given two dichotomous variables summarized in a confusion matrix, this function provides performance summaries. The accuracy, sensitivity, specificity, positive predictive value (PPV), negative predictive value (NPV), and the kappa statistic, along with their bootstrapped confidence intervals are returned.
Note that the classes given in x
and y
must be binary.
A confusion matrix for the predicted and reference classes. Then the estimated statistics along with bootstrapped confidence intervals. A list with the following elements
CM |
The confusion matrix, whose columns are the predicted conditions and its rows are the true conditions |
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 |
table |
a data frame that contains all 6 of the estimated statistics along with confidence intervals |
Aline Talhouk, Derek Chiu
Other confusion matrix functions:
binaryCMAsHTML()
,
multiClassCM()
### 95% CI from 1000 bootstraped samples
set.seed(547)
n <- 80
x <- rbinom(n, size = 1, prob = 0.6)
y <- rbinom(n, size = 1, prob = 0.4)
binaryCM(x, y)
### 90% CI from 500 bootstrapped samples
binaryCM(x, y, num.boot = 500, conf.level = 0.90)
### Round to 2 digits
binaryCM(x, y, digits = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.