Logo von Decision Curve Analysis

Decision Curve Analysis

OrganisationBeliebt
aipoch
decision-curve-analysis

Use when evaluating the clinical utility of a binary prediction model from a single clinical CSV file by fitting a logistic decision-curve model, plotting decision and clinical-impact curves, and exporting summary outputs. NOT for: survival calibration, ROC-only discrimination analysis, nomogram construction, or time-to-event outcomes.

Übersicht

Herausgeberaipoch
Repositorymedical-research-skills
Skill-Namedecision-curve-analysis
Sterne
1.9K
Forks
175
Mitgelieferte Dateien
11
LizenzMIT
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 11

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von aipoch auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Decision Curve Analysis in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/decision-curve-analysis
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.

In TypingMind verwenden

Aktivieren Sie Decision Curve Analysis in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Decision Curve Analysis automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Decision Curve Analysis nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

Decision Curve Analysis

When to Use

Use this skill when you need to:

  • evaluate whether a binary prediction model adds clinical net benefit across threshold probabilities;
  • visualize decision curves and clinical-impact curves from a clinical cohort;
  • export an auditable DCA model object together with summary text and PDFs.

Typical user requests:

  • "Run decision-curve analysis on this binary outcome and risk-score dataset."
  • "Generate DCA and clinical-impact plots for this prediction model."
  • "Compare net benefit across thresholds for this case-control cohort."

When Not to Use

Do not use this skill for:

  • time-to-event or survival outcomes;
  • ROC-only discrimination analysis without decision-curve outputs;
  • nomogram construction or calibration-curve analysis;
  • multiclass outcomes or non-binary endpoints.

When to Read External Files

SituationFile to ReadPurpose
Need algorithm detailsreferences/algorithm.mdStatistical methods and formulas
Need to run analysisscripts/main.RGet the complete command
Encounter errorsreferences/troubleshooting.mdFind solutions
Need CLI examplesreferences/cli-guide.mdParameter usage examples

Usage

bash
Rscript scripts/main.R \
  --data_file ./clinical_dca_data.csv \
  --outcome_col fustat \
  --predictor_col riskScore \
  --output_dir ./output/

Arguments

ShortLongTypeDefaultDescription
-d--data_filecharacterrequiredClinical CSV file with row names as sample IDs
--outcome_colcharacterfustatBinary outcome column encoded as 0/1
--predictor_colcharacterriskScoreNumeric predictor column used in the logistic DCA model
--study_designcharactercase-controlStudy design: case-control or cohort
--population_prevalencedouble0.3Population prevalence for case-control DCA (ignored for cohort design)
--threshold_bydouble0.01Threshold step size; values below 0.005 significantly increase computation time
--confidence_leveldouble0.95Confidence level passed to rmda::decision_curve()
--population_sizeinteger1000Population size used in the clinical-impact plot
--n_cost_benefitsinteger8Number of cost-benefit labels in the clinical-impact plot
--show_confidence_intervalsflagFALSEShow confidence intervals on the decision curve
--standardize_net_benefitflagFALSEReport standardized net benefit (sNB) instead of raw net benefit (NB)
--decision_curve_colorcharacter#E64B35Decision-curve line color
--impact_colorscharacter#E64B35,#4DBBD5Two comma-separated colors for the clinical-impact plot
--plot_widthdouble6PDF width in inches
--plot_heightdouble5.5PDF height in inches
--font_familycharactersansPDF font family
--plot_titlecharacterDecision Curve AnalysisDecision-curve plot title
--base_cexdouble0.9Base text-size multiplier
-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

Input Format

Clinical Data (--data_file)

CSV file with row names as sample IDs. The dataset must contain at least one binary outcome column and one numeric predictor column.

csv
,fustat,riskScore,FOXP3,CD45
Patient_1,1,0.630147268229631,5.7783584300481,3.5407433709834
Patient_2,0,0.23007730941193,6.70308857663772,3.11795942819676
Patient_3,1,0.534809528754818,5.46860669585825,3.40086667402884

Requirements

  • File extension must be .csv.
  • Row names must be non-missing, unique sample IDs.
  • outcome_col and predictor_col must exist.
  • Outcome values must use 0/1 encoding. Outcome values are coerced to numeric before validation; logical TRUE/FALSE are converted to 1/0. Factor or character values will produce SKILL_INVALID_PARAMETER.
  • Predictor values must be finite numeric values.
  • At least 20 rows, 5 positive outcomes, and 5 negative outcomes are required.

Design note: When --study_design cohort is selected, --population_prevalence has no statistical effect; the raw observed event rate is used instead. A warning is emitted if you set a non-default population_prevalence with cohort design.


Output Files

FileFormatDescription
data/dca_model.rdsRDSSaved rmda::decision_curve() result object
table/dca_summary.txtPlain textText summary of decision-curve net benefit statistics
plot/decision_curve.pdfPDFDecision-curve plot
plot/clinical_impact_curve.pdfPDFClinical-impact plot
session_info.txtPlain textSession information and run parameters

dca_summary.txt

Summary fields include:

  • threshold-specific net benefit statistics from summary(dca_model);
  • the selected measure (NB or sNB);
  • the fitted formula and study-design context recorded in session_info.txt.

Workflow

Step 1: Validate Input

  • Confirm the clinical CSV exists and is readable.
  • Check that the requested outcome and predictor columns are present.
  • Validate sample IDs, binary outcome coding, and numeric predictor values.
  • Emit warning if population_prevalence is non-default and study_design is cohort.

Step 2: Prepare Analysis Dataset

  • Keep only the outcome and predictor columns required for DCA.
  • Coerce outcome and predictor values to numeric.
  • Reject cohorts with too few rows or too few events/non-events.

Step 3: Fit Decision-Curve Model

  • Fit a logistic decision-curve model with rmda::decision_curve().
  • Build a threshold grid from 0 to 1 using threshold_by.
  • Apply population_prevalence when study_design is case-control.

Step 4: Save Outputs

  • Save the fitted DCA object as .rds.
  • Export the text summary as .txt.
  • Render the decision curve and clinical-impact curve as PDFs.
  • Record session metadata for reproducibility.

Agent Response Contract

After a successful run, report:

  1. Study design and predictor used (e.g., case-control, riskScore)
  2. Net benefit metric reported (NB or sNB)
  3. Threshold range and step used for the grid
  4. Key finding: net benefit at clinically relevant threshold(s) from dca_summary.txt
  5. Artifact paths: plot/decision_curve.pdf, plot/clinical_impact_curve.pdf, data/dca_model.rds

Examples

Basic Usage

bash
Rscript scripts/main.R \
  --data_file clinical_dca_data.csv \
  --outcome_col fustat \
  --predictor_col riskScore \
  --output_dir ./output/

Cohort Design With Custom Plotting

bash
Rscript scripts/main.R \
  --data_file clinical_dca_data.csv \
  --study_design cohort \
  --outcome_col fustat \
  --predictor_col riskScore \
  --plot_title "Cohort DCA" \
  --decision_curve_color "#3C5488" \
  --impact_colors "#3C5488,#00A087" \
  --show_confidence_intervals \
  --output_dir ./cohort_output/

With Bundled Test Data

bash
Rscript scripts/main.R \
  --data_file tests/data/dca_data.csv \
  --outcome_col fustat \
  --predictor_col riskScore \
  --output_dir tests/output/ \
  --overwrite

Error Handling

ErrorCauseSolution
SKILL_INVALID_PARAMETERInvalid design, invalid numeric range, invalid outcome coding, insufficient rows/class counts, or failed model fittingCheck arguments, data ranges, and binary outcome coding
SKILL_FILE_NOT_FOUNDInput CSV does not existVerify the input path
SKILL_MISSING_COLUMNSRequired columns are absentCheck outcome_col and predictor_col names
SKILL_EMPTY_DATAInput file is empty or contains no usable rows/columnsCheck the CSV content
SKILL_SAMPLE_MISMATCHReserved for cross-file sample mismatch scenariosNot expected for this single-file workflow
SKILL_PACKAGE_NOT_FOUNDRequired R package is missingInstall with: Rscript -e "install.packages('rmda', repos='https://cloud.r-project.org')"

IF error persists, READ: references/troubleshooting.md


Input Validation

This skill accepts: a single clinical CSV file with a binary outcome column (0/1 encoded) and a numeric predictor column, for decision curve analysis of a binary prediction model.

If the user's request does not involve decision curve analysis of a binary prediction model — for example, asking to run survival analysis, build ROC curves only, construct a nomogram, or analyze multiclass outcomes — do not proceed with the workflow. Instead respond:

"Decision Curve Analysis is designed to evaluate the clinical utility of binary prediction models by computing net benefit across decision thresholds. Your request appears to be outside this scope. Please provide a binary outcome dataset for DCA, or use a more appropriate tool for survival analysis, ROC analysis, or nomogram construction."


Testing

Smoke Test With Included Data

bash
Rscript scripts/main.R --help

Rscript scripts/main.R \
  --data_file tests/data/dca_data.csv \
  --outcome_col fustat \
  --predictor_col riskScore \
  --output_dir tests/output/ \
  --overwrite

Automated Smoke Test Script

bash
Rscript tests/run_smoke_test.R

Optional shell wrapper:

bash
bash tests/run_smoke_test.sh

Expected Output

text
tests/output/
|-- data/dca_model.rds
|-- plot/clinical_impact_curve.pdf
|-- plot/decision_curve.pdf
|-- session_info.txt
`-- table/dca_summary.txt

References

  1. Vickers AJ, Elkin EB. Decision curve analysis: a novel method for evaluating prediction models.
  2. rmda package documentation for clinical decision-curve analysis.

For detailed algorithm, READ: references/algorithm.md


Implementation Checklist

  • CLI parsing with optparse
  • set.seed() for reproducibility
  • Top-level CRAN dependency checks
  • Session info recording
  • Timeout parameter exposed as CLI option
  • Relative-path source() usage via get_script_dir()
  • Modular script structure in scripts/
  • Test data provided in tests/data/
  • Error handling with SKILL_* codes
  • Reference docs provided in references/

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

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Decision Curve Analysis?

Use when evaluating the clinical utility of a binary prediction model from a single clinical CSV file by fitting a logistic decision-curve model, plotting decision and clinical-impact curves, and exporting summary outputs. NOT for: survival calibration, ROC-only discrimination analysis, nomogram construction, or time-to-event outcomes.

Warum Decision Curve Analysis in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Decision Curve Analysis besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Decision Curve Analysis in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/decision-curve-analysis ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Decision Curve Analysis nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Decision Curve Analysis verwenden?

So viele Sie möchten. In TypingMind können Sie Decision Curve Analysis mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Decision Curve Analysis kostenlos?

Ja. Der Skill wird von aipoch auf GitHub unter der Lizenz MIT veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇