% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/best_cutoff2.R
\name{best_cutoff2}
\alias{best_cutoff2}
\title{Extract Best Cutoff and Add Binary Variable to Data Frame}
\usage{
best_cutoff2(
  pdata,
  variable,
  time = "time",
  status = "status",
  print_result = TRUE
)
}
\arguments{
\item{pdata}{Data frame containing survival information and features.}

\item{variable}{Character string specifying the continuous variable name.}

\item{time}{Character string specifying the time-to-event column name.
Default is `"time"`.}

\item{status}{Character string specifying the event status column name.
Default is `"status"`.}

\item{print_result}{Logical indicating whether to print results.
Default is `TRUE`.}
}
\value{
List containing:
\describe{
  \item{pdata}{Data frame with binary variable added}
  \item{best_cutoff}{Numeric cutoff value}
  \item{cox_continuous_object}{Cox model summary for continuous variable}
  \item{summary_binary_variable}{Summary of binary variable}
  \item{cox_binary_object}{Cox model summary for binary variable}
}
}
\description{
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.
}
\examples{
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
}
\author{
Dongqiang Zeng
}
