agentleFS
Scientific-ToolingScientific-Tooling/structured-intelligence/skills/stat-logistic-regression/SKILL.md

stat-logistic-regression

Skill4 starsChanged 12 days agoMITView on GitHub

Fit a logistic regression model for binary outcomes, report odds ratios and model performance (AUC-ROC, confusion matrix).

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Test set fraction for performance evaluation (default: 0.2)

    line 23
  2. Distinctive:

    Read data; validate that outcome column is binary.

    line 28
  3. Very specific:

    If regularization=none: unpenalized MLE fit for inferential reporting.

    line 31
  4. Very specific:

    If regularization=l1 or l2: cross-validated penalized fit for prediction-focused modeling.

    line 32
  5. Distinctive:

    If regularization is used: report optimal lambda from cross-validation and non-zero coefficients at optimal lambda.

    line 38
  6. Distinctive:

    Write coefficient table(s), performance metrics (TSV), ROC curve plot (PDF), and calibration plot (PDF) to output directory.

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Logistic Regression

Use When

  • User wants to model the probability of a binary outcome (disease/healthy, expressed/not expressed, responder/non-responder)
  • User needs odds ratios and their confidence intervals for each predictor
  • User wants to evaluate model discrimination with AUC-ROC and calibration
  • Common in medical, epidemiological, and genomics classification tasks

Inputs

  • Required:
    • Data table (CSV or TSV) with a binary outcome column (0/1 or two-level factor) and one or more predictor columns
    • Outcome variable name
    • Predictor variable name(s)
  • Optional:
    • Regularization: none (default), l1 (Lasso), or l2 (Ridge)
    • Test set fraction for performance evaluation (default: 0.2)
    • Output directory (default: ./logit_output)

Workflow

  1. Read data; validate that outcome column is binary; encode predictors as needed.
  2. Split data into training and test sets (stratified by outcome).
  3. Fit logistic regression on training set:
    • If regularization=none: unpenalized MLE fit for inferential reporting.
    • If regularization=l1 or l2: cross-validated penalized fit for prediction-focused modeling.
  4. Report coefficients:
    • Unpenalized model: log-odds estimate, standard error, z-statistic, p-value, odds ratio, 95% CI.
    • Penalized model: shrunken coefficients and odds ratios; do not report classical p-values/z-statistics from penalized fit.
  5. Evaluate on test set: compute AUC-ROC, plot ROC curve, compute confusion matrix at 0.5 threshold (accuracy, sensitivity, specificity, PPV, NPV).
  6. Compute Hosmer-Lemeshow goodness-of-fit test for calibration for the unpenalized model; for penalized models, report calibration curve and Brier score.
  7. If regularization is used: report optimal lambda from cross-validation and non-zero coefficients at optimal lambda.
  8. Save the executable analysis script (analysis_code.py or analysis_code.R) and software version manifest (session_info.txt) used to produce results.
  9. Write coefficient table(s), performance metrics (TSV), ROC curve plot (PDF), and calibration plot (PDF) to output directory.

Output Contract

  • Coefficient table (TSV, unpenalized): term, log_odds, std_error, z_statistic, p_value, odds_ratio, ci_lower_or, ci_upper_or
  • Coefficient table (TSV, penalized): term, log_odds, odds_ratio, selected_at_lambda
  • Performance metrics (TSV): auc, accuracy, sensitivity, specificity, ppv, npv, hl_test_p_or_na, brier_score
  • ROC curve (PDF)
  • Confusion matrix (printed to stdout)
  • Reproducibility artifacts: analysis_code.py or analysis_code.R, plus session_info.txt

Limits

  • Assumes independence of observations; does not account for clustering or repeated measures.
  • Requires sufficient events per variable (EPV ≥ 10 recommended) to avoid overfitting.
  • Class imbalance can inflate accuracy; examine sensitivity/specificity and AUC.
  • Penalized models are prediction-oriented; classical inferential statistics (standard errors/p-values) are not directly interpretable from penalized coefficients.
  • Common failure: outcome column with more than two levels — binarize before running.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.