dx_ppv_prevalence | R Documentation |
Computes the Positive Predictive Value (PPV) adjusted to a specified prevalence level. This function is useful for understanding classifier performance in settings where the actual prevalence of the condition may differ from that in the initial data.
dx_ppv_prevalence(cm, prevalence, detail = "full", ...)
cm |
A dx_cm object created by |
prevalence |
Numeric value between 0 and 1, representing the target prevalence for adjusting the PPV calculation. |
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
|
This function calculates the PPV using the formula:
PPV = \frac{Sensitivity \times Prevalence}{(Sensitivity \times Prevalence) + (1 - Specificity) \times (1 - Prevalence)}
where Sensitivity
is the true positive rate and Specificity
is the true negative rate.
Adjusting PPV for prevalence allows a more accurate assessment of the classifier’s performance
in different population settings.
Confidence intervales are calucated using a simple logit (Mercaldo et al, 2007)
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.
dx_cm()
, dx_ppv()
for the non-prevalence adjusted PPV.
cm <- dx_cm(dx_heart_failure$predicted, dx_heart_failure$truth,
threshold = 0.5, poslabel = 1
)
# Calculate PPV at a prevalence of 0.1
dx_ppv_prevalence(cm, prevalence = 0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.