Estimate an OLS model, optionally several nested or multi-outcome models at once.
A richer companion to :func:expdpy.analyze_regression_table: same OLS/fixed-effects core, but with stepwise nested-model comparison, serial-correlation-robust standard errors (Newey-West / Driscoll-Kraay), multiple outcomes and weights.
Wrap idvs in a stepwise sequence — "sw"/"sw0" (separate) or "csw"/"csw0" (cumulative) — to estimate nested models in one call and read them side by side (great for “watch the estimate move as I add controls”).
Standard-error type: "iid", "hetero"/"HC1" ("HC2"/"HC3" without fixed effects), "CRV1"/"CRV3" (cluster-robust, with cluster=), "NW"/"DK" (serial-correlation robust, with time_id=/panel_id=), a pyfixest-style {"CRV1": "firm"} mapping, or a :class:VCovSpec. Defaults to clustered SEs when cluster is given, else "iid".
Significance levels: * p < 0.05, ** p < 0.01, *** p < 0.001. Format of coefficient cell: Coefficient (Std. Error)
Advanced — a cumulative-stepwise comparison with heteroskedastic SEs:
import expdpy as exfrom expdpy.data import load_kuznets, load_kuznets_data_defdf = ex.set_labels(load_kuznets(), load_kuznets_data_def(), set_panel=True)res = ex.analyze_estimation( df, dv="gini_regional", idvs=["log_gdp_pc", "log_gdp_pc_sq", "log_gdp_pc_cu"], stepwise="csw", vcov="hetero",)res.etable # three nested models side by sideres.fit_stats # N and R² per modelprint(res.interpret())
This OLS model relates **gini_regional** to its regressors.
- **log_gdp_pc**: each one-unit increase is associated with gini_regional that is 0.00537 lower (statistically significant at the 5% level).
_These are associations, not causal effects. A causal reading needs a research design — see `explain('correlation_vs_causation')`._