Time dependent roc

From aipoch/medical-research-skills · View interactive version

Time dependent roc is an AI agent skill from the GitHub repository aipoch/medical-research-skills. Use when performing time-dependent ROC curve analysis for survival data with follow-up time, event status, and a numeric marker. Supports CSV/TXT/TSV/Excel input, `risk_score` as the default marker unless `--marker_col` is provided, parameter validation, standardized output directories, AUC table ex

How to use this skill

Skill file

Source: https://github.com/aipoch/medical-research-skills

Time-Dependent ROC Analysis

Use this skill to compute and plot time-dependent ROC curves for survival outcomes.

Use This Skill When

Primary Command

Rscript scripts/main.R \
  --data_file <input_file> \
  --times <comma_separated_times> \
  --output_dir <output_dir>

Prerequisites

Core Arguments

| Argument | Required | Description |

|----------|----------|-------------|

| --data_file | Yes | Input data file in CSV, TXT, TSV, TAB, XLS, or XLSX format |

| --times | No | Prediction time points, comma-separated. Default 1,3,5 |

| --marker_col | No | Marker column name. Default risk_score; provide this option when your file uses a different marker |

| --output_dir | No | Output directory, default ./TimeROC_Results |

| --time_unit | No | Time unit label for plot/output: year, month, or day. Default year |

| --auto_convert_days | No | If TRUE, convert large futime values from days to the selected unit when appropriate. Default TRUE |

| --weighting | No | IPCW weighting method: aalen, marginal, or cox. Default aalen |

| --cause | No | Event code treated as the outcome of interest. Default 1 |

Input Requirements

Example input:

id	fustat	futime	risk_score	risk_group	GPR161	RIBC2
TCGA-C5-A1M5	1	5.6219	-1.1070	low	2.8252	5.3532
TCGA-EA-A5O9	0	2.1589	-0.8964	low	2.6046	4.4293
TCGA-C5-A3HL	0	1.7014	-0.9044	low	4.1248	4.9166

Minimal Workflow

  1. Confirm the input file exists and includes futime, fustat, and risk_score, or plan to pass --marker_col.
  2. Run scripts/main.R with the requested time points.
  3. Check the output directory for the AUC table and PDF figure.

If you omit --data_file, the script exits with SKILL_MISSING_INPUT.

Outputs

Expected output structure:

<output_dir>/
├── data/
│   └── time_roc_points.<csv|txt>
├── session_info.txt
├── figure/
│   └── time_roc.pdf
└── table/
    └── time_roc_auc.<csv|txt>

Primary output files:

Exported result fields include:

Exported ROC point fields include:

Read These Files When Needed

| Need | File |

|------|------|

| Statistical details and assumptions | references/algorithm.md |

| More CLI examples | references/cli-guide.md |

| Error diagnosis | references/troubleshooting.md |

| Main execution entry point | scripts/main.R |

| Sample test data | tests/data/ |

Quick Examples

Basic analysis:

Rscript scripts/main.R \
  --data_file tests/data/time_roc_sample1.txt \
  --times 1,3,5 \
  --output_dir tests/output_basic

Specify marker column and plot styling:

Rscript scripts/main.R \
  --data_file tests/data/time_roc_sample2.txt \
  --marker_col GPR161 \
  --times 1,2,4 \
  --line_colors "#4DBBD5,#E64B35,#00A087" \
  --legend_position bottom \
  --output_dir tests/output_gpr161

Validation

Rscript scripts/main.R --help
Rscript scripts/main.R \
  --data_file tests/data/time_roc_sample1.txt \
  --times 1,3,5 \
  --output_dir tests/validation_output

After running analysis, verify that these files exist:

Common Errors

If the issue is not obvious, read references/troubleshooting.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.