% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PrognosticModel.R
\name{PlotTimeROC}
\alias{PlotTimeROC}
\title{Plot Time-Dependent ROC Curves}
\usage{
PlotTimeROC(
  train.x,
  train.y,
  test.x,
  test.y,
  model,
  modelname,
  cols = NULL,
  palette = "jama"
)
}
\arguments{
\item{train.x}{Matrix or data frame of training predictors.}

\item{train.y}{Training survival outcomes (time and status).}

\item{test.x}{Matrix or data frame of testing predictors.}

\item{test.y}{Testing survival outcomes (time and status).}

\item{model}{Fitted survival model object.}

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

\item{cols}{Optional vector of colors for plotting.}

\item{palette}{Character string specifying color palette. Default is `"jama"`.}
}
\value{
A `ggplot` object representing the ROC curve plot.
}
\description{
Generates time-dependent ROC curves for evaluating prognostic accuracy of survival models.
Plots training and testing ROC curves at the 90th percentile survival time.
}
\examples{
if (requireNamespace("glmnet", quietly = TRUE) &&
  requireNamespace("survival", quietly = TRUE) &&
  requireNamespace("timeROC", quietly = TRUE)) {
  library(survival)
  set.seed(123)
  train_x <- matrix(rnorm(100 * 5), ncol = 5)
  train_y <- data.frame(time = rexp(100), status = rbinom(100, 1, 0.5))
  test_x <- matrix(rnorm(50 * 5), ncol = 5)
  test_y <- data.frame(time = rexp(50), status = rbinom(50, 1, 0.5))
  fit <- glmnet::cv.glmnet(train_x, Surv(train_y$time, train_y$status), family = "cox")
  p <- PlotTimeROC(train_x, train_y, test_x, test_y, fit, "Cox Model")
  print(p)
}
}
\author{
Dongqiang Zeng
}
