rgs_for_cox | R Documentation |
Main function for cox regression analysis Performs regression analysis to identify optimal cutoffs and evaluate the model. Users are required to create and set the datadist option globally before using this function.
rgs_for_cox(my_data, u_variables, covariates)
my_data |
A dataframe containing the data. |
u_variables |
A character vector specifying the names of the U-shaped variables. |
covariates |
A character vector specifying the names of the covariates. |
A dataframe containing the best combination of cutoffs and associated AIC value.
library(rms)
data_path <- system.file("extdata", "cox_data.csv", package = "RGS")
my_data <- read.csv(data_path)
# Define variables
u_variables <- c("u1", "u2")
covariates <- c("l1", "c1")
# create and set the datadist option globally
dd <- datadist(my_data)
options(datadist = "dd")
rgs_for_cox(my_data, u_variables, covariates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.