dx_fishers_exact: Fisher's Exact Test for Independence in a 2x2 Table

View source: R/dx_tests.R

dx_fishers_exactR Documentation

Fisher's Exact Test for Independence in a 2x2 Table

Description

Conducts Fisher's Exact test of independence on a 2x2 confusion matrix derived from binary classification results, assessing the significance of the association between the observed and expected frequencies.

Usage

dx_fishers_exact(cm, detail = "full")

Arguments

cm

A dx_cm object created by dx_cm().

detail

Character specifying the level of detail in the output: "simple" for raw estimate, "full" for detailed estimate including 95% confidence intervals.

Details

Fisher's Exact Test is used to examine the significance of the association between the variables in a 2x2 contingency table, particularly useful when sample sizes are small. Unlike the chi-square test, it does not rely on large sample distribution approximations and is hence exact. It's especially preferred when the data has small expected frequencies in one or more cells of the table. A low p-value indicates a significant association between the predicted and actual binary classifications.

Value

Depending on the detail parameter: - if "simple": a single numeric value representing the p-value of Fisher's Exact test. - if "full": a data frame with the Fisher's Exact test result, including the p-value and method note.

See Also

dx_cm() for creating a 'dx_cm' object.

Examples

cm <- dx_cm(dx_heart_failure$predicted, dx_heart_failure$truth,
  threshold = 0.3, poslabel = 1
)
simple <- dx_fishers_exact(cm, detail = "simple")
detailed <- dx_fishers_exact(cm)
print(simple)
print(detailed)

overdodactyl/diagnosticSummary documentation built on Jan. 28, 2024, 10:07 a.m.