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: estatimtest, estathettest
  6. Testing autocorrelation: estat dwatson; estat durbinalt; estat bgodfrey; actest (Baum et al., 2007; Baum et al. 2013); abar (Roodman, 2009)
  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 (Baum et al 2003, 2007 )
  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 (Baum et al. 2003)
    • Testingautocorrelation: 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 (Mikusheva et al 2006); weakiv
  6. Estimation and inference using heteroskedasticity without instruments: ivreg2h



The 2023 edition of this training course will be offered ONLINE on a part-time basis on the 5th-6th and the 12th-13th of June, from 10:00 am to 1:30 pm Central European Summer Time (CEST).

Professor Giovanni BRUNO, Bocconi University, Department of Economics, Milan (IT).

Full-Time Students*: € 710.00

Ph.D. Students: € 910.00

Academic: € 1060.00

Commercial: € 1420.00


*To be eligible for student prices, participants must provide proof of their full-time student status for the current academic year. Our standard policy is to provide all full-time students, be they Undergraduates or Masters students, access to student participation rates. Part-time master and doctoral students who are also currently employed will however, be allocated academic status.


Fees are subject to VAT (applied at the current Italian rate of 22%). Under current EU fiscal regulations, VAT will not however applied to companies, Institutions or Universities providing a valid tax registration number.


The number of participants is limited to 8. Places will be allocated on a first come, first serve basis. The course will be officially confirmed, when at least 5 individuals are enrolled.


Course fees cover: I) teaching materials (copies of lecture slides, databases and Stata programs specifically developed for the course; ii) a temporary licence of Stata valid for 30 days from the day before the course commences.


Individuals interested in attending this training course, must return their completed registration forms by email ( to TStat by the 25th May 2023.

To request further information or the registration form, please fill in the following form or send an email to





Terms and conditions*
I authorise the use of my personal data in accordance with the European Union’s General Data Protection Regulation 2018.
TStat S.r.l.’s privacy policy.


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


The 2023 edition of this training course will be offered ONLINE on a part-time basis on the 5th-6th and the 12th-13th of June.