| basic_stats_calculator | R Documentation |
Calculates standard diagnostic statistics from a 2x2 contingency table (True Positives, False Positives, False Negatives, True Negatives). Metrics include Sensitivity, Specificity, Positive/Negative Predictive Values (PPV/NPV), Likelihood Ratios (LR+/LR-), Accuracy, and Disease Prevalence.
basic_stats_calculator(tp, fp, fn, tn)
tp |
Numeric. Count of True Positives (Disease Present, Test Positive). |
fp |
Numeric. Count of False Positives (Disease Absent, Test Positive). |
fn |
Numeric. Count of False Negatives (Disease Present, Test Negative). |
tn |
Numeric. Count of True Negatives (Disease Absent, Test Negative). |
A list containing:
Diagnostic_Accuracy |
Sensitivity, Specificity, and Overall Accuracy. |
Predictive_Values |
PPV and NPV. |
Likelihood_Ratios |
LR+ (Sensitivity / (1-Specificity)) and LR- ((1-Sensitivity) / Specificity). |
Population_Stats |
Prevalence of disease in the sample and total sample size. |
Altman DG, Bland JM. Diagnostic tests 1: Sensitivity and specificity. BMJ. 1994;308(6943):1552. Altman DG, Bland JM. Diagnostic tests 2: Predictive values. BMJ. 1994;309(6947):102.
# Example 1: Good Test
# TP=80, FP=10, FN=20, TN=90
basic_stats_calculator(80, 10, 20, 90)
# Example 2: Perfect Specificity
# TP=50, FP=0, FN=50, TN=100
# LR+ will be Inf
basic_stats_calculator(50, 0, 50, 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.