Description Usage Arguments Value Note Author(s) Examples
View source: R/table_compare.R
Construct a contingency table to compare predicted outcomes to actual/observed outcomes. Also calculates statistics associated with the table.
1 | table_compare(pred, actual)
|
pred |
Predicted outcomes (0/1), as obtained from a model or decision rule. |
actual |
Actual observed outcomes (0/1). |
Returns a list with the following:
cont.table |
The 2x2 contingency table |
sens |
Sensitivity |
spec |
Specificity |
misclass.rate |
Misclassification rate |
false.pos |
False positive rate |
false.neg |
False negative rate |
ppv |
Positive predictive value |
npv |
Negative predictive value |
Note that the calculations assume that a "positive" result is coded as a 1, and a "negative" result as a 0.
Theo Pepler
1 2 3 | predict.outcomes <- c(1, 1, 0, 1, 1, 1, 0, 0)
actual.outcomes <- c(1, 1, 1, 1, 0, 0, 0, 0)
table_compare(pred = predict.outcomes, actual = actual.outcomes)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.