skillfed

statsmodels

Statsmodels delivers rigorous statistical modeling for regression, generalized linear models, time series, and discrete outcomes. Access comprehensive diagnostics, robust standard errors, influence statistics, and publication-quality inference tables. Ideal for econometrics, causal estimation, and hypothesis testing.

Statsmodels fits regression models with comprehensive statistical inference, diagnostics, and publication-ready tables.

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

2,896 403 Apache-2.0 updated by synthetic-sciences

Install

synthetic-sciences/openscience/statsmodels · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/synthetic-sciences/openscience
cp -r openscience/backend/cli/skills/coding/statsmodels ~/.claude/skills/statsmodels

Frequently asked questions

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

How do I fit an OLS regression model with statsmodels?

Statsmodels provides the OLS class for ordinary least squares regression with detailed statistical inference. Import `statsmodels.api`, prepare your data with an intercept column, instantiate `OLS(y, X)`, call `.fit()`, and access the results object for coefficients, standard errors, t-statistics, p-values, and confidence intervals via `.summary()`. The results include R-squared, F-statistics, and diagnostic information for publication-quality reporting.

What's the best way to fit ARIMA time series models?

Statsmodels' ARIMA class enables time series forecasting with autoregressive, integrated, and moving average components. Specify (p, d, q) parameters, fit the model with `.fit()`, and generate forecasts using `.get_forecast()` or `.fittedvalues`. Statsmodels handles differencing, lag selection diagnostics, and residual analysis to validate stationarity and model assumptions before deployment.

How can I perform logistic regression for binary outcomes?

Statsmodels' Logit class handles binary outcomes with maximum likelihood estimation. Build your model with `Logit(y, X)`, fit it, and extract marginal effects, odds ratios, and classification metrics from the results. The framework supports robust standard errors, clustering adjustments, and detailed coefficient tables suitable for econometric and epidemiological applications.

How do I test for heteroskedasticity and validate residual diagnostics?

Statsmodels offers comprehensive diagnostic tools including Breusch-Pagan and White tests for heteroskedasticity, Durbin-Watson for autocorrelation, and influence statistics (leverage, Cook's distance). Access these via the results object's `.get_robustcov_results()` for robust covariance, `.resid_pearson` for standardized residuals, and plotting functions for visual assumption validation.

Can statsmodels handle count data like Poisson and negative binomial?

Yes. Statsmodels' GLM framework supports Poisson regression for count outcomes and NegativeBinomial for overdispersed data. Zero-inflated variants (ZeroInflatedPoisson, ZeroInflatedNegativeBinomial) model excess zeros. Fit with `.fit()`, inspect dispersion parameters, and extract marginal effects to quantify covariate impact on expected counts.

How do I compare models and select the best fit using information criteria?

Statsmodels reports AIC and BIC in all results summaries for model comparison. Lower values indicate better fit; use these criteria alongside likelihood ratio tests to rank competing specifications. The framework supports nested and non-nested comparisons, enabling rigorous model selection for regression, GLM, and time series applications.

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.

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,

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

Read as markdown · JSON record · Browse the source repository

File tree — 6 files
backend/cli/skills/coding/statsmodels/SKILL.md
backend/cli/skills/coding/statsmodels/references/discrete_choice.md
backend/cli/skills/coding/statsmodels/references/glm.md
backend/cli/skills/coding/statsmodels/references/linear_models.md
backend/cli/skills/coding/statsmodels/references/stats_diagnostics.md
backend/cli/skills/coding/statsmodels/references/time_series.md

Related skills

Tags

econometric-inference time-series-forecasting regression-diagnostics causal-estimation count-data-modeling hierarchical-modeling publication-ready-tables robust-covariance model-diagnostics