| best_cutoff | R Documentation |
Determines the optimal cutoff point for a continuous variable in survival analysis using the maximally selected rank statistics method. Creates a binary variable based on the identified cutoff and adds it to the input data frame.
best_cutoff(
pdata,
variable,
time = "time",
status = "status",
print_result = TRUE
)
pdata |
Data frame containing survival information and the continuous variable. |
variable |
Character string specifying the name of the continuous variable for which the optimal cutoff should be determined. |
time |
Character string specifying the column name containing time-to-event data. Default is '"time"'. |
status |
Character string specifying the column name containing event status (censoring information). Default is '"status"'. |
print_result |
Logical indicating whether to print detailed results including cutoff value and Cox model summaries. Default is 'TRUE'. |
Data frame identical to 'pdata' with an additional binary column named '<variable>_binary' containing "High" and "Low" categories based on the optimal cutoff.
Dongqiang Zeng
set.seed(123)
pdata <- data.frame(
time = rexp(100),
status = rbinom(100, 1, 0.5),
score = rnorm(100, mean = 50, sd = 10)
)
result <- best_cutoff(pdata, variable = "score", print_result = FALSE)
table(result$score_binary)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.