Uses numerical root-finding to determine the interaction parameter (k_inter) that achieves a specified target hazard ratio in the harm subgroup. This is the most efficient method for single target calibration.
find_k_inter_for_target_hr(
target_hr_harm,
data,
continuous_vars,
factor_vars,
outcome_var,
event_var,
treatment_var,
subgroup_vars,
subgroup_cuts,
k_treat = 1,
k_inter_range = c(-10, 10),
tol = 0.001,
n_super = 5000,
verbose = TRUE
)A list of class "k_inter_result" containing:
Numeric value of optimal k_inter parameter
Numeric value of achieved hazard ratio in harm subgroup
Numeric value of target hazard ratio (for reference)
Numeric value of absolute error between achieved and target HR
Object of class "aft_dgm_flex" containing the final DGM
Integer number of iterations to convergence
Character string "root-finding" indicating method used
Numeric value specifying the target hazard ratio for the harm subgroup. Must be positive.
A data.frame containing the dataset to use for model fitting.
Character vector of continuous variable names to be standardized and included as covariates.
Character vector of factor/categorical variable names to be converted to dummy variables.
Character string specifying the name of the outcome/time variable.
Character string specifying the name of the event/status variable (1 = event, 0 = censored).
Character string specifying the name of the treatment variable.
Character vector of variable names defining the subgroup.
Named list of cutpoint specifications for subgroup variables.
See generate_aft_dgm_flex for details on flexible specifications.
Numeric value for treatment effect modifier. Default is 1 (no modification).
Numeric vector of length 2 specifying the search range for k_inter. Default is c(-10, 10).
Numeric value specifying tolerance for root finding convergence. Default is 0.001.
Integer specifying size of super population for hazard ratio calculation. Default is 5000.
Logical indicating whether to print progress information. Default is TRUE.
This function uses the uniroot algorithm to solve the equation:
$$HR_{harm}(k_{inter}) - HR_{target} = 0$$
The algorithm typically converges within 5-10 iterations and achieves high precision (within the specified tolerance). If the root-finding fails, the function evaluates the boundaries and provides diagnostic information.
sensitivity_analysis_k_inter for sensitivity analysis
generate_aft_dgm_flex for DGM generation