Skip to content This library is free, offered as dana. If it helps your work, donate here →

This is one of 3,622 free prompts in the penguin tree ai library. Sign up once and the whole library opens, with new prompts by email.

open the library →

Statistical model selection guide

Recommends the most appropriate statistical or machine learning modeling approaches for a described prediction problem — matching regression, survival, tree-based, and probabilistic methods to the target type, dataset…

download .md

Purpose

Translate a described prediction problem and dataset profile into a ranked shortlist of appropriate modeling approaches — with the assumptions, interpretability trade-offs, validation strategy, and regulatory fit spelled out — so the analyst starts building the right model instead of defaulting to whatever is familiar or reaching for a black box that won't pass review.

When to Use

Invoke this skill when the user asks to:

  • Decide which model to use for a specific prediction, classification, or risk problem
  • Compare modeling approaches (e.g., GLM vs. gradient boosting, Cox vs. accelerated failure time)
  • Choose a model that satisfies interpretability or regulatory constraints
  • Recommend a survival, frequency-severity, or time-to-event modeling approach
  • Justify a modeling method choice to a review board, actuary, or regulator
  • Diagnose why a chosen model class isn't fitting and what to switch to

Inputs Required

Before starting, collect:

  • Prediction target: What is being predicted, and its type — continuous, binary, count, time-to-event, multiclass, ordinal, or probability
  • Business/risk objective: The decision the model informs (e.g., pricing, reserving, fraud flagging, churn, claim propensity)
  • Dataset profile: Row count, feature count, feature types (numeric/categorical), sparsity, and whether observations are independent or grouped/panel
  • Data quality notes: Missingness pattern, class imbalance, censoring/truncation, outliers, known measurement issues
  • Interpretability requirement: Fully transparent (coefficient-level explanation required) / partially interpretable (feature-level explanation acceptable) / black box acceptable
  • Regulatory or governance context: Any constraints — insurance rate filing, fair lending, model risk management, audit requirements, or none
  • Deployment constraints: Latency, retraining frequency, monobank/production environment limits, or none

If the target type or interpretability requirement is missing, ask one clarifying question — these two inputs drive the entire recommendation.

Instructions

Step 1: Classify the Prediction Problem

Pin down the problem type before naming any model. Map to one of these families:

  • Continuous outcome → regression family (linear, GLM Gamma/Tweedie, quantile, GAM, tree ensembles)
  • Binary/probability outcome → classification family (logistic GLM, penalized logistic, gradient boosting, GAM)
  • Count outcome → count family (Poisson, Negative Binomial, zero-inflated, Tweedie for frequency-severity)
  • Time-to-event with censoring → survival family (Kaplan-Meier, Cox PH, AFT, discrete-time hazard, survival GBM)
  • Multiclass/ordinal → multinomial or ordinal logistic, softmax GBM
  • Grouped/hierarchical data → mixed-effects / GLMM, or credibility-weighted approaches

Explicitly name which family applies and why, based on the target type stated. If the data is panel/grouped or heavily censored, flag that it overrides the naive choice (e.g., "counts with excess zeros → zero-inflated, not plain Poisson").

Step 2: Apply the Interpretability Filter

Cut the candidate space by the stated interpretability requirement:

  • Fully transparent required (rate filings, fair lending, regulated pricing): Restrict to GLMs, GAMs with monotonic constraints, penalized regression, decision trees with bounded depth. Exclude unconstrained ensembles.
  • Partially interpretable acceptable: Allow gradient boosting / random forests with SHAP or partial dependence, monotonic-constrained GBMs, and Explainable Boosting Machines (EBM/GA2M).
  • Black box acceptable: Open the full space — XGBoost/LightGBM/CatBoost, neural nets — but still rank by data-fit, not just accuracy ceiling.

State which candidates were eliminated by this filter and why. In regulated insurance contexts, note that a monotonic-constrained GBM or GLM+GAM is often the practical ceiling.

Step 3: Match to Dataset Characteristics

Refine the shortlist against the data profile:

  • Small n / high dimensionality: Favor penalized regression (Lasso/Ridge/Elastic Net) over deep ensembles; ensembles overfit small samples
  • Large n, many interactions: Favor gradient boosting — captures nonlinearity the analyst won't specify manually
  • Heavy class imbalance: Note resampling, class weights, or focal loss; recommend PR-AUC over ROC-AUC as the evaluation metric
  • High-cardinality categoricals: Favor CatBoost / target encoding / GLM with credibility grouping over one-hot into a linear model
  • Missingness: If informative, recommend explicit missing-indicator or native-NA handling (LightGBM/XGBoost); if MAR, note imputation strategy
  • Censoring/truncation (insurance claims, policy duration): Enforce survival methods — a standard regressor on observed durations is biased

Step 4: Produce the Ranked Shortlist (3-5 Candidates)

For each candidate, provide a structured block:

  1. Model: Named method (e.g., "Tweedie GLM," "Cox Proportional Hazards," "Monotonic-constrained LightGBM")
  2. Fit rationale: 2 sentences on why it suits this problem and data
  3. Key assumptions: The assumptions that must hold (e.g., proportional hazards, log-link variance structure, independence) and how to check each
  4. Interpretability level: What the analyst can explain to a stakeholder with this model
  5. Watch-outs: The specific failure mode for this pairing (e.g., "PH assumption violated for time-varying covariates")

Rank by best overall fit given the constraints — not by raw predictive power. Put the recommended primary first.

Step 5: Recommend Validation Strategy

Specify how to test the chosen approach honestly:

  • Split scheme: Random k-fold vs. time-based holdout (mandatory for temporal drift) vs. grouped CV (mandatory for panel data to prevent leakage)
  • Evaluation metric matched to target: RMSE/MAE (continuous), deviance/log-loss (GLM), PR-AUC (imbalanced binary), C-index / integrated Brier score (survival), Gini/lift (insurance ranking)
  • Assumption diagnostics: The specific checks for the recommended model (residual plots, PH tests, calibration curves, dispersion test)
  • Overfitting guard: Early stopping, regularization path, or nested CV for hyperparameter tuning

Step 6: Name the Fallback

State the second-choice approach and the trigger to switch to it — e.g., "If PH tests fail, move from Cox to an AFT or discrete-time hazard model," or "If the GLM underfits nonlinear interactions, escalate to a monotonic-constrained GBM with SHAP for the filing narrative."

Output Format

  • Structure: Problem classification → interpretability filter → data-fit refinement → ranked shortlist (structured blocks) → validation strategy → fallback
  • Length: 900–1,300 words
  • Format: Structured document — prose for reasoning, numbered blocks for the shortlist, bulleted lists for validation and diagnostics
  • Sections: Problem Classification, Interpretability Filter, Data-Fit Refinement, Ranked Model Shortlist, Validation Strategy, Fallback Plan
  • Tone: Senior quantitative analyst — precise, assumption-aware, decisive without overclaiming; names methods exactly and refuses to hand-wave over trade-offs

Quality Checklist

Before delivering output, verify:

  • [ ] The prediction target type is explicitly classified into a model family before any method is named
  • [ ] 3–5 candidate models are provided, each with fit rationale, assumptions, interpretability level, and a specific watch-out
  • [ ] Candidates eliminated by the interpretability filter are named, with the reason stated
  • [ ] The evaluation metric recommended matches the target type (no ROC-AUC for continuous, no RMSE for survival)
  • [ ] Censoring, imbalance, grouping, or small-n conditions in the input actually change the recommendation — not ignored
  • [ ] A named fallback and a concrete switch trigger are provided

Notes

  • In regulated insurance and lending contexts, a monotonic-constrained GBM with SHAP or a well-specified GLM/GAM is usually the practical interpretability ceiling — recommend accuracy gains that survive the filing, not the leaderboard.
  • Censoring is the most common silently-broken assumption: any time-to-event target with incomplete follow-up must go to a survival method, even if the analyst framed it as regression.
  • When frequency and severity both matter (claims modeling), consider whether a single Tweedie GLM or a two-part frequency-severity split serves the business decision better — this depends on whether the two components need separate governance.
  • Prefer the simplest model that meets the accuracy and interpretability bar; escalate model complexity only when a diagnostic shows the simpler class is underfitting.

How to use this skill

This file is a Claude Code skill in Anthropic's standard format — markdown with YAML frontmatter at the top.

Installing in Claude Code:

  • ~/.claude/skills/<folder-name>/SKILL.md — auto-loads in every session anywhere on your machine (recommended for skills you'll use across multiple projects)
  • <your-project>/.claude/skills/<folder-name>/SKILL.md — auto-loads only when working in that project (recommended for project-specific skills)

Restart Claude Code or open a new session to register.

Using in Claude.ai, ChatGPT, Gemini, or other AI tools:

  1. Drag this file into a new chat, or copy and paste its contents
  2. Send your task or request as your next message — the AI will apply the skill where it fits

For Claude Code skill details: https://docs.anthropic.com/en/docs/claude-code/skills