skillfed

statsmodels

Statsmodels is Python's statistical modeling library for fitting regression, generalized linear, time series, and discrete outcome models with full inference capabilities. It delivers detailed diagnostics, residuals analysis, hypothesis tests, and publication-ready output—ideal when coefficients and their uncertainty matter more than prediction alone.

Statsmodels fits regression models with detailed statistical inference, diagnostics, and publication-ready tables for econometrics and time series analysis.

AI-generated summary based on this skill's SKILL.md

31,940 3,173 MIT updated by K-Dense-AI

Install

K-Dense-AI/scientific-agent-skills/statsmodels · repository language: Python

CLI (skillfed)coming soon
git clone https://github.com/K-Dense-AI/scientific-agent-skills
cp -r scientific-agent-skills/skills/statsmodels ~/.claude/skills/statsmodels

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is statsmodels OLS regression and how do I use it?

Statsmodels is Python's statistical modeling library that provides OLS (ordinary least squares) regression for fitting linear models with full statistical inference. Use statsmodels when you need detailed coefficient estimates, standard errors, confidence intervals, and hypothesis tests—not just predictions. The library outputs publication-quality tables showing t-statistics, p-values, and model fit diagnostics automatically.

How do I fit an ARIMA time series model with statsmodels?

Statsmodels includes ARIMA and SARIMAX classes for time series modeling and forecasting. You specify (p,d,q) orders for ARIMA or add seasonal components for SARIMAX. The library handles differencing, lag selection, and produces forecasts with confidence intervals. It also provides residual diagnostics to validate that your model captures temporal structure properly.

How can I check model assumptions with statsmodels?

Statsmodels provides rigorous diagnostic tools to test statistical assumptions: residual plots, normality tests, heteroskedasticity tests, autocorrelation tests (Durbin-Watson, Ljung-Box), and influence diagnostics. After fitting any model, access these diagnostics through the results object to verify linearity, constant variance, independence, and normality before trusting your inference.

Does statsmodels support generalized linear models and count data?

Yes. Statsmodels' GLM class fits generalized linear models including logistic regression, Poisson regression for count data, negative binomial regression, and more. You specify the family (Binomial, Poisson, NegativeBinomial) and link function. Each model produces full inference: coefficients, standard errors, confidence intervals, and hypothesis tests for publication.

Can statsmodels handle mixed effects and clustered data?

Statsmodels supports mixed effects models through its MixedLM class for random intercepts and slopes. For clustered standard errors without random effects, use robust covariance estimators with clustering options in OLS and GLM. This accounts for within-group correlation and produces valid inference when observations are not independent.

What makes statsmodels different from scikit-learn for regression?

Statsmodels prioritizes statistical inference and diagnostics over prediction accuracy. It provides p-values, confidence intervals, hypothesis tests, and detailed model diagnostics—essential for research and causal analysis. Scikit-learn focuses on predictive performance. Choose statsmodels when coefficients and their uncertainty are your goal; choose scikit-learn for pure prediction tasks.

SKILL.md

rendered from the published skill — quoted content, verbatim

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.

Current Compatibility

Examples target statsmodels 0.14.6, released Dec 5, 2025. For reproducible environments, pin the primary

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 9 files
skills/statsmodels/SKILL.md
skills/statsmodels/references/discrete_choice.md
skills/statsmodels/references/glm.md
skills/statsmodels/references/linear_models.md
skills/statsmodels/references/model_selection.md
skills/statsmodels/references/modeling_capabilities.md
skills/statsmodels/references/quick_start_guide.md
skills/statsmodels/references/stats_diagnostics.md
skills/statsmodels/references/time_series.md

Related skills

Tags

econometrics-toolkit inference-focused time-series-modeling diagnostic-testing coefficient-interpretation hypothesis-testing assumption-checking publication-ready-output