dx_markedness: Calculate Markedness

View source: R/dx_metrics.R

dx_markednessR Documentation

Calculate Markedness

Description

Calculates Markedness for the provided confusion matrix. Markedness is a combined measure of PPV (Positive Predictive Value) and NPV (Negative Predictive Value). It reflects the effectiveness of a classifier in marking class labels correctly, ranging from -1 to 1.

Usage

dx_markedness(cm, detail = "full", boot = FALSE, bootreps = 1000)

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.

boot

Logical specifying if confidence intervals should be generated via bootstrapping. Note, this can be slow.

bootreps

The number of bootstrap replications for calculating confidence intervals.

Details

Markedness is defined as Markedness = PPV + NPV - 1. It is the sum of the proportions of predicted positives that are true positives (PPV) and the proportion of predicted negatives that are true negatives (NPV) minus one. It's a useful measure when you want to consider both the positive and negative predictive values of a test. A higher markedness indicates better performance.

The formula for Markedness is:

Markedness = PPV + NPV - 1

Value

Depending on the detail parameter, returns a numeric value representing the calculated metric or a data frame/tibble with detailed diagnostics including confidence intervals and possibly other metrics relevant to understanding the metric.

See Also

dx_cm() to understand how to create and interact with a 'dx_cm' object.

dx_ppv(), dx_npv() for components of markedness.

Examples

cm <- dx_cm(dx_heart_failure$predicted, dx_heart_failure$truth, threshold = 0.5, poslabel = 1)
simple_markedness <- dx_markedness(cm, detail = "simple")
detailed_markedness <- dx_markedness(cm)
print(simple_markedness)
print(detailed_markedness)

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