Agent skill · Testing & QA

statsmodels

Statistical models library for Python. Use when you need specific model classes (OLS, GLM, mixed models, ARIMA) with detailed diagnostics, residuals, and inference. Best for econometrics, time series, rigorous inference with coefficient tables. For guided statistical test selection with APA reporting use statistical-analysis.

LeonChaoXgithub.com/LeonChaoXGitHub ↗
claude-codeMIT
Install
npx skills add LeonChaoX/qinyan-academic-skills --skill statsmodels --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 6
SKILL.md size: 19 KB
Bundled scripts: none
Path: skills/11-数据分析与统计建模/statsmodels/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 759
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Describes a Python-based statistical modeling toolkit that provides specific model classes (OLS, GLM, mixed models, ARIMA) with diagnostics, residuals, and inference capabilities. It targets econometrics, time series, and rigorous coefficient-based analysis, and supports guided test selection and APA-style reporting.

How it works

Outlines a broad set of modeling capabilities and concrete usage patterns:

  • Linear Regression: OLS, WLS, GLS, GLSAR, Quantile Regression, Mixed Effects, Recursive/Rolling; includes diagnostics, robust SEs, influence measures, hypothesis tests, model comparison, and prediction with intervals.
  • Generalized Linear Models: families (Binomial, Poisson, Negative Binomial, Gamma, Inverse Gaussian, Gaussian, Tweedie) with IRLS estimation, residuals, goodness-of-fit, pseudo R-squared, and robust SEs.
  • Discrete Choice: Logit, Probit, MNLogit, Conditional Logit, Ordered Model, Poisson, Negative Binomial, Zero-Inflated, Hurdle; with marginal effects, predicted probabilities, and model evaluation.
  • Time Series: univariate (AR, ARIMA, SARIMAX, Exponential Smoothing, ETS) and multivariate (VAR, VARMAX, Dynamic Factor Models, VECM); includes identification, forecasting with intervals, and residual diagnostics.
  • GLMs and Diagnostics: Poisson modeling with rate ratios, overdispersion checks, and fallback to Negative Binomial if needed.
  • Formula API: supports R-style formulas for OLS, Logit, Poisson, etc., with automatic handling of categoricals and interactions.
  • Model Selection: AIC/BIC, likelihood ratio tests, cross-validation, and information criteria comparisons.

The skill provides example code blocks for common models and workflows, including data prep, fitting, prediction, and basic diagnostics.

When to use it

Use for fitting regression models (OLS, WLS, GLS, quantile), GLMs, discrete outcomes, time series models, and for performing tests and diagnostics, with an emphasis on inference, diagnostics, and publication-ready results.

What it can touch

Commands and APIs include:

  • sm.add_constant(...) to add intercept
  • sm.OLS(...), Logit(...), sm.GLM(...), ARIMA(...), and other model classes
  • results.summary(), results.params, results.pvalues, results.aic, results.bic, results.llf, results.get_prediction(...), results.get_margeff()
  • smf.ols(...), smf.logit(...), smf.poisson(...) from the Formula API
  • Diagnostics functions like plot_acf, plot_pacf, adfuller, and tests such as Breusch-Pagan, Ljung-Box

Limitations and specifics are described in the sections under each modeling area rather than implicit.

Caveats

License is BSD-3-Clause; the skill notes robust standard errors, potential need for model-specific adjustments (e.g., overdispersion in Poisson prompting Negative Binomial alternative), and reliance on formula APIs and diagnostics. No outcomes guaranteed; emphasizes appropriate model selection, diagnostics, and reporting.

From the SKILL.md

# Statsmodels: Statistical Modeling and Econometrics ## Overview Statsmodels is Python's premier library for statistical modeling, providing tools for estimation, inference, and diagnostics across a wide range of statistical methods. Apply this skill for rigorous statistical analysis, from simple linear regression to complex time series models and econometric analyses. ## 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 Guide ### Linear Regression (OLS) ```python import statsmodels.api as sm import numpy as np import pandas as pd # Prepare data - ALWAYS add constant for intercept X

What's inside
Steps it walks through
  1. Overview
  2. When to Use This Skill
  3. Quick Start Guide
  4. Linear Regression (OLS)
  5. Logistic Regression (Binary Outcomes)
  6. Time Series (ARIMA)
  7. Generalized Linear Models (GLM)
  8. Core Statistical Modeling Capabilities
  9. 1. Linear Regression Models
  10. 2. Generalized Linear Models (GLM)
  11. 3. Discrete Choice Models
  12. 4. Time Series Analysis
  13. 5. Statistical Tests and Diagnostics
  14. Formula API (R-style)
Ships with 5 files
  • references/discrete_choice.md
  • references/glm.md
  • references/linear_models.md
  • references/stats_diagnostics.md
  • references/time_series.md
Commands it runs
Find information about specific models
grep -r "Quantile Regression" references/
Find diagnostic tests
grep -r "Breusch-Pagan" references/stats_diagnostics.md
Find time series guidance
grep -r "SARIMAX" references/time_series.md
More from qinyan-academic-skills
All skills →
About this skill
What does the statsmodels skill do?

Statistical models library for Python. Use when you need specific model classes (OLS, GLM, mixed models, ARIMA) with detailed diagnostics, residuals, and inference. Best for econometrics, time series, rigorous inference with coefficient tables. For guided statistical test selection with APA reporting use statistical-analysis.

How do I install it?

Run `npx skills add LeonChaoX/qinyan-academic-skills --skill statsmodels --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From LeonChaoX/qinyan-academic-skills, a repository with 759 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going