validate_cox_input: Validate Inputs for Catalytic Cox Model

validate_cox_inputR Documentation

Validate Inputs for Catalytic Cox Model

Description

This function validates the parameters provided for setting up a catalytic Cox proportional hazards model with an initialization object created by cat_cox_initialization.

Usage

validate_cox_input(
  formula,
  cat_init,
  tau = NULL,
  tau_seq = NULL,
  init_coefficients = NULL,
  tol = NULL,
  max_iter = NULL,
  cross_validation_fold_num = NULL,
  hazard_beta = NULL,
  tau_alpha = NULL,
  tau_gamma = NULL
)

Arguments

formula

An object of class formula. Specifies the model structure for the Cox model, including a Surv object for survival analysis. Should at least include response variance.

cat_init

An initialization object generated by cat_cox_initialization. This object should contain necessary information about the dataset, including the time and status column names.

tau

Optional. A numeric scalar, the regularization parameter for the Cox model. Must be positive.

tau_seq

Optional. A numeric vector for specifying a sequence of regularization parameters. Must be positive.

init_coefficients

Optional. A numeric vector of initial coefficients for the Cox model. Should match the number of predictors in the dataset.

tol

Optional. A positive numeric value indicating the tolerance level for convergence in iterative fitting.

max_iter

Optional. A positive integer indicating the maximum number of iterations allowed in the model fitting.

cross_validation_fold_num

Optional. A positive integer specifying the number of folds for cross-validation. Should be greater than 1 and less than or equal to the size of the dataset.

hazard_beta

Optional. A positive numeric value representing a constant for adjusting the hazard rate in the Cox model.

tau_alpha

Optional. A positive numeric value controlling the influence of tau.

tau_gamma

Optional. A positive numeric value controlling the influence of tau_seq.

Details

This function checks:

  • That tau, tol, max_iter, cross_validation_fold_num, hazard_beta, tau_alpha, and tau_gamma are positive.

  • That tau_seq is a non-negative vector.

  • That cat_init is generated from cat_cox_initialization.

  • That formula uses the same time and status column names as those in cat_init.

  • That init_coefficients has the correct length for the number of predictors.

  • That cross_validation_fold_num is between 2 and the dataset size.

  • That the dataset is sufficiently large for cross-validation, recommending fewer folds if it is not. If any conditions are not met, the function will raise an error or warning.

Value

Returns nothing if all checks pass; otherwise, raises an error or warning.


catalytic documentation built on April 4, 2025, 5:51 a.m.