Methods
One page per method family: what the estimator does, the OpenEconometrics function and the Stata command it corresponds to, the options it supports, a runnable example with its real output, its limitations and the papers behind it.
Linear models and IV
Least squares, instrumental variables, systems of equations and quantile regression.
-
Linear models and IV
OLS regression in Python with robust and clustered standard errors
Fit OLS and weighted least squares in Python with HC0–HC3, clustered or HAC standard errors, then run tests, linear combinations and margins.
-
Linear models and IV
Instrumental variables in Python: 2SLS, LIML and GMM
Estimate instrumental-variables regressions in Python with 2SLS, LIML or GMM, read the weak-instrument and overidentification tests, and map them to ivregress.
-
Linear models and IV
Quantile regression in Python: qreg, bootstrap and simultaneous quantiles
Estimate median and other conditional quantiles in Python with qreg, bsqreg and sqreg, and test whether a slope differs across the distribution.
-
Linear models and IV
SUR regression and three-stage least squares in Python
Estimate seemingly unrelated regressions and simultaneous-equation systems by three-stage least squares in Python, with cross-equation tests and constraints.
Panel data
Fixed and random effects, absorbed fixed effects, dynamic panels and multilevel models.
-
Panel data
Fixed effects and random effects regression in Python (xtreg)
Fit fixed-effects, random-effects, between, first-difference and pooled panel regressions in Python with clustered or Driscoll–Kraay standard errors.
-
Panel data
reghdfe in Python: regression with high-dimensional fixed effects
Absorb several high-dimensional fixed effects in a linear regression in Python, with singleton removal, exact degrees of freedom and clustered errors.
-
Panel data
Arellano–Bond and system GMM in Python: xtabond and xtabond2
Estimate dynamic panel models in Python with Arellano–Bond difference GMM and Blundell–Bond system GMM, Windmeijer errors and AR(2) and Hansen tests.
-
Panel data
Mixed effects and multilevel models in Python: random intercepts and slopes
Fit linear mixed-effects (multilevel) models in Python by ML or REML, with random intercepts and slopes, nested levels, the ICC and BLUP predictions.
Causal inference
Difference-in-differences, event studies, regression discontinuity, treatment effects and synthetic control.
-
Causal inference
Difference-in-differences in Python: didregress and parallel trends
Estimate a two-way fixed-effects difference-in-differences model in Python, cluster by group, test parallel trends and map it to Stata's didregress.
-
Causal inference
Staggered difference-in-differences in Python: Callaway–Sant'Anna csdid
Estimate Callaway–Sant'Anna group-time ATTs for staggered adoption in Python, aggregate them by event time and see why a two-way fixed-effects DiD can mislead.
-
Causal inference
Event study regression in Python: leads, lags and pre-trend tests
Fit a two-way fixed-effects event study in Python, choose the leads, lags and reference period, test pre-trends and tabulate the dynamic effects.
-
Causal inference
Regression discontinuity in Python: rdrobust with robust bias correction
Estimate sharp and fuzzy regression discontinuity designs in Python with local polynomials, optimal bandwidths and robust bias-corrected intervals.
-
Causal inference
Treatment effects in Python: propensity score matching, IPW and AIPW
Estimate ATE and ATET in Python by regression adjustment, inverse probability weighting, doubly robust AIPW or matching, and map each to Stata's teffects.
-
Causal inference
Synthetic control in Python: donor weights, placebos and synthetic DiD
Estimate a synthetic control for one treated unit in Python, read its donor weights and placebo p-value, and compare it with synthetic DiD.
Limited and duration outcomes
Binary, ordered, multinomial, count, censored, selected and survival outcomes.
-
Limited and duration outcomes
Logit and probit regression in Python with marginal effects
Fit logit and probit models in Python, compute average marginal effects with oe.margins, and map the workflow to Stata's logit, probit and margins.
-
Limited and duration outcomes
Ordered logit, ordered probit and multinomial logit in Python
Fit ordered logit, ordered probit and multinomial logit models in Python, read cutpoints and category probabilities, and map them to ologit and mlogit.
-
Limited and duration outcomes
Poisson regression, negative binomial and PPML gravity models in Python
Fit Poisson and negative binomial count models and PPML gravity regressions with fixed effects in Python, and map them to poisson, nbreg and ppmlhdfe.
-
Limited and duration outcomes
Tobit model and truncated regression in Python
Estimate Tobit models for censored outcomes and truncated regressions in Python, compute their marginal effects, and map them to Stata's tobit and truncreg.
-
Limited and duration outcomes
Heckman selection model in Python: ML and two-step estimation
Correct for sample selection bias in Python with the Heckman model, by maximum likelihood or Heckman's two-step estimator, and test whether rho is zero.
-
Limited and duration outcomes
Survival analysis in Python: Cox proportional hazards, stcox and streg
Fit Cox proportional hazards and Weibull or other parametric survival models in Python, test proportional hazards, and map them to Stata's stcox and streg.
Time series
ARIMA, vector autoregressions, volatility models, unit roots and cointegration.
-
Time series
ARIMA in Python: ARIMA, seasonal ARIMA and ARMAX models
Fit ARIMA, seasonal ARIMA and regression models with ARMA errors in Python by exact maximum likelihood, check the residuals and forecast.
-
Time series
VAR and vector error correction models (VECM) in Python
Fit vector autoregressions and Johansen error-correction models in Python, with lag selection, Granger causality tests, impulse responses and forecasts.
-
Time series
GARCH models in Python: ARCH, GARCH, GJR and EGARCH
Estimate ARCH, GARCH, GJR and EGARCH volatility models in Python by maximum likelihood, with Student-t errors, residual diagnostics and variance forecasts.
-
Time series
Unit root tests in Python: ADF, KPSS, Phillips–Perron and DF-GLS
Run augmented Dickey–Fuller, Phillips–Perron, DF-GLS, KPSS and Zivot–Andrews tests in Python and read their statistics, critical values and p-values.
-
Time series
Cointegration in Python: ARDL bounds test, Engle–Granger and Johansen
Test for cointegration in Python with Engle–Granger and Johansen tests, and fit ARDL models with the bounds test and error-correction form.
Tests and inference
Specification tests, bootstrap inference with few clusters and corrections for many tests.
-
Tests and inference
Hausman test in Python: fixed or random effects?
Run the Hausman test of fixed against random effects in Python, read what it does and does not show, and use the cluster-robust Mundlak alternative.
-
Tests and inference
Wild cluster bootstrap in Python: a boottest workflow for few clusters
Run restricted wild cluster bootstrap tests and confidence sets in Python when there are few clusters, the workflow of the boottest command in Stata.
-
Tests and inference
Multiple testing correction in Python: Holm, BH and Romano–Wolf
Adjust p-values for multiple hypotheses in Python with Bonferroni, Holm, Benjamini–Hochberg or the Romano–Wolf stepdown, and choose between FWER and FDR.
Find a method by Stata command
Each Stata command named in the capability inventory, with the OpenEconometrics function and the page that explains it. The names identify a workflow; they are not a claim of numerical parity.