% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PrognosticModel.R
\name{PrognosticModel}
\alias{PrognosticModel}
\title{Build Prognostic Models Using LASSO and Ridge Regression}
\usage{
PrognosticModel(
  x,
  y,
  scale = FALSE,
  seed = 123456,
  train_ratio = 0.7,
  nfold = 10,
  plot = TRUE,
  palette = "jama",
  cols = NULL
)
}
\arguments{
\item{x}{A matrix or data frame of predictor variables (features).}

\item{y}{A data frame of survival outcomes with two columns: survival time and event status.}

\item{scale}{Logical indicating whether to scale predictor variables. Default is `FALSE`.}

\item{seed}{Integer seed for random number generation to ensure reproducibility.
Default is `123456`.}

\item{train_ratio}{Numeric proportion of data for training (e.g., 0.7). Default is `0.7`.}

\item{nfold}{Integer number of folds for cross-validation. Default is `10`.}

\item{plot}{Logical indicating whether to plot ROC curves. Default is `TRUE`.}

\item{palette}{String specifying color palette. Default is `"jama"`.}

\item{cols}{Optional vector of colors for ROC curves. If `NULL`, uses default palette.}
}
\value{
A list containing:
\describe{
  \item{lasso_result}{Results from LASSO model including coefficients and AUC}
  \item{ridge_result}{Results from Ridge model including coefficients and AUC}
  \item{train.x}{Training data with sample IDs}
}
}
\description{
Prepares data, splits it into training and testing sets, and fits LASSO and Ridge
regression models for survival analysis. Evaluates model performance using
cross-validation and optionally generates time-dependent ROC curves for visual
assessment of predictive accuracy.
}
\examples{
\donttest{
if (requireNamespace("glmnet", quietly = TRUE) &&
  requireNamespace("survival", quietly = TRUE)) {
  library(survival)
  imvigor210_sig <- load_data("imvigor210_sig")
  imvigor210_pdata <- load_data("imvigor210_pdata")
  pdata_prog <- data.frame(
    ID = imvigor210_pdata$ID,
    OS_days = as.numeric(imvigor210_pdata$OS_days),
    OS_status = as.numeric(imvigor210_pdata$OS_status)
  )
  prognostic_result <- PrognosticModel(
    x = imvigor210_sig, y = pdata_prog,
    scale = TRUE, seed = 123456,
    train_ratio = 0.7, nfold = 10, plot = FALSE
  )
}
}
}
\author{
Dongqiang Zeng
}
