run_fdb_study: One-stop wrapper: calibrate lambda, then evaluate type I and...

View source: R/study_wrapper.R

run_fdb_studyR Documentation

One-stop wrapper: calibrate lambda, then evaluate type I and power

Description

Optionally runs design-stage lambda calibration for all five borrowing methods, then evaluates type I error and power curves across the supplied drift set using the calibrated lambdas. If do_calibration = FALSE, default lambdas are used.

Usage

run_fdb_study(
  scenario_base = scenario_S1,
  drift_hr_range = c(0.8, 1.2),
  drift_by_hr = 0.05,
  drift_hr_values_cal = c(0.8, 0.9, 1, 1.1, 1.2),
  alpha = 0.025,
  alt_hr = 0.8,
  do_calibration = TRUE,
  lambda_grid = exp(seq(log(0.02), log(2), length.out = 6)),
  lambda_grid_fine_length = 6,
  nsim_cal = 500,
  nsim_confirm = nsim_cal,
  nsim_curve = 1000,
  alpha_cal = alpha,
  two_stage_cal = TRUE,
  confirm_full_drift = TRUE,
  primary_calibration_inference = c("sandwich", "model_based"),
  early_stop_cal = TRUE,
  cal_stop_rule = c("point", "upper95"),
  cal_select_rule = c("point", "upper95"),
  parallel = FALSE,
  ncores = NULL,
  robust = FALSE,
  eps = SMOOTH_EPS,
  n_grid_opt = DEFAULT_N_GRID_OPT,
  seed = 1,
  export_dir = NULL,
  rho_mcp = DEFAULT_RHO_MCP,
  keep_raw = FALSE
)

Arguments

scenario_base

A scenario list. Defaults to scenario_S1.

drift_hr_range

Numeric vector of length 2 giving the inclusive range of drift HR values for the final curves.

drift_by_hr

Step in HR units for the final drift grid.

drift_hr_values_cal

Numeric vector of drift HR values used for the (reduced) calibration drift grid. Defaults to a five-point grid.

alpha

Nominal one-sided level for the final analysis.

alt_hr

Alternative-hypothesis HR used in the power curve (e.g. 0.8).

do_calibration

Logical; if TRUE, run lambda calibration before the final curves.

lambda_grid

Initial coarse lambda grid for calibration.

lambda_grid_fine_length

Number of points in the fine refinement grid.

nsim_cal, nsim_confirm

Calibration replicates per drift value.

nsim_curve

Replicates per drift value for the final curves.

alpha_cal

Calibration threshold (defaults to alpha).

two_stage_cal

Use two-stage calibration.

confirm_full_drift

Run independent confirmation on the calibration drift grid. The wider evaluation grid does not change the calibration target.

primary_calibration_inference

Which inference type is used for tuning during calibration ("sandwich" or "model_based").

early_stop_cal, cal_stop_rule, cal_select_rule

Drift-level early stopping and selection rules.

parallel, ncores

Parallelization controls.

robust, eps, n_grid_opt

Estimation controls.

seed

RNG seed.

export_dir

If non-NULL, write CSV outputs and an RDS of metadata to this directory.

rho_mcp

MCP transition fraction in (0, 1), default 0.1.

keep_raw

Retain replicate estimates in raw_type1 and raw_power, and export an RDS file when export_dir is set.

Value

A list with scenario_base, drift_hr_range, drift_set, drift_set_cal, alpha, alpha_cal, alt_hr, lambdas (final tuning), calibration (calibration output, or NULL), type1_curve, power_curve, raw_type1, and raw_power. The last two are NULL unless keep_raw is true.


fdb documentation built on Oct. 4, 2026, 5:07 p.m.