Skip to main content

1.4. High-Dimensional Fixed Effects and Modern Instrumental Variables

Verified Environments & Platforms:EcoDataEcoLabFincoVietLOD

Methodological Part 1.4. High-Dimensional Fixed Effects and Modern Instrumental Variables in 1. Classical Linear and Instrumental Variables Regression provides step-by-step How-To implementation guides for 13 econometric model lessons spanning from Section 1.4.1 to 1.4.13. Full theoretical derivations are available at VietLOD Part 1.4 alongside cloud execution on EcoLab.

Video Tutorial: How-To Guide for Part 1.4: High-Dimensional Fixed Effects and Modern Instrumental Variables in Stata 18, R 4.x, and Python 3.11+

1.4.1. Methodological Overview and Structural Equations​

  • Methodological Focus: Provides consistent estimation and robust inference for High-Dimensional Fixed Effects and Modern Instrumental Variables specifications within Classical Linear and Instrumental Variables Regression.
  • Mandatory Post-Estimation Diagnostics: Kiểm định FF đồng thời các biến giải thích — within-FF, kiểm cáo loại singleton, R2R^2 within/projected, VIF sau khử FE..

Core structural specification for Part 1.4:

Yijt=Xijt⊤β+αi+γj+λt+εijt,Y~=MDY,β^HDFE=(X~⊤X~)−1X~⊤Y~Y_{ijt} = X_{ijt}^\top \beta + \alpha_i + \gamma_j + \lambda_t + \varepsilon_{ijt}, \quad \tilde{Y} = M_D Y, \quad \hat{\beta}_{\text{HDFE}} = (\tilde{X}^\top \tilde{X})^{-1}\tilde{X}^\top \tilde{Y}

Estimator objective and moment conditions:

β^N=arg⁡min⁡β∈RK∑i=1Nwi(Yi−Xi⊤β)2,E[Xiεi]=0\hat{\beta}_N = \arg\min_{\beta \in \mathbb{R}^K} \sum_{i=1}^N w_i \left(Y_i - X_i^\top \beta\right)^2, \quad \text{E}\left[X_i \varepsilon_i\right] = 0
Methodological Scope Boundary:When empirical data violate the identification conditions of Part 1.4, researchers should transition to the extended methodological parts in Chapter 1 or apply appropriate instrumental-variable and cluster-robust corrections.

1.4.2. Econometric Model Lessons in Part 1.4​

1.4.1 · hdfe_ols
1.4.1. High-Dimensional Fixed Effects OLS

Absorbs multiple high-dimensional fixed effects simultaneously while dropping singleton groups and clustering standard errors. Across empiri...

Explore Guide
1.4.2 · hdfe_iv
1.4.2. High-Dimensional Fixed Effects Two-Stage Least Squares

Estimates causal instrumental-variable regressions while partialling out multi-way high-dimensional fixed effects. Across empirical economet...

Explore Guide
1.4.3 · bartik_shift_share_iv
1.4.3. Shift-Share Bartik Instrumental Variables

Identifies causal effects from regional exposure shares combined with aggregate sectoral shocks. Across empirical econometrics, `bartik_shif...

Explore Guide
1.4.4 · lewbel_het_iv
1.4.4. Lewbel Heteroskedasticity-Based Instrumental Variables

Constructs internal instruments from first-stage residual heteroskedasticity when external instruments are scarce or supplemented. Across em...

Explore Guide
1.4.5 · control_function_iv
1.4.5. Control Function Endogeneity Estimator

Includes first-stage residuals directly in the structural equation with two-step bootstrap covariance and direct endogeneity test. Across em...

Explore Guide
1.4.6 · iv_quantile
1.4.6. Instrumental Variables Quantile Regression

Estimates distributional causal effects at target conditional quantiles when treatment or covariates are endogenous. Across empirical econom...

Explore Guide

1.4.3. Comparative Execution Syntax Across Stata 18, R 4.x, and Python 3.11+​

Section & Model TitleEstimator KeyStata 18 MP SyntaxR 4.x SyntaxPython 3.11+ SyntaxSupport
1.4.1 · High-Dimensional Fixed Effects OLShdfe_olsreghdfe y x1 x2, absorb(id1 id2) vce(cluster id1)fixest::feols(y ~ x1 + x2 | id1 + id2, cluster = ~id1, data = df)pyfixest.feols('y ~ x1 + x2 | id1 + id2', data=df, vcov={'CRV1': 'id1'})Available
1.4.2 · High-Dimensional Fixed Effects Two-Stage Least Squareshdfe_ivivreghdfe y x1 (endog = z1 z2), absorb(id1 id2) cluster(id1)fixest::feols(y ~ x1 | id1 + id2 | endog ~ z1 + z2, cluster = ~id1, data = df)pyfixest.feols('y ~ x1 | id1 + id2 | endog ~ z1 + z2', data=df, vcov={'CRV1': 'id1'})Available
1.4.3 · Shift-Share Bartik Instrumental Variablesbartik_shift_share_ivivreg2 y x1 (d = bartik_z), robustShiftShareSE::ivreg_ss(y ~ x1 | d ~ bartik_z, shares = W, data = df)IV2SLS.from_formula('y ~ 1 + x1 + [d ~ bartik_z]', data=df).fit(cov_type='robust')Available
1.4.4 · Lewbel Heteroskedasticity-Based Instrumental Variableslewbel_het_ivivreg2h y x1 (endog = ), robustREndo::hetErrorsIV(y ~ x1 + endog | endog | IIV(x1), data = df)IVGMM.from_formula('y ~ 1 + x1 + [endog ~ z_lewbel]', data=df).fit(cov_type='robust')Available
1.4.5 · Control Function Endogeneity Estimatorcontrol_function_ivetregress y x1 x2, treat(d = z1 z2) twostepfixest::feols(y ~ x1 + d + v_hat, vcov = 'hetero', data = df)smf.ols('y ~ x1 + d + v_hat', data=df).fit(cov_type='HC1')Available
1.4.6 · Instrumental Variables Quantile Regressioniv_quantileivqregress iqr y x1 (endog = z1 z2), quantile(0.5)quantreg::rq(y ~ x1 + d_hat, tau = 0.5, data = df)smf.quantreg('y ~ x1 + d_hat', data=df).fit(q=0.5)Available

| 1.4.7 · Continuously Updated Generalized Method of Moments | continuously_updated_gmm | ivregress gmm y (x_endog = z1 z2), igmm vce(robust) | gmm::gmm(type = 'cue') | scipy.optimize.minimize CUE objective + Hansen-Sargan J | Available | | 1.4.8 · Iterated Generalized Method of Moments | iterated_gmm | ivregress gmm y x1 (x2 = z1 z2), igmm | gmm::gmm(type = 'iterative') | statsmodels / NumPy fixed-point iterated GMM solver | Available | | 1.4.9 · Jackknife and Split Sample Instrumental Variables | jive_split_sample_iv | jive y (x_endog = z1 z2 z3), robust | SteinIV::jive.est / ivmodel::KClass | Leave-one-out hat-matrix JIVE1 estimator | Available | | 1.4.10 · Reduced Rank Multivariate Regression Anderson | reduced_rank_regression | canon (y) (x1 x2) | rrpack::rrr | SVD canonical-correlation Reduced Rank Regression | Available | | 1.4.11 · Fuller Modified Limited Information Maximum Likelihood | fuller_modified_liml | ivregress liml y (x_endog = z1 z2), vce(robust) | ivmodel::FULL(ivmodel(Y, D, Z), beta0 = 0, alpha = 1) | linearmodels.iv.IVLIML(fuller=1.0) / exact k-class eigenvalue solver | Available | | 1.4.12 · Maximum Empirical Likelihood Moment Estimator | empirical_likelihood_owen | gmm (y - {b0} - {xb: x1 x2}), instruments(x1 x2) winitial(identity) | gmm::gel(g, x, tet0, type = 'EL') | Saddle-point Lagrange tilting Maximum Empirical Likelihood + Wilks ELR statistic | Available | | 1.4.13 · Two Step Control Function Regression with Endogeneity Test | control_function_endogenous | eregress y x_exog, endogenous(x_endog = z1 z2 x_exog) vce(robust) | First-stage lm residual augmentation + sandwich::vcovHC | Two-step Control Function projection + Murphy-Topel / HC1 covariance + Wu-Hausman t-test | Available |

1.4.4. Standard Implementation Workflow for Part 1.4​

Step 1. Load Standardized Practice Datasets From VietLOD, EcoData, or Finco

Download the model-specific .csv practice dataset in Part 1.4 or extract custom empirical panels from EcoData and Finco.

Step 2. Select the Optimal Estimator for Your Error and Sample Structure

Compare the estimators from 1.4.1 to 1.4.13 in the syntax matrix above and execute the estimation in Stata 18 MP, R 4.x, or Python 3.11+.

Step 3. Run Mandatory Diagnostics and Export Publication Tables on EcoLab

Verify all required diagnostics including Kiểm định FF đồng thời các biến giải thích — within-FF, kiểm cáo loại singleton, R2R^2 within/projected, VIF sau khử FE. and dispatch the specification to EcoLab for automated journal-grade reporting.