% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PrognosticModel.R
\name{CalculateTimeROC}
\alias{CalculateTimeROC}
\title{Calculate Time-Dependent ROC Curve}
\usage{
CalculateTimeROC(model, newx, s, acture.y, modelname, time_prob = 0.9)
}
\arguments{
\item{model}{A fitted survival model object.}

\item{newx}{A matrix or data frame of new data for prediction.}

\item{s}{Lambda value for prediction.}

\item{acture.y}{Data frame with `time` and `status` columns.}

\item{modelname}{Character string for model identification.}

\item{time_prob}{Numeric quantile for ROC calculation. Default is `0.9`.}
}
\value{
An object of class `timeROC` containing ROC curve information.
}
\description{
Computes time-dependent ROC curve for survival models using the `timeROC` package.
Evaluates predictive accuracy at a specified time quantile.
}
\examples{
if (requireNamespace("glmnet", quietly = TRUE) &&
  requireNamespace("survival", quietly = TRUE) &&
  requireNamespace("timeROC", quietly = TRUE)) {
  library(survival)
  dat <- na.omit(lung[, c("time", "status", "age", "sex", "ph.ecog")])
  dat$status <- dat$status - 1
  x <- as.matrix(dat[, c("age", "sex", "ph.ecog")])
  y <- Surv(dat$time, dat$status)
  fit <- glmnet::glmnet(x, y, family = "cox")
  actual_outcome <- data.frame(time = dat$time, status = dat$status)
  roc_info <- CalculateTimeROC(
    model = fit, newx = x, s = 0.01, acture.y = actual_outcome,
    modelname = "glmnet Cox Model", time_prob = 0.5
  )
  print(roc_info$AUC)
}
}
\author{
Dongqiang Zeng
}
