roc_time: roc_time

View source: R/roc_time.R

roc_timeR Documentation

roc_time

Description

The "roc_time" function generates a Receiver Operating Characteristic (ROC) plot over time to assess the predictive performance of one or more variables in survival analysis. It calculates the Area Under the Curve (AUC) for each specified time point and variable combination, and creates a multi-line ROC plot with corresponding AUC values annotated.

Usage

roc_time(
  input,
  vars,
  time = "time",
  status = "status",
  time_point = 12,
  time_type = "month",
  palette = "jama",
  cols = "normal",
  seed = 1234,
  show_col = FALSE,
  path = NULL,
  main = "PFS",
  index = 1,
  fig.type = "pdf",
  width = 5,
  height = 5.2
)

Arguments

input

The input data frame containing the variables for analysis.

vars

A character vector specifying the variable(s) to be used in the analysis.

time

A character specifying the name of the time variable in the input data frame (default is "time").

status

A character specifying the name of the status variable in the input data frame (default is "status").

time_point

An integer or vector specifying the time point(s) for analysis (default is 12).

time_type

A character specifying the type of time (e.g., "month" or "day", default is "month").

palette

A character specifying the color palette for the plot (default is "jama").

cols

A character specifying the color scheme for the plot (default is "normal").

seed

An integer specifying the seed for reproducibility (default is 1234).

show_col

A logical value indicating whether to display the color palette (default is FALSE).

path

A character specifying the path to save the plot (default is NULL).

main

A character specifying the main title of the plot (default is "PFS").

index

An integer specifying the index for the plot filename (default is 1).

fig.type

A character specifying the type of output file (e.g., "pdf", or "png", default is "pdf").

width

A numeric value specifying the width of the plot (default is 5).

height

A numeric value specifying the height of the plot (default is 5.2).

Examples

data("tcga_stad_sig", package = "IOBR")
data("pdata_stad", package = "IOBR")
input <- merge(pdata_stad, tcga_stad_sig, by = "ID")
roc_time(input = input, vars = c("Pan_F_TBRs", "CD_8_T_effector", "Immune_Checkpoint"),
time = "time", status = "OS_status", time_point = 12, path = "result", main = "OS")


IOBR/IOBR documentation built on May 5, 2024, 2:34 p.m.