Univariate Multivariable Cox Regressionのロゴ

Univariate Multivariable Cox Regression

組織人気
aipoch
univariate-multivariable-cox-regression

Use when running prognostic survival analysis on a clinical cohort with time-to-event data to estimate univariate and multivariable Cox proportional hazards models, export result tables, and generate forest plots. NOT for: nomogram construction, calibration curves, time-dependent ROC analysis, or model training/feature selection beyond the built-in univariate screening rule.

概要

公開者aipoch
リポジトリmedical-research-skills
スキル名univariate-multivariable-cox-regression
スター
1.9K
フォーク
188
同梱ファイル
21
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 21個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    aipochがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Univariate Multivariable Cox Regression」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/univariate-multivariable-cox-regression
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。

TypingMindで使用

TypingMindのチャットでUnivariate Multivariable Cox Regressionを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にUnivariate Multivariable Cox Regressionを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Univariate Multivariable Cox Regressionは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Univariate and Multivariable Cox Regression

When to Use

Use this skill when you need to:

  • run univariate and multivariable Cox regression on a clinical survival cohort;
  • identify prognostic clinical variables associated with time-to-event outcomes;
  • export hazard-ratio tables and then render forest plots from those results.

Typical user requests:

  • "Run single-factor and multi-factor Cox regression on this survival dataset."
  • "Find prognostic variables from my clinical cohort and give me forest plots."
  • "Use futime and fustat to do Cox regression for age, stage, and risk."

When Not to Use

Do not use this skill for:

  • nomogram construction or calibration analysis;
  • time-dependent ROC analysis or external prognostic model validation;
  • feature discovery pipelines beyond the built-in univariate screening rule;
  • non-survival outcomes such as binary diagnosis or differential expression.

When to Read External Files

SituationFile to ReadPurpose
Need algorithm detailsreferences/algorithm.mdStatistical workflow, assumptions, and feature-selection rule
Need to run analysisscripts/main.RExecute Rscript scripts/main.R <command> [options]
Encounter errorsreferences/troubleshooting.mdCommon SKILL_* errors and fixes
Need CLI examplesreferences/cli-guide.mdCommand-specific argument examples
Need test datatests/data/Minimal runnable cohort for smoke testing

Usage

1. Run Cox Analysis

bash
Rscript scripts/main.R analyze \
  --data_file ./clinical_data.csv \
  --features age,gender,stage,risk \
  --time_col futime \
  --event_col fustat \
  --output_dir ./output/ \
  --seed 42

2. Generate Univariate Forest Plot

bash
Rscript scripts/main.R forest-plot \
  --data_file ./output/table/prognosis_uni_cox_results.xlsx \
  --plot_save ./output/plot/uni_forest_plot.pdf

3. Generate Multivariable Forest Plot

bash
Rscript scripts/main.R multi-forest-plot \
  --data_file ./output/table/prognosis_multi_cox_results.xlsx \
  --plot_save ./output/plot/multi_forest_plot.pdf

Arguments

Analyze Command

ShortLongTypeDefaultDescription
-d--data_filecharacterrequiredClinical CSV file with sample IDs as row names
-f--featurescharacterage,gender,stage,Tstage,Nstage,Mstage,riskComma-separated features for Cox analysis
-t--time_colcharacterfutimeSurvival time column
-e--event_colcharacterfustatEvent column encoded as 1=event, 0=censored
-u--skip_univariatecharacterfalseSkip univariate screening and fit multivariable model on all requested features
-o--output_dircharacter./output/Output directory
--overwriteflagFALSEAllow writing into a non-empty output directory
-s--seedinteger42Random seed for reproducibility
-T--timeout_secondsinteger0Elapsed time limit in seconds; 0 disables timeout

Forest Plot Commands

These arguments apply to both forest-plot and multi-forest-plot.

ShortLongTypeDefaultDescription
-d--data_filecharacterrequiredCox result table in .xlsx, .xls, or .csv format
-p--plot_savecharacterrequiredOutput PDF path
-w--widthdouble8Plot width in inches
-H--heightdouble6Plot height in inches
-F--font_sizedouble11Font size for forest-plot labels
-s--seedinteger42Random seed for reproducibility
-T--timeout_secondsinteger0Elapsed time limit in seconds; 0 disables timeout

Input Format

Clinical Data (--data_file for analyze)

CSV file with sample IDs as row names and one column per feature/end-point variable.

csv
",age,gender,stage,futime,fustat,risk
SAMPLE_001,65,Male,StageIII,365,1,high
SAMPLE_002,52,Female,StageII,730,0,low
SAMPLE_003,78,Male,StageIV,180,1,high

Requirements

  • The file must be CSV.
  • Sample IDs must be stored in the first column as row names.
  • time_col must contain finite numeric values greater than 0.
  • event_col must contain only 0 and 1.
  • All requested features, time_col, and event_col must exist.
  • At least 10 complete samples and at least 2 events are required after filtering incomplete rows.

Cox Result Table (--data_file for plot commands)

The plotting commands read the output table created by analyze.

Required columns:

  • Characteristics
  • Total(N)
  • HR (95% CI)
  • P value

Output Files

Analyze Command

FileDescription
table/prognosis_uni_cox_results.xlsxUnivariate Cox result table. Present unless --skip_univariate true
table/prognosis_multi_cox_results.xlsxMultivariable Cox result table
data/analysis_data.rdsSerialized complete-case dataset used for Cox fitting
session_info.txtSession info and recorded run parameters

Plot Commands

FileDescription
plot/uni_forest_plot.pdfPDF forest plot generated by forest-plot
plot/multi_forest_plot.pdfPDF forest plot generated by multi-forest-plot
plot/session_info.txtSession info and plotting parameters written beside the PDF

Result Table Columns

ColumnDescription
CharacteristicsVariable name for continuous terms, or level label for categorical terms
Total(N)Number of complete-case samples used for modeling
HR (95% CI)Hazard ratio with 95% confidence interval
P valueWald-test p-value formatted to three decimals or <0.001
featureSource feature corresponding to each row

Workflow

Step 1: Validate and Prepare Data

  • Read the clinical CSV.
  • Check required columns and data types.
  • Convert character predictors to factors.
  • Remove rows with missing values across requested model variables.

Step 2: Run Univariate Cox Models

  • Fit one Cox model per feature when --skip_univariate false.
  • Export hazard ratios, confidence intervals, and p-values.

Step 3: Run Multivariable Cox Model

  • Use all significant univariate features with p < 0.05.
  • If fewer than 3 significant features are found, fall back to all requested features.
  • Export adjusted hazard ratios, confidence intervals, and p-values.

Step 4: Generate Forest Plots

  • Read the result table.
  • Parse HR (95% CI) values.
  • Render a one-page PDF forest plot.

Examples

Basic Analysis

bash
Rscript scripts/main.R analyze \
  -d tests/data/sample_clinical_survival_data.csv \
  -o tests/expected_output/ \
  --overwrite

Analysis With Selected Features and Overwrite

bash
Rscript scripts/main.R analyze \
  -d clinical_data.csv \
  -f age,gender,stage,risk \
  -o ./results/ \
  --overwrite \
  -T 600

Direct Multivariable Fit Without Univariate Screening

bash
Rscript scripts/main.R analyze \
  -d clinical_data.csv \
  -f age,stage,risk \
  -u true \
  -o ./results/

Plot Generation

bash
Rscript scripts/main.R forest-plot \
  -d ./results/table/prognosis_uni_cox_results.xlsx \
  -p ./results/plot/uni_forest_plot.pdf \
  -w 10 -H 7 -F 12

Rscript scripts/main.R multi-forest-plot \
  -d ./results/table/prognosis_multi_cox_results.xlsx \
  -p ./results/plot/multi_forest_plot.pdf \
  -w 10 -H 7 -F 12

Error Handling

ErrorCauseSolution
SKILL_INVALID_PARAMETERMissing required CLI value, invalid extension, unknown command, unreadable CSV input, invalid clinical values, too few complete samples/events, or Cox model fitting failure caused by unsupported input dataCheck argument names, file types, clinical value constraints, and model input suitability
SKILL_FILE_NOT_FOUNDInput file path does not existVerify the input path
SKILL_MISSING_COLUMNSRequired columns are absent from the clinical file or plot tableCheck column names and spelling
SKILL_EMPTY_DATAInput file or plot table contains no usable rowsVerify file content and export process
SKILL_PACKAGE_NOT_FOUNDRequired R package is missingInstall the listed CRAN package(s)

IF error persists, READ: references/troubleshooting.md


Testing

Smoke Test With Included Data

bash
Rscript scripts/main.R --help

Rscript scripts/main.R analyze \
  -d tests/data/sample_clinical_survival_data.csv \
  -o tests/expected_output/ \
  --overwrite

Rscript scripts/main.R forest-plot \
  -d tests/expected_output/table/prognosis_uni_cox_results.xlsx \
  -p tests/expected_output/plot/uni_forest_plot.pdf

Rscript scripts/main.R multi-forest-plot \
  -d tests/expected_output/table/prognosis_multi_cox_results.xlsx \
  -p tests/expected_output/plot/multi_forest_plot.pdf

Automated Smoke Test Script

bash
Rscript tests/run_smoke_test.R

Optional shell wrapper:

bash
bash tests/run_smoke_test.sh

Expected Outputs

text
tests/expected_output/
|-- data/analysis_data.rds
|-- plot/multi_forest_plot.pdf
|-- plot/session_info.txt
|-- plot/uni_forest_plot.pdf
|-- session_info.txt
|-- table/prognosis_multi_cox_results.xlsx
`-- table/prognosis_uni_cox_results.xlsx

References

  1. Cox DR (1972). Regression Models and Life-Tables. Journal of the Royal Statistical Society: Series B.
  2. Therneau TM, Grambsch PM (2000). Modeling Survival Data: Extending the Cox Model.
  3. Harrell FE (2015). Regression Modeling Strategies.

For detailed algorithm, READ: references/algorithm.md


Implementation Checklist

  • CLI parsing with optparse
  • set.seed() for reproducibility
  • requireNamespace() dependency checks
  • Session info recording
  • Timeout parameter exposed as CLI option
  • File reading instructions in SKILL.md
  • Modular script structure in scripts/
  • Test data provided in tests/data/
  • Error handling with SKILL_* codes
  • References documented in references/

Last updated: 2026-04-16 | Version: 1.1.0

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Univariate Multivariable Cox Regression」では何ができますか?

Use when running prognostic survival analysis on a clinical cohort with time-to-event data to estimate univariate and multivariable Cox proportional hazards models, export result tables, and generate forest plots. NOT for: nomogram construction, calibration curves, time-dependent ROC analysis, or model training/feature selection beyond the built-in univariate screening rule.

TypingMindでUnivariate Multivariable Cox Regressionを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Univariate Multivariable Cox Regressionはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにUnivariate Multivariable Cox Regressionをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/univariate-multivariable-cox-regressionを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Univariate Multivariable Cox Regressionを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Univariate Multivariable Cox Regressionで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもUnivariate Multivariable Cox Regressionを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Univariate Multivariable Cox Regression」は無料ですか?

はい。aipochがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇