pmsims is an R package for estimating how much data are needed to develop reliable and generalisable prediction models. It uses a simulation-based learning curve approach to quantify how model performance improves with increasing sample size, supporting principled study planning and feasibility assessment.
The package is fully model-agnostic: users can define how data are generated, how models are fitted, and how predictive performance is measured. It currently supports regression-based prediction models with continuous, binary, and time-to-event outcomes.
pmsims also includes experimental machine-learning model options via
regularised regression, random forest, and XGBoost. These options have
not yet undergone the package’s main validation study and should be
treated as experimental in 0.5.0.
Developed at King’s College London (Department of Biostatistics & Health Informatics) with input from researchers, clinicians, and patient partners. See the pmsims project site for further details.
Install version 0.5.0 from GitHub:
# install.packages("remotes")
remotes::install_github("pmsims-package/pmsims", ref = "v0.5.0")library(pmsims)
set.seed(123)
binary_example <- simulate_binary(
signal_parameters = 15,
noise_parameters = 0,
predictor_type = "continuous",
binary_predictor_prevalence = NULL,
outcome_prevalence = 0.20,
maximum_achievable_cstatistic = 0.80,
model = "glm",
metric = "calibration_slope",
target_performance = 0.90,
n_reps_total = 1000,
mean_or_assurance = "assurance"
)
binary_examplemaximum_achievable_cstatistic and target_performance have different
roles:
maximum_achievable_cstatisticrepresents the best plausible C-statistic with effectively unlimited data and calibrates the data generator.target_performanceis the minimum acceptable metric value used to determine the required sample size.
If you use pmsims, please cite the package and either or both
accompanying preprints.
Current preprints:
-
Shamsutdinova D, Zimmer F, Olaniran OR, Markham S, Stahl D, Forbes G, Carr E (2026). Sample Size Calculations for Developing Clinical Prediction Models: Overview and pmsims R package. arXiv. https://arxiv.org/abs/2602.23507
-
Olaniran OR, Shamsutdinova D, Markham S, Zimmer F, Stahl D, Forbes G, Carr E (2026). Adaptive Gaussian Process Search for Simulation-Based Sample Size Estimation in Clinical Prediction Models: Validation of the pmsims R Package. arXiv. https://arxiv.org/abs/2603.23688
Once peer-reviewed articles are available, these citations should be updated to the published versions. In R, you can retrieve the package citation with:
citation("pmsims")We welcome questions, suggestions, and collaboration enquiries.
- Email: pmsims@kcl.ac.uk
- Feedback or bugs: please open a GitHub issue
This work is supported by the National Institute for Health and Care Research (NIHR) under the Research for Patient Benefit (RfPB) Programme (NIHR206858).
The views expressed are those of the authors and not necessarily those of the NIHR or the Department of Health and Social Care.

