data-analysis-statistical-modeling

Fit, diagnose, and interpret statistical models in Python with statsmodels.

Updated Jan 28, 2026
One-click install
npx skills add https://github.com/scanady/nexus-skills --skill data-analysis-statistical-modeling-scanady
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: data-analysis-statistical-modeling
Source: https://github.com/scanady/nexus-skills/tree/main/skills/data-analysis-statistical-modeling
Command: npx skills add https://github.com/scanady/nexus-skills --skill data-analysis-statistical-modeling-scanady

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires statsmodels, scipy, numpy, pandas, and includes references (resource) components.

What problem does it solve? Choosing the right regression model, validating its assumptions, and interpreting coefficients correctly is error-prone — analysts routinely fit OLS to binary outcomes, forget intercepts, ignore overdispersion, or misread log-scale coefficients. This Skill provides a rigorous statsmodels workflow that matches models to outcome types and validates assumptions before trusting any p-value. ## Core Features & Use Cases - Model Selection by Outcome Type: Decision tables map continuous, binary, ordinal, count, zero-inflated, and time-ordered outcomes to the correct statsmodels class (OLS, Logit, MNLogit, OrderedModel, Poisson, NegativeBinomial, GLM, ARIMA/SARIMAX, VAR). - Diagnostics and Inference: Residual assumption tests (Breusch-Pagan, Ljung-Box, Jarque-Bera), influence detection (Cook's D, leverage, DFFITS), multicollinearity checks (VIF), robust/HAC/cluster standard errors, and power analysis. - Correct Interpretation: Guidance for reading coefficients on the right scale — odds ratios for logit, rate ratios for Poisson, marginal effects for nonlinear models — plus AIC/BIC and likelihood-ratio model comparison. - Use Case: A data analyst needs to know whether a treatment significantly affects a binary outcome. The Skill guides them to fit a Logit model, check convergence, report odds ratios with confidence intervals, and compute marginal effects rather than misreading raw coefficients. ## Quick Start Fit a logistic regression of churn on tenure and monthly charges with statsmodels, check the residual diagnostics, and report the odds ratios with confidence intervals.

Frequently Asked Questions about data-analysis-statistical-modeling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a logistic regression in Python with statsmodels?▼

Use Logit from statsmodels.discrete.discrete_model with a constant added via sm.add_constant(X), then call fit(). Interpret np.exp(res.params) as odds ratios and use res.get_margeff() for marginal effects on probabilities.

How do I choose the right regression model for my outcome type?▼

Match the model to the outcome: OLS for continuous, Logit/Probit for binary, OrderedModel for ordinal, Poisson for counts, Negative Binomial for overdispersed counts, and ARIMA/SARIMAX for time-ordered data. Never fit OLS to binary or count outcomes.

Poisson vs Negative Binomial: which count model should I use?▼

Start with Poisson, then check overdispersion via the variance-to-mean ratio or Pearson dispersion above 1.5. If overdispersed, fit Negative Binomial and confirm with a likelihood-ratio test comparing the two fitted models.

Why are my statsmodels regression results missing an intercept?▼

The array API does not add an intercept automatically, so forgetting sm.add_constant(X) silently drops it and biases all coefficients. Use the formula API (statsmodels.formula.api) where the intercept is implicit.

How do I fix heteroskedasticity in OLS standard errors?▼

Keep the OLS point estimates and apply robust covariance with res.get_robustcov_results(cov_type="HC3"). For autocorrelated errors use cov_type="HAC" (Newey-West), and for grouped data use cov_type="cluster" with a groups argument.

When should I use ARIMA instead of exponential smoothing for forecasting?▼

Use ARIMA/SARIMAX when the series has autocorrelation structure you can identify via ACF/PACF after differencing to stationarity. Use ETS/ExponentialSmoothing for level-trend-seasonal patterns; always verify residuals are white noise with Ljung-Box.