Skill Tracer
Skills › Scientific Agent Skills › statsmodels › modeling_capabilities.md

modeling_capabilities.md

168 lines · skills/statsmodels/references/modeling_capabilities.md at 5f2bc03

Open on GitHub
1# Core Statistical Modeling Capabilities
2
3Linear models, generalized linear models, discrete choice models, time series analysis,
4and statistical tests and diagnostics — what statsmodels offers in each area and which
5class to use.
6

Core Statistical Modeling Capabilities

Linear models, generalized linear models, discrete choice models, time series analysis, and statistical tests and diagnostics — what statsmodels offers in each area and which class to use.

Raw lines 1 to 6
7## Core Statistical Modeling Capabilities
8

Core Statistical Modeling Capabilities

Raw lines 7 to 8
9### 1. Linear Regression Models
11Comprehensive suite of linear models for continuous outcomes with various error structures.
13**Available models:**
14- **OLS**: Standard linear regression with i.i.d. errors
15- **WLS**: Weighted least squares for heteroskedastic errors
16- **GLS**: Generalized least squares for arbitrary covariance structure
17- **GLSAR**: GLS with autoregressive errors for time series
18- **Quantile Regression**: Conditional quantiles (median fits reduce response-outlier sensitivity, not high-leverage bias)
19- **Mixed Effects**: Hierarchical/multilevel models with random effects
20- **Recursive/Rolling**: Expanding-window or rolling-window coefficient estimates
22**Key features:**
23- Comprehensive diagnostic tests
24- Robust standard errors (HC, HAC, cluster-robust)
25- Influence statistics (Cook's distance, leverage, DFFITS)
26- Hypothesis testing (F-tests, Wald tests)
27- Model comparison (AIC, BIC, likelihood ratio tests)
28- Prediction with confidence and prediction intervals
30**When to use:** Continuous outcome variable, want inference on coefficients, need diagnostics
32**Reference:** See `references/linear_models.md` for detailed guidance on model selection, diagnostics, and best practices.

1. Linear Regression Models

Comprehensive suite of linear models for continuous outcomes with various error structures.

Available models:

  • OLS: Standard linear regression with i.i.d. errors
  • WLS: Weighted least squares for heteroskedastic errors
  • GLS: Generalized least squares for arbitrary covariance structure
  • GLSAR: GLS with autoregressive errors for time series
  • Quantile Regression: Conditional quantiles (median fits reduce response-outlier sensitivity, not high-leverage bias)
  • Mixed Effects: Hierarchical/multilevel models with random effects
  • Recursive/Rolling: Expanding-window or rolling-window coefficient estimates

Key features:

  • Comprehensive diagnostic tests
  • Robust standard errors (HC, HAC, cluster-robust)
  • Influence statistics (Cook's distance, leverage, DFFITS)
  • Hypothesis testing (F-tests, Wald tests)
  • Model comparison (AIC, BIC, likelihood ratio tests)
  • Prediction with confidence and prediction intervals

When to use: Continuous outcome variable, want inference on coefficients, need diagnostics

Reference: See references/linear_models.md for detailed guidance on model selection, diagnostics, and best practices.

Raw lines 9 to 33
34### 2. Generalized Linear Models (GLM)
36Flexible framework extending linear models to non-normal distributions.
38**Distribution families:**
39- **Binomial**: Binary outcomes or proportions (logistic regression)
40- **Poisson**: Count data
41- **Negative Binomial**: Overdispersed counts
42- **Gamma**: Positive continuous, right-skewed data
43- **Inverse Gaussian**: Positive continuous with specific variance structure
44- **Gaussian**: Identity link with unweighted independent errors reproduces OLS coefficients
45- **Tweedie**: Flexible family for semi-continuous data
47**Link functions:**
48- Logit, Probit, Log, Identity, Inverse, Sqrt, CLogLog, Power
49- Choose based on interpretation needs and model fit
51**Key features:**
52- Maximum likelihood estimation via IRLS
53- Deviance and Pearson residuals
54- Goodness-of-fit statistics
55- Pseudo R-squared measures
56- Robust standard errors
58**When to use:** A response mechanism and conditional mean/variance structure call for a GLM family and link. Marginal non-normality alone is not the criterion.
60**Reference:** See `references/glm.md` for family selection, link functions, interpretation, and diagnostics.

2. Generalized Linear Models (GLM)

Flexible framework extending linear models to non-normal distributions.

Distribution families:

  • Binomial: Binary outcomes or proportions (logistic regression)
  • Poisson: Count data
  • Negative Binomial: Overdispersed counts
  • Gamma: Positive continuous, right-skewed data
  • Inverse Gaussian: Positive continuous with specific variance structure
  • Gaussian: Identity link with unweighted independent errors reproduces OLS coefficients
  • Tweedie: Flexible family for semi-continuous data

Link functions:

  • Logit, Probit, Log, Identity, Inverse, Sqrt, CLogLog, Power
  • Choose based on interpretation needs and model fit

Key features:

  • Maximum likelihood estimation via IRLS
  • Deviance and Pearson residuals
  • Goodness-of-fit statistics
  • Pseudo R-squared measures
  • Robust standard errors

When to use: A response mechanism and conditional mean/variance structure call for a GLM family and link. Marginal non-normality alone is not the criterion.

Reference: See references/glm.md for family selection, link functions, interpretation, and diagnostics.

Raw lines 34 to 61
62### 3. Discrete Choice Models
64Models for categorical and count outcomes.
66**Binary models:**
67- **Logit**: Logistic regression (odds ratios)
68- **Probit**: Probit regression (normal distribution)
70**Multinomial models:**
71- **MNLogit**: Unordered categories (3+ levels)
72- **Conditional Logit**: Group-conditioned binary likelihood with no explicit intercept; choice sets define groups
73- **Ordered Model**: Ordinal outcomes (ordered categories)
75**Count models:**
76- **Poisson**: Standard count model
77- **Negative Binomial**: Overdispersed counts
78- **Zero-Inflated**: Excess zeros (ZIP, ZINB)
79- **Hurdle Models**: Two-stage models for zero-heavy data
81**Key features:**
82- Maximum likelihood estimation
83- Marginal effects at means or average marginal effects
84- Model comparison via AIC/BIC
85- Predicted probabilities and classification
86- Goodness-of-fit tests
88**When to use:** Binary, categorical, or count outcomes
90**Reference:** See `references/discrete_choice.md` for model selection, interpretation, and evaluation.

3. Discrete Choice Models

Models for categorical and count outcomes.

Binary models:

  • Logit: Logistic regression (odds ratios)
  • Probit: Probit regression (normal distribution)

Multinomial models:

  • MNLogit: Unordered categories (3+ levels)
  • Conditional Logit: Group-conditioned binary likelihood with no explicit intercept; choice sets define groups
  • Ordered Model: Ordinal outcomes (ordered categories)

Count models:

  • Poisson: Standard count model
  • Negative Binomial: Overdispersed counts
  • Zero-Inflated: Excess zeros (ZIP, ZINB)
  • Hurdle Models: Two-stage models for zero-heavy data

Key features:

  • Maximum likelihood estimation
  • Marginal effects at means or average marginal effects
  • Model comparison via AIC/BIC
  • Predicted probabilities and classification
  • Goodness-of-fit tests

When to use: Binary, categorical, or count outcomes

Reference: See references/discrete_choice.md for model selection, interpretation, and evaluation.

Raw lines 62 to 91
92### 4. Time Series Analysis
94Comprehensive time series modeling and forecasting capabilities.
96**Univariate models:**
97- **AutoReg (AR)**: Autoregressive models
98- **ARIMA**: Autoregressive integrated moving average
99- **SARIMAX**: Seasonal ARIMA with exogenous variables
100- **Exponential Smoothing**: Simple, Holt, Holt-Winters
101- **ETS**: Innovations state space models
103**Multivariate models:**
104- **VAR**: Vector autoregression
105- **VARMAX**: VAR with MA and exogenous variables
106- **Dynamic Factor Models**: Extract common factors
107- **VECM**: Vector error correction models (cointegration)
109**Advanced models:**
110- **State Space**: Kalman filtering, custom specifications
111- **Regime Switching**: Markov switching models
112- **ARDL**: Autoregressive distributed lag
114**Key features:**
115- ACF/PACF analysis for model identification
116- Stationarity tests (ADF, KPSS)
117- Forecasting with prediction intervals
118- Residual diagnostics (Ljung-Box, heteroskedasticity)
119- Granger causality testing
120- Impulse response functions (IRF)
121- Forecast error variance decomposition (FEVD)
123**When to use:** Time-ordered data, forecasting, understanding temporal dynamics
125**Reference:** See `references/time_series.md` for model selection, diagnostics, and forecasting methods.

4. Time Series Analysis

Comprehensive time series modeling and forecasting capabilities.

Univariate models:

  • AutoReg (AR): Autoregressive models
  • ARIMA: Autoregressive integrated moving average
  • SARIMAX: Seasonal ARIMA with exogenous variables
  • Exponential Smoothing: Simple, Holt, Holt-Winters
  • ETS: Innovations state space models

Multivariate models:

  • VAR: Vector autoregression
  • VARMAX: VAR with MA and exogenous variables
  • Dynamic Factor Models: Extract common factors
  • VECM: Vector error correction models (cointegration)

Advanced models:

  • State Space: Kalman filtering, custom specifications
  • Regime Switching: Markov switching models
  • ARDL: Autoregressive distributed lag

Key features:

  • ACF/PACF analysis for model identification
  • Stationarity tests (ADF, KPSS)
  • Forecasting with prediction intervals
  • Residual diagnostics (Ljung-Box, heteroskedasticity)
  • Granger causality testing
  • Impulse response functions (IRF)
  • Forecast error variance decomposition (FEVD)

When to use: Time-ordered data, forecasting, understanding temporal dynamics

Reference: See references/time_series.md for model selection, diagnostics, and forecasting methods.

Raw lines 92 to 126
127### 5. Statistical Tests and Diagnostics
129Extensive testing and diagnostic capabilities for model validation.
131**Residual diagnostics:**
132- Autocorrelation tests (Ljung-Box, Durbin-Watson, Breusch-Godfrey)
133- Heteroskedasticity tests (Breusch-Pagan, White, ARCH)
134- Normality tests (Jarque-Bera, Omnibus, Anderson-Darling, Lilliefors)
135- Specification tests (RESET, Harvey-Collier)
137**Influence and outliers:**
138- Leverage (hat values)
139- Cook's distance
140- DFFITS and DFBETAs
141- Studentized residuals
142- Influence plots
144**Hypothesis testing:**
145- t-tests (one-sample, two-sample, paired)
146- Proportion tests
147- Chi-square tests
148- Non-parametric tests (Mann-Whitney, Wilcoxon, Kruskal-Wallis)
149- ANOVA (one-way, two-way, repeated measures)
151**Multiple comparisons:**
152- Tukey's HSD
153- Bonferroni correction
154- False Discovery Rate (FDR)
156**Effect sizes and power:**
157- Cohen's d, eta-squared
158- Power analysis for t-tests, proportions
159- Sample size calculations
161**Robust inference:**
162- Heteroskedasticity-consistent SEs (HC0-HC3)
163- HAC standard errors (Newey-West)
164- Cluster-robust standard errors
166**When to use:** Investigating assumptions and sensitivity. Diagnostic test non-rejection and robust standard errors do not establish scientific validity.
168**Reference:** See `references/stats_diagnostics.md` for comprehensive testing and diagnostic procedures.

5. Statistical Tests and Diagnostics

Extensive testing and diagnostic capabilities for model validation.

Residual diagnostics:

  • Autocorrelation tests (Ljung-Box, Durbin-Watson, Breusch-Godfrey)
  • Heteroskedasticity tests (Breusch-Pagan, White, ARCH)
  • Normality tests (Jarque-Bera, Omnibus, Anderson-Darling, Lilliefors)
  • Specification tests (RESET, Harvey-Collier)

Influence and outliers:

  • Leverage (hat values)
  • Cook's distance
  • DFFITS and DFBETAs
  • Studentized residuals
  • Influence plots

Hypothesis testing:

  • t-tests (one-sample, two-sample, paired)
  • Proportion tests
  • Chi-square tests
  • Non-parametric tests (Mann-Whitney, Wilcoxon, Kruskal-Wallis)
  • ANOVA (one-way, two-way, repeated measures)

Multiple comparisons:

  • Tukey's HSD
  • Bonferroni correction
  • False Discovery Rate (FDR)

Effect sizes and power:

  • Cohen's d, eta-squared
  • Power analysis for t-tests, proportions
  • Sample size calculations

Robust inference:

  • Heteroskedasticity-consistent SEs (HC0-HC3)
  • HAC standard errors (Newey-West)
  • Cluster-robust standard errors

When to use: Investigating assumptions and sensitivity. Diagnostic test non-rejection and robust standard errors do not establish scientific validity.

Reference: See references/stats_diagnostics.md for comprehensive testing and diagnostic procedures.

Raw lines 127 to 168