| best_cutoff2 | R Documentation |
Finds the best cutoff point for a continuous variable in survival analysis. Takes input data containing a continuous variable and survival information (time and status). Returns the modified input data with a new binary variable created based on the best cutoff point.
best_cutoff2(
pdata,
variable,
time = "time",
status = "status",
print_result = TRUE
)
pdata |
Data frame containing survival information and features. |
variable |
Character string specifying the continuous variable name. |
time |
Character string specifying the time-to-event column name. Default is '"time"'. |
status |
Character string specifying the event status column name. Default is '"status"'. |
print_result |
Logical indicating whether to print results. Default is 'TRUE'. |
List containing:
Data frame with binary variable added
Numeric cutoff value
Cox model summary for continuous variable
Summary of binary variable
Cox model summary for binary variable
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_cutoff2(pdata, variable = "score", print_result = FALSE)
result$best_cutoff
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.