Learn R Programming

RGS (version 1.0)

Recursive Gradient Scanning Algorithm

Description

Provides a recursive gradient scanning algorithm for discretizing continuous variables in Logistic and Cox regression models. This algorithm is especially effective in identifying optimal cut-points for variables with U-shaped relationships to 'lnOR' (the natural logarithm of the odds ratio) or 'lnHR' (the natural logarithm of the hazard ratio), thereby enhancing model fit, interpretability, and predictive power. By iteratively scanning and calculating gradient changes, the method accurately pinpoints critical cut-points within nonlinear relationships, transforming continuous variables into categorical ones. This approach improves risk classification and regression analysis performance, increasing interpretability and practical relevance in clinical and risk management settings.

Copy Link

Version

Install

install.packages('RGS')

Monthly Downloads

185

Version

1.0

License

MIT + file LICENSE

Maintainer

Shuo Yang

Last Published

December 19th, 2024

Functions in RGS (1.0)

evaluate_model_cox

Evaluate model with cutoffs Evaluates the model by creating exposure variables based on the cutoffs and fitting a Cox model.
find_cutoffs_logistic

Find symmetric cutoffs for logistic regression
rgs_for_logistic

Main function for logistic regression analysis
rgs_for_cox

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.
find_cutoffs_cox

Find symmetric cutoffs This function finds symmetric cutoff points for a specified variable using Cox regression.
find_best_combination_cox

Find best combination of cutoffs Searches for the best combination of cutoffs that minimizes the Akaike Information Criterion (AIC).
find_best_combination_logistic

Find best combination of cutoffs for logistic regression
test_ushape_cox

Test U-shape relationship This function checks for a U-shaped relationship between survival time and a set of variables. Users are required to create and set the datadist option globally before using this function.
test_ushape_logistic

Test U-shape relationship in logistic regression
evaluate_model_logistic

Evaluate logistic regression model with cutoffs