Skip to content
Data
Skill

/statsmodels

Fits and diagnoses Python statistical models including OLS, GLM, discrete and mixed models, ARIMA and SARIMAX. Supports coefficient inference, marginal effects, model comparison and time series forecasting with explicit design and uncertainty checks. Used for econometrics and

From plugin
scientific-agent-skills
56k177 skills

Claude Code

$ npx -y skills add K-Dense-AI/scientific-agent-skills --skill statsmodels --agent claude-code

SKILL.md

statsmodels.SKILL.md
name: statsmodels
description: Fits and diagnoses Python statistical models including OLS, GLM, discrete and mixed models, ARIMA and SARIMAX. Supports coefficient inference, marginal effects, model comparison and time series forecasting with explicit design and uncertainty checks. Used for econometrics and statistical modeling; for guided test selection with APA reporting, see statistical-analysis.
allowed-tools: Read Write Edit Bash
compatibility: Requires Python 3.10+ and statsmodels 0.15.0; the tested NumPy 2.5.3/SciPy 1.18.1 stack needs Python 3.12+. Plotting needs matplotlib; predictive metrics need scikit-learn. Network access is needed only for installation or documentation; no credentials.
license: BSD-3-Clause license
metadata:
  version: "1.5"
  last-reviewed: "2026-10-01"
  skill-author: K-Dense Inc.

Statsmodels: Statistical Modeling and Econometrics

Overview

Statsmodels provides estimation, inference and diagnostics for regression, time series and econometric models. A successful fit establishes numerical execution; causal identification, calibrated uncertainty and model adequacy require a defensible study design and assumptions.

Current Compatibility

Reviewed against statsmodels 0.15.0 (released August 27, 2026). Native checks used Python 3.13, NumPy 2.5.3, SciPy 1.18.1, pandas 3.0.6, matplotlib 3.11.2 and scikit-learn 1.9.1. Install in a dedicated environment:

uv pip install statsmodels==0.15.0 numpy==2.5.3 scipy==1.18.1 pandas==3.0.6 matplotlib==3.11.2 scikit-learn==1.9.1

Use `statsmodels.api` and `statsmodels.formula.api` for stable high-level imports, and direct module imports when examples require newer or specialized classes such as `HurdleCountModel`.

The [review and source ledger](references/review.md) records API coverage and verification limits. The quick start is executable; topic references are contextual fragments requiring the named data and a matching model result. In 0.15, use `result_object=True` and named fields for ADF/KPSS and other transitioning tests; prefer `rng=` where statsmodels formerly accepted `seed` or `random_state`.

When to Use This Skill

This skill should be used when:

  • Fitting regression models (OLS, WLS, GLS, quantile regression)
  • Performing generalized linear modeling (logistic, Poisson, Gamma, etc.)
  • Analyzing discrete outcomes (binary, multinomial, count, ordinal)
  • Conducting time series analysis (ARIMA, SARIMAX, VAR, forecasting)
  • Running statistical tests and diagnostics
  • Testing model assumptions (heteroskedasticity, autocorrelation, normality)
  • Detecting outliers and influential observations
  • Comparing models (AIC/BIC, likelihood ratio tests)
  • Estimating causal effects
  • Producing publication-ready statistical tables and inference

Quick Start, Capabilities, and Model Selection

  • [references/quick_start_guide.md](references/quick_start_guide.md): minimal worked

examples for OLS, logistic regression, ARIMA, and GLM, and how to read the summary.

  • [references/modeling_capabilities.md](references/modeling_capabilities.md): linear

models, GLMs, discrete choice, time series, and the statistical tests and diagnostics.

  • [references/model_selection.md](references/model_selection.md): the R-style formula API

and model comparison.

  • Per-topic detail: [references/linear_models.md](references/linear_models.md),

[references/glm.md](references/glm.md), [references/discrete_choice.md](references/discrete_choice.md), [references/time_series.md](references/time_series.md), and [references/stats_diagnostics.md](references/stats_diagnostics.md).

statsmodels supports inference and prediction, including forecasting. Match validation to the sampling design: grouped splits for repeated units, chronological splits for time series, and preprocessing learned on training data only.

Best Practices

Data Preparation

1. **Specify the intercept**: Array OLS/GLM/Logit need an explicit constant; formula models include one by default. OrderedModel and ConditionalLogit must not receive a constant. 2. **Check for missing values**: For array-based models, use `missing="raise"` during construction to catch unexpected NaNs; the default `missing="none"` does not check and can yield all-NaN estimates. If dropping rows is justified, record retained row IDs and compare models on the same observations. Fit any imputation on training data only. 3. **Scale if needed**: Can improve conditioning and convergence; record units and estimate scaling on training data 4. **Encode categoricals**: Use formula API or manual dummy coding

Model Building

1. **Start simple**: Begin with basic model, add complexity as needed 2. **Check assumptions**: Test residuals, heteroskedasticity, autocorrelation 3. **Use appropriate model**: Match model to outcome type (binary→Logit, count→Poisson) 4. **Consider alternatives**: If assumptions violated, use robust methods or different model

Inference

1. **Report effect sizes**: Not just p-values 2. **Use robust SEs**: When heteroskedasticity or clustering present 3. **Multiple comparisons**: Correct when testing many hypotheses 4. **Confidence intervals**: Always report alongside point estimates

Model Evaluation

1. **Check residuals**: Plot residuals vs fitted, Q-Q plot 2. **Influence diagnostics**: Identify and investigate influential observations 3. **Out-of-sample validation**: Test on holdout set or cross-validate 4. **Compare models**: Use AIC/BIC only for comparable likelihoods on the same response and rows; regular nested-model LR tests need interior parameters and valid likelihood assumptions

Reporting

1. **Comprehensive summary**: Use `.summary()` for detailed output 2. **Document decisions**: Note transformations, excluded observations 3. **Interpret carefully**: Account for link functions (e.g., exp(β) for log link) 4. **Visualize**: Plot predictions, confidence intervals, diagnostics

Common Workflows

Workflow 1: Linear Regression Anal

Read more
@k-dense-ai
Ships withscientific-agent-skills

🔔 Claude Scientific Skills is now Scientific Agent Skills. Same skills, broader compatibility — now works with any AI agent that supports the open Agent Skills standard, not just Claude.

Stars on GitHub

Momentum

stars in total
55.6k
Star history of K-Dense-AI/scientific-agent-skills on GitHub, a chart by star-history.com

Other skills on scientific-agent-skills.

More skills from other plugins.

context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,…

mem04d69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and an…

posthog10d41k
@posthog@posthogInstall Skill
qmd

qmd

Search local markdown knowledge bases, notes, docs, and wikis with QMD. Use when users ask to find notes, retrieve documents,…

qmd3w31k
@tobi@tobiInstall Skill

Questions about statsmodels.

Which coding agents can use statsmodels?
statsmodels installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.