dx_odds_ratio | R Documentation |
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.
dx_odds_ratio(cm, detail = "full", ...)
cm |
A dx_cm object created by |
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
|
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.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.