skillfed

statsmodels-stats

statsmodels-stats provides regression modeling, hypothesis testing, and time series analysis for statistical workflows. Build OLS, logistic, and generalized linear models; run t-tests, ANOVA, and proportion tests; fit ARIMA and VAR models; and perform survival analysis with diagnostic plots and rigorous statistical reporting.

statsmodels-stats performs linear, logistic, and generalized regression modeling with comprehensive statistical testing.

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

869 101 MIT updated by beita6969

Install

beita6969/ScienceClaw/statsmodels-stats · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/beita6969/ScienceClaw
cp -r ScienceClaw/skills/statsmodels-stats ~/.claude/skills/statsmodels-stats

Frequently asked questions

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

How do I do linear regression in Python with statsmodels-stats?

statsmodels-stats provides OLS (Ordinary Least Squares) regression through its regression module. Import `statsmodels.api`, prepare your data with predictors and a response variable, fit the model using `OLS()`, and call `.fit()` to obtain coefficients, p-values, confidence intervals, and diagnostic statistics. The results object includes summary tables, R-squared, and residual plots for model validation.

What hypothesis tests does statsmodels-stats support?

statsmodels-stats supports t-tests, ANOVA, chi-squared tests, proportion tests, and multiple comparison corrections including FDR. Use `ttest_ind()` for independent samples, `f_oneway()` for ANOVA, and `chi2_contingency()` for categorical data. The library reports p-values, test statistics, and confidence intervals to assess statistical significance rigorously across your analyses.

How can I forecast time series with statsmodels-stats using ARIMA?

statsmodels-stats includes ARIMA and seasonal decomposition tools. Use `ARIMA(data, order=(p,d,q))` to specify autoregressive, differencing, and moving-average components, then call `.fit()` and `.get_forecast()` to generate predictions. Select model order via AIC/BIC criteria, test for stationarity with ADF or KPSS tests, and validate assumptions through diagnostic plots.

What diagnostic plots can statsmodels-stats generate for residuals?

statsmodels-stats produces QQ plots, residual-versus-fitted plots, scale-location plots, and influence diagnostics to validate model assumptions. Call `.plot_diagnostics()` on time series models or access residual plots from regression results. These plots help detect non-normality, heteroscedasticity, autocorrelation, and influential outliers in your fitted models.

Does statsmodels-stats support logistic and generalized linear models?

Yes. statsmodels-stats provides logistic regression via `Logit()` and generalized linear models through `GLM()` with configurable link functions and distributions. Fit models, extract marginal effects, compute odds ratios, and report effect sizes and confidence intervals. Robust regression and weighted least squares (WLS) are also available for handling heteroscedasticity and outliers.

Can statsmodels-stats perform survival analysis and VAR modeling?

statsmodels-stats includes Cox proportional hazards regression for survival analysis and vector autoregression (VAR) for multivariate time series. VAR models capture dynamic relationships across multiple series; fit with `VAR(data).fit()` and generate impulse responses and forecasts. Both methods provide diagnostic tools and statistical inference for complex temporal and event-time data.

SKILL.md

rendered from the published skill — quoted content, verbatim

Statsmodels Statistical Analysis

Statistical modeling, hypothesis testing, and time series analysis using statsmodels and pandas.

When to Use

  • Linear regression (OLS, GLS, WLS, robust)
  • Logistic regression and generalized linear models
  • Hypothesis testing (t-tests, ANOVA, chi-squared)
  • Time series analysis (ARIMA, VAR, seasonal decomposition)
  • Survival analysis and diagnostic plots

When NOT to Use

  • Machine learning classification/regression (use scikit-learn)
  • Deep learning or neural networks (use PyTorch/TensorFlow)
  • Simple descriptive statistics only (use scipy-analysis)

OLS / GLS / WLS Regression

```python import statsmodels.api as sm import statsmodels.formula.api as smf

model = smf.ols('y ~ x1 + x2 + x1:x2', data=df).fit() print(model.summary())

Matrix interface

X =

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

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
skills/statsmodels-stats/SKILL.md

Related skills

Tags

statistical-inference regression-modeling hypothesis-testing time-series-forecasting assumption-checking effect-size-reporting model-diagnostics robust-methods causal-inference