table_compare: Construct a 2x2 contingency table and calculate associated...

Description Usage Arguments Value Note Author(s) Examples

View source: R/table_compare.R

Description

Construct a contingency table to compare predicted outcomes to actual/observed outcomes. Also calculates statistics associated with the table.

Usage

1
table_compare(pred, actual)

Arguments

pred

Predicted outcomes (0/1), as obtained from a model or decision rule.

actual

Actual observed outcomes (0/1).

Value

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

Note that the calculations assume that a "positive" result is coded as a 1, and a "negative" result as a 0.

Author(s)

Theo Pepler

Examples

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)

tpepler/theolib documentation built on Aug. 10, 2021, 9:53 a.m.