Sample size estimation for RMST-based models via formula interface
Source:R/rmst-interface.R
rmst.ss.RdRoutes a formula-based call to the matching RMST sample-size routine.
Arguments
- formula
A formula of the form
Surv(time, status) ~ cov1 + cov2.- data
A
data.framecontaining the reference (pilot) data.- arm
Character string naming the treatment arm column (binary 0/1).
- target_power
Numeric target power (e.g.,
0.80).- L
Numeric truncation time for RMST.
- strata
Character column name, one-sided formula (
~col), orNULL.- strata_type
One of
"additive"(default) or"multiplicative".- dep_cens
Logical; use dependent-censoring model? Default
FALSE.- type
One of
"analytical"or"boot".- alpha
Significance level. Default
0.05.- n_sim
Number of bootstrap replicates. Default
1000.- parallel.cores
Number of cores for parallel processing. Default
1.- n_start
Starting sample size for the search. Default
50.- n_step
Search increment. Default
25.- max_n
Maximum sample size to try. Default
2000.- patience
Number of consecutive non-improving steps before stopping. Default
5.- verbose
Logical; if
TRUE, emit progress messages from the underlying calculation. DefaultFALSE.
Value
An object of class c("rmst_ss", "list") with elements
results_data, results_plot, results_summary,
model_output, and .meta.
Examples
data(aft_lognormal_L12_n150, package = "RMSTpowerBoost")
r <- rmst.ss(Surv(time, status) ~ age,
data = aft_lognormal_L12_n150,
arm = "arm",
target_power = 0.80,
L = 12)
print(r)
#> ── RMST Sample Size Estimation ────────────────
#> Model : Linear IPCW (Analytical)
#> Formula : Surv(time, status) ~ age
#> Arm : arm
#> Truncation time : 12
#> Alpha : 0.05
#>
#> Sample Size Result:
#> Target_Power Required_N_per_Arm
#> 0.8 350
#>
#> Treatment Effect (from reference data):
#> Estimand : RMST Difference
#> Estimate : -0.5447