cat_cox | R Documentation |
Fits a Catalytic Cox proportional hazards model for survival data with specified variance parameters
and iterative coefficient estimation, with either CRE
(Catalytic-regularized Estimator) or WME
(Weighted Mixture Estimator) methods.
cat_cox(
formula,
cat_init,
tau = NULL,
method = c("CRE", "WME"),
init_coefficients = NULL,
tol = 1e-05,
max_iter = 25
)
formula |
A formula specifying the Cox model. Should at least include response variables (e.g. |
cat_init |
A list generated from |
tau |
Optional numeric scalar controlling the weight of the synthetic data in the coefficient estimation, defaults to the number of predictors. |
method |
The estimation method, either |
init_coefficients |
Initial coefficient values before iteration. Defaults to zero if not provided (if using |
tol |
Convergence tolerance for iterative methods. Default is |
max_iter |
Maximum number of iterations allowed for convergence. Default is |
A list containing the values of all the arguments and the following components:
coefficients |
Estimated coefficient vector. |
model |
Fitted Cox model object (if using |
iteration_log |
Matrix logging variance and coefficient values for each iteration(if using |
iter |
Number of iterations (if using |
library(survival)
data("cancer")
cancer$status[cancer$status == 1] <- 0
cancer$status[cancer$status == 2] <- 1
cat_init <- cat_cox_initialization(
formula = Surv(time, status) ~ 1, # formula for simple model
data = cancer,
syn_size = 100, # Synthetic data size
hazard_constant = 0.1, # Hazard rate value
entry_points = rep(0, nrow(cancer)), # Entry points of each observation
x_degree = rep(1, ncol(cancer) - 2), # Degrees for polynomial expansion of predictors
resample_only = FALSE, # Whether to perform resampling only
na_replace = stats::na.omit # How to handle NA values in data
)
cat_model_cre <- cat_cox(
formula = ~.,
cat_init = cat_init, # Only accept object generated from `cat_cox_initialization`
tau = 1, # Weight for synthetic data
method = "CRE", # Choose from `"CRE"` or `"WME"`
init_coefficients = rep(0, ncol(cat_init$x)), # Initial coefficient values (Only for `CRE`)
tol = 1e-1, # Tolerance for convergence criterion (Only for `CRE`)
max_iter = 3 # Maximum number of iterations for convergence (Only for `CRE`)
)
cat_model_cre
cat_model_wme <- cat_cox(
formula = ~.,
cat_init = cat_init, # Only accept object generated from `cat_cox_initialization`
tau = 1, # Weight for synthetic data
method = "WME"
)
cat_model_wme
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.