cat_cox_initialization {catalytic}R Documentation

Initialization for Catalytic Cox proportional hazards model (COX)

Description

This function prepares and initializes a catalytic Cox proportional hazards model by processing input data, extracting necessary variables, generating synthetic datasets, and fitting a model.

Usage

cat_cox_initialization(
  formula,
  data,
  syn_size = NULL,
  hazard_constant = NULL,
  entry_points = NULL,
  x_degree = NULL,
  resample_only = FALSE,
  na_replace = stats::na.omit
)

Arguments

formula

A formula specifying the Cox model. Should include response and predictor variables.

data

A data frame containing the data for modeling.

syn_size

An integer specifying the size of the synthetic dataset to be generated. Default is four times the number of predictor columns.

hazard_constant

A constant hazard rate for generating synthetic time data if not using a fitted Cox model. Default is NULL and will calculate in function.

entry_points

A numeric vector for entry points of each observation. Default is NULL.

x_degree

A numeric vector indicating the degree for polynomial expansion of predictors. Default is 1 for each predictor.

resample_only

A logical indicating whether to perform resampling only. Default is FALSE.

na_replace

A function to handle NA values in the data. Default is stats::na.omit.

Value

A list containing the values of all the input arguments and the following components:

Examples

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 = NULL, # 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_init

[Package catalytic version 0.1.0 Index]