dx_odds_ratio: Calculate Odds Ratio

View source: R/dx_metrics.R

dx_odds_ratioR Documentation

Calculate Odds Ratio

Description

Calculates the Odds Ratio (OR) from a confusion matrix object. OR is a measure of association between exposure and an outcome. It represents the odds that an outcome will occur given a particular exposure, compared to the odds of the outcome occurring in the absence of that exposure.

Usage

dx_odds_ratio(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.

...

Additional arguments to pass to metric_binomial function, such as citype for type of confidence interval method.

Details

The odds ratio is calculated as (TP * TN) / (FP * FN). It is used in case-control studies to estimate the strength of the association between exposure and outcome. Note that a value of 1 indicates no association, greater than 1 indicates increased odds of the outcome with exposure, and less than 1 indicates decreased odds.

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.

Examples

cm <- dx_cm(dx_heart_failure$predicted, dx_heart_failure$truth,
  threshold =
    0.5, poslabel = 1
)
simple_or <- dx_odds_ratio(cm, detail = "simple")
detailed_or <- dx_odds_ratio(cm)
print(simple_or)
print(detailed_or)

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