Skip to content

R code and predictions for the case study from Van Calster et al (Validation Studies of Predictive AI for Use in Medical Practice: Overview and Guidance for Performance Measures)

Notifications You must be signed in to change notification settings

benvancalster/PerfMeasuresOverview

Repository files navigation

Performance Measures Overview

Code and data for the validation of Predictive AI in Medical Practice.

This repository contains the source code (R and Python) and dataset used in the case study for the paper "Validation studies of predictive AI for use in medical practice: overview and guidance for performance measures", published in The Lancet Digital Health.

🔗 Read the Full Paper

📄 About the Project

This work was developed under the guidance of the STRATOS (STRengthening Analytical Thinking for Observational Studies) consortium.

The paper reviews 32 performance measures for clinical risk prediction models (broadly referred to as Predictive AI) intended for use in medical practice. It provides critical guidance and recommendations on selecting the most appropriate measures for validation studies.

The Case Study

The measures discussed in the paper are illustrated using a real-world case study:

  • Context: External validation of a model to estimate the risk of malignancy in patients with an ovarian tumor selected for surgery.
  • Source: Landolfo et al., Br J Cancer 2024.

⚠️ Disclaimer regarding Code Implementation

Please note that the code for this study was originally produced in R (PerfMeasuresOverview.R). The Python implementations (PerfMeasuresPython.py and PerfMeasures.ipynb) are replications of the original R code provided for accessibility and convenience.

📂 Repository Contents

This repository provides the code to calculate the performance measures and generate the plots shown in the paper. It also includes the anonymized prediction data.

File Description
PerfMeasuresOverview.R R script containing code to calculate measures and create plots.
PerfMeasuresPython.py Python script equivalent for calculating measures.
PerfMeasures.ipynb Jupyter Notebook version of the Python analysis.
data_case_study.txt Dataset containing risk estimates and outcomes.

📊 Data Description

The file data_case_study.txt contains the specific data used for the case study. To ensure patient privacy and anonymity, no clinical variables or personal identifiers are included.

The dataset consists of:

  • Risk Estimates: The predicted probability of the outcome.
  • Outcomes: Binary classification (1 = malignant, 0 = benign).

🚀 Usage

You can reproduce the analysis using either R or Python.

R Users

Run the PerfMeasuresOverview.R script in RStudio or your preferred R environment. Ensure the data_case_study.txt file is in your working directory.

Python Users

You can run the analysis using the provided script or notebook:

  • Script: Run PerfMeasuresPython.py.
  • Notebook: Open PerfMeasures.ipynb in Jupyter Notebook or JupyterLab.

📚 References

If you use this code or methodology in your research, please cite the main paper:

Van Calster B, et al. Validation studies of predictive AI for use in medical practice: overview and guidance for performance measures. The Lancet Digital Health. 2025. https://doi.org/10.1016/S2589-7500(25)00098-6

About

R code and predictions for the case study from Van Calster et al (Validation Studies of Predictive AI for Use in Medical Practice: Overview and Guidance for Performance Measures)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors