Results from four completed sample-size searches, one for each of the package's entry points. A search repeatedly simulates datasets, fits a prediction model to each and evaluates its performance across a range of candidate sample sizes, so a realistic run takes minutes to hours. These objects were computed once, with the calls shown under Source, so that the examples and the vignette can demonstrate the output without recomputing it.
Format
A list of class "pmsims". The most useful components are:
min_nThe estimated minimum sample size.
perf_nExpected performance at
min_n.target_performanceThe performance target the search aimed for.
metricThe performance metric used.
modelThe model fitted to each simulated dataset.
mlpwr_dsThe sampled designs and simulated performance values behind the fitted curve, used by
plot().summariesAggregated performance summaries across replications.
simulation_timeElapsed time of the original run, in seconds.
Objects produced by the wrapper functions additionally record the
data-generating configuration (for example outcome_prevalence,
correlation and complexity); see simulate_binary() for the full set.
An object of class pmsims of length 36.
An object of class pmsims of length 35.
An object of class pmsims of length 37.
An object of class pmsims of length 24.
Source
Generated by data-raw/precomputed-examples.R.
binary_example:
set.seed(123)
simulate_binary(
signal_parameters = 20,
noise_parameters = 0,
complexity = 1,
data_control = list(correlation = 0.3),
outcome_prevalence = 0.30,
maximum_achievable_cstatistic = 0.80,
model = "glm",
metric = "calibration_slope",
target_performance = 0.85,
n_reps_total = 1000,
mean_or_assurance = "assurance"
)continuous_example:
set.seed(123)
simulate_continuous(
signal_parameters = 15,
noise_parameters = 0,
complexity = 1,
data_control = list(correlation = 0.3),
maximum_achievable_rsquared = 0.50,
model = "lm",
metric = "calibration_slope",
target_performance = 0.95,
n_reps_total = 1000,
mean_or_assurance = "assurance"
)survival_example:
set.seed(123)
simulate_survival(
signal_parameters = 15,
noise_parameters = 0,
complexity = 1,
data_control = list(correlation = 0.3),
maximum_achievable_cindex = 0.70,
baseline_hazard = 0.01,
censoring_rate = 0.30,
model = "coxph",
metric = "calibration_slope",
target_performance = 0.90,
n_reps_total = 1000,
mean_or_assurance = "assurance"
)custom_example: a linear model with three independent predictors and a
population \(R^2\) of 0.5, targeting a calibration slope of 0.9 with
80% assurance. The search uses bounds of 25 to 1,000 participants, 1,000
replications and 30,000 test observations. See simulate_custom() for the
generating functions and executable call (seed 123).
Details
Each object is a "pmsims" object, as returned by simulate_binary(),
simulate_continuous(), simulate_survival() and simulate_custom(), and
can be used with print() and plot() in the usual way.
Examples
binary_example
#> ┌────────────────────────────────────────┐
#> │ pmsims: Sample size simulation summary │
#> └────────────────────────────────────────┘
#>
#> ──────────────────────────────────── Inputs ────────────────────────────────────
#>
#> Data-generating scenario
#> Outcome Binary
#> Prevalence 0.30
#> Predictors 20 signal
#> Predictor distribution Normal
#> Predictor correlation 0.30
#> Signal form Linear
#>
#> Model and performance
#> Model Logistic regression
#> Large-sample C-statistic 0.800
#> Sample-size criterion Calibration slope ≥ 0.850
#>
#> Simulation
#> Mode Assurance
#> Replications 1,000
#>
#> ──────────────────────────────────── Results ───────────────────────────────────
#>
#> Minimum sample size 985
#>
#> Performance at N = 985
#> Calibration slope 0.849 (target ≥ 0.850)
#> C-statistic 0.794
#>
#> Running time 3 minutes 58 seconds
#>
#> ────────────────────────────────────────────────────────────────────────────────
#> Assurance mode selects N so that the target is achieved with high probability
#> across repeated datasets.
binary_example$min_n
#> [1] 985
