Estimating Linear Regression Models With Exogenous And Endogenous Variables In Stata

This applied course offer a rigorous overview of the more advanced technical capabilities currently available in Stata for linear regression analysis. Thus providing participants with a unique hands-on opportunity to acquire the necessary theoretical and applied skills to independently apply advanced linear regression techniques in Stata. In the opening session, the application of Ordinary Least Squares (OLS) techniques for both estimation and inference in linear models in the presence of exogenous regressors is discussed. In the second session, participants address the problems which arise when trying to estimate linear models containing endogenous regressors. Instrumental Variable and Generalized Methods of Moments (GMM) techniques for both estimation and inference, together with a discussion of the available tests for both weak identification and inference procedures under weak identification, therefore form the core of this closing session.


Individual sessions are composed of both a theoretical component (in which the techniques and underlying principles behind them are explained), and an applied (hands-on) segment using Stata, during which participants implement the techniques using real data under the watchful eye of the course tutor. Throughout the course, theoretical sessions are reinforced by applied examples, in which the course tutor discusses and highlights potential pitfalls and the advantages of individual techniques. The intuition behind the choice and implementation of a specific technique is of the utmost importance. In this manner, the course leader is able to bridge the “often difficult” gap between abstract theoretical methodologies, and the practical issues one encounters when dealing with real data.


At the end of the course, participants are expected to be able to autonomously implement the theories and methodologies discussed during the course.

This course is particular interest to researchers in public and private research centres, Master and Ph.D. Students working in the following fields: Agricultural Economics, Economics, Finance, Management, Public Health, and the Political and Social Sciences seeking to acquire the applied and theoretical toolset to enable them to independently apply linear regression techniques in their empirical research.

It is assumed that course participants have:


  • at some point followed a basic course in econometrics or statistics;
  • a knowledge of Stata or other statistical software, SPSS, SAS.


1. The OLS estimator: regress
2. Categorical variables, dummies, interactions and marginal effects: margins
3. Testing hypotheses on model coefficients: test, testparm, lincom, nlcom
4. OLS predicted values: predict, margins
5. Testing heteroskedasticity: estat imtest, estat hettest
6. Testing autocorrelation: estat dwatson, estat durbinalt, estat bgodfrey, actest, abar
7. Consistent variance-covariance estimators under:

    • heteroskedasticity: the regress options vce(robust), vce(hc2), vce(hc3)
    • cluster correlation: the regress option vce(cluster clustervar)
    • autocorrelation: newey


1. Optimal estimation and inference under i.i.d. errors with the Two-Stage-Least- Square estimator: ivregress 2sls, ivreg2
2. Optimal estimation and inference under non-i.i.d. errors with overidentified GMM estimators: ivregress gmm, ivreg2
3. Consistent variance-covariance estimators under:

    • heteroskedasticity: ivregress…, vce(robust), ivreg2…, robust
    • cluster correlation: ivregress…, vce(cluster clustervar), ivreg2…, cluster(clustervar)
    • twoway cluster correlation: ivreg2…, cluster(varlist)
    • autocorrelation: ivregress…, vce(hac kernel), ivreg2…, bw(#)

4. Specification tests:

    • Testing heteroskedasticity: ivhettest
    • Testing autocorrelation: actest, abar
    • Testing overidentifying restrictions: estat overid
    • Testing subsets of overidentifying restrictions: ivreg2…, orthog(varlist_inst)
    • Testing subsets of regressors for endogeneity: estat endogenous, ivreg2…, orthog(varlist_regr)
    • Tests for weak instruments: ivregress…, first, ivreg2…, first
    • A robust test for weak instruments with one endogenous variable: weakivtest

5. Inference with weak instruments: ivreg2…, first, condivreg, weakiv
6. Estimation and inference using heteroskedasticity without instruments: ivreg2h



We are currently putting the finishing touches to our 2024 training calendar. We therefore ask that you re-visit our website periodically or contact us at should the dates for the course which you are interested in following not yet be published. You will then be contacted via email as soon as the dates are available.


This applied course offer a rigorous overview of the more advanced technical capabilities currently available in Stata for linear regression analysis.