--- title: "Getting started with pmsims" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Getting started with pmsims} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r} #| label: setup #| include: false knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 6, fig.height = 4, warning = FALSE, message = FALSE ) ``` ## What pmsims does **pmsims** estimates the **minimum sample size** needed to develop a prediction model to achieve a target level of performance **with assurance**. Rather than relying on simple rules of thumb or closed‑form formulae, pmsims uses **simulation** to: - Generate synthetic datasets that reflect your target setting (outcome type, prevalence or $R^2$, signal vs. noise predictors, and how complex the underlying signal is); - Fit a specified **model** (e.g., logistic regression or linear regression); - Evaluate a chosen **performance metric** (e.g., calibration slope, AUC); and - Trace a **learning curve** of performance as the training size increases.
| Argument | Description |
|---|---|
signal_parameters |
(int) Number of true signal predictors associated with the outcome. |
noise_parameters |
(int) Number of noise predictors unrelated to the outcome. |
complexity |
(int 1–4) Signal structure of the data-generating mechanism:
1 purely linear, 2 linear + quadratic,
3 linear + quadratic + interaction, 4 the Friedman function.
|
data_control |
(list) Optional list fine-tuning the predictors:
|
outcome_prevalence |
(num 0–1) Target prevalence of the binary outcome. |
maximum_achievable_cstatistic |
(num 0–1) Maximum achievable C-statistic with effectively unlimited data. This calibrates the data generator and is not the minimum acceptable threshold. |
maximum_achievable_rsquared |
(num 0–1) Maximum achievable R2 with effectively unlimited data. This calibrates the data generator and is not the minimum acceptable threshold. |
maximum_achievable_cindex |
(num 0–1) Maximum achievable concordance index with effectively unlimited data. This calibrates the data generator and is not the minimum acceptable threshold. |
baseline_hazard |
(num > 0) Baseline hazard used by the survival data-generating mechanism. Larger values imply shorter event times, all else equal. |
censoring_rate |
(num 0–1) Proportion of individuals expected to be censored in the simulated survival datasets. |
model |
(chr) Model used for fitting: "glm" / "lm" /
"coxph" depending on the outcome, or one of the experimental
machine-learning options "lasso", "ridge",
"rf", "xgboost".
|
metric |
(chr) Performance metric used to estimate the minimum
required sample size. Metric identifiers take one canonical form throughout the
package: "calibration_slope", "calibration_in_the_large",
"auc", "r2", "cindex", and
"csse" (calibration slope squared error).
|
target_performance |
(num) Minimum acceptable performance in the units of the chosen metric (e.g. calibration slope ≥ 0.9), used as the threshold for selecting the required sample size. |
n_reps_total |
(int) Total number of simulation replications. |
mean_or_assurance |
(chr) Criterion for summarising results; "assurance" recommended.
|