Learn R Programming

RGS (version 1.0)

rgs_for_logistic: Main function for logistic regression analysis

Description

This function performs logistic 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.

Usage

rgs_for_logistic(my_data, u_variables, covariates)

Value

A dataframe containing the best combination of cutoffs and associated AIC value.

Arguments

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.

Examples

Run this code
# \donttest{
library(rms)

data_path <- system.file("extdata", "logistic_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_logistic(my_data, u_variables, covariates)
# }

Run the code above in your browser using DataLab