Maria Elena Bontempi Roberto Golinelli this version: 5 September 2007

Similar documents
Instrumental Variables and GMM: Estimation and Testing. Steven Stillman, New Zealand Department of Labour

4 Instrumental Variables Single endogenous variable One continuous instrument. 2

4 Instrumental Variables Single endogenous variable One continuous instrument. 2

IV and IV-GMM. Christopher F Baum. EC 823: Applied Econometrics. Boston College, Spring 2014

Econometrics. 8) Instrumental variables

Instrumental Variables, Simultaneous and Systems of Equations

Handout 12. Endogeneity & Simultaneous Equation Models

Instrumental Variables Estimation in Stata

Microeconometrics (PhD) Problem set 2: Dynamic Panel Data Solutions

Instrumental variables and GMM: Estimation and testing

Lab 11 - Heteroskedasticity

Graduate Econometrics Lecture 4: Heteroskedasticity

Lecture 8: Instrumental Variables Estimation

Эконометрика, , 4 модуль Семинар Для Группы Э_Б2015_Э_3 Семинарист О.А.Демидова

Econometrics. 9) Heteroscedasticity and autocorrelation

Fixed and Random Effects Models: Vartanian, SW 683

Econometrics. Week 8. Fall Institute of Economic Studies Faculty of Social Sciences Charles University in Prague

Problem Set 10: Panel Data

Topic 7: Heteroskedasticity

Instrumental variables estimation using heteroskedasticity-based instruments

ECON2228 Notes 7. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 41

Instrumental variables estimation using heteroskedasticity-based instruments

Please discuss each of the 3 problems on a separate sheet of paper, not just on a separate page!

Warwick Economics Summer School Topics in Microeconometrics Instrumental Variables Estimation

Lab 07 Introduction to Econometrics

Description Quick start Menu Syntax Options Remarks and examples Stored results Methods and formulas Acknowledgment References Also see

Capital humain, développement et migrations: approche macroéconomique (Empirical Analysis - Static Part)

Measurement Error. Often a data set will contain imperfect measures of the data we would ideally like.

Recent Advances in the Field of Trade Theory and Policy Analysis Using Micro-Level Data

Economics 308: Econometrics Professor Moody

INTRODUCTION TO BASIC LINEAR REGRESSION MODEL

Handout 11: Measurement Error

Lecture 8: Heteroskedasticity. Causes Consequences Detection Fixes

Case of single exogenous (iv) variable (with single or multiple mediators) iv à med à dv. = β 0. iv i. med i + α 1

Autocorrelation. Think of autocorrelation as signifying a systematic relationship between the residuals measured at different points in time

Heteroskedasticity. (In practice this means the spread of observations around any given value of X will not now be constant)

Lecture#12. Instrumental variables regression Causal parameters III

Simultaneous Equations with Error Components. Mike Bronner Marko Ledic Anja Breitwieser

Econometrics I KS. Module 2: Multivariate Linear Regression. Alexander Ahammer. This version: April 16, 2018

Heteroskedasticity. Occurs when the Gauss Markov assumption that the residual variance is constant across all observations in the data set

For more information on the Stata Journal, including information for authors, see the web page.

. *DEFINITIONS OF ARTIFICIAL DATA SET. mat m=(12,20,0) /*matrix of means of RHS vars: edu, exp, error*/

Quantitative Methods Final Exam (2017/1)

point estimates, standard errors, testing, and inference for nonlinear combinations

1 Motivation for Instrumental Variable (IV) Regression

Wooldridge, Introductory Econometrics, 4th ed. Chapter 15: Instrumental variables and two stage least squares

Final Exam. Question 1 (20 points) 2 (25 points) 3 (30 points) 4 (25 points) 5 (10 points) 6 (40 points) Total (150 points) Bonus question (10)

G. S. Maddala Kajal Lahiri. WILEY A John Wiley and Sons, Ltd., Publication

Econ 836 Final Exam. 2 w N 2 u N 2. 2 v N

Essential of Simple regression

Econometrics - 30C00200

Introduction to Econometrics. Heteroskedasticity

Dynamic Panels. Chapter Introduction Autoregressive Model

Final Exam. 1. Definitions: Briefly Define each of the following terms as they relate to the material covered in class.

10) Time series econometrics

ECON Introductory Econometrics. Lecture 16: Instrumental variables

1. You have data on years of work experience, EXPER, its square, EXPER2, years of education, EDUC, and the log of hourly wages, LWAGE

Applied Econometrics (MSc.) Lecture 3 Instrumental Variables

Lecture 4: Heteroskedasticity

Dynamic Panel Data Models

Heteroskedasticity Richard Williams, University of Notre Dame, Last revised January 30, 2015

Mediation Analysis: OLS vs. SUR vs. 3SLS Note by Hubert Gatignon July 7, 2013, updated November 15, 2013

ECON3150/4150 Spring 2015

Instrumental Variables and the Problem of Endogeneity

Christopher Dougherty London School of Economics and Political Science

Greene, Econometric Analysis (7th ed, 2012)

Lecture: Simultaneous Equation Model (Wooldridge s Book Chapter 16)

Topic 10: Panel Data Analysis

Empirical Application of Simple Regression (Chapter 2)

ECON Introductory Econometrics. Lecture 6: OLS with Multiple Regressors

Greene, Econometric Analysis (7th ed, 2012)

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 48

ECON 4551 Econometrics II Memorial University of Newfoundland. Panel Data Models. Adapted from Vera Tabakova s notes

ESTIMATING AVERAGE TREATMENT EFFECTS: REGRESSION DISCONTINUITY DESIGNS Jeff Wooldridge Michigan State University BGSE/IZA Course in Microeconometrics

Birkbeck Working Papers in Economics & Finance

Multiple Regression Analysis: Heteroskedasticity

Correlation and Simple Linear Regression

2.1. Consider the following production function, known in the literature as the transcendental production function (TPF).

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 54

Week 11 Heteroskedasticity and Autocorrelation

Greene, Econometric Analysis (5th ed, 2003)

ECON Introductory Econometrics. Lecture 5: OLS with One Regressor: Hypothesis Tests

9) Time series econometrics

Applied Statistics and Econometrics

Generalized Method of Moments: I. Chapter 9, R. Davidson and J.G. MacKinnon, Econometric Theory and Methods, 2004, Oxford.

Econometrics. Week 4. Fall Institute of Economic Studies Faculty of Social Sciences Charles University in Prague

Exercices for Applied Econometrics A

LECTURE 11. Introduction to Econometrics. Autocorrelation

Instrumental Variables

Statistical Modelling in Stata 5: Linear Models

Econometrics II. Lecture 4: Instrumental Variables Part I

Day 2A Instrumental Variables, Two-stage Least Squares and Generalized Method of Moments

ECON2228 Notes 2. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 47

Greene, Econometric Analysis (7th ed, 2012) Chapters 9, 20: Generalized Least Squares, Heteroskedasticity, Serial Correlation

ADVANCED ECONOMETRICS I. Course Description. Contents - Theory 18/10/2017. Theory (1/3)

Applied Econometrics. Lecture 3: Introduction to Linear Panel Data Models

Introduction to Econometrics

Introduction to Eco n o m et rics

the error term could vary over the observations, in ways that are related

Iris Wang.

Transcription:

INSTRUMENTAL VARIABLES (IV) ESTIMATION A Maria Elena Bontempi e.bontempi@economia.unife.it Roberto Golinelli roberto.golinelli@unibo.it this version: 5 September 2007 1. The instrumental variables approach This note refers to the estimation methods to be used when the specification assumption E( ε X ) = 0 (i.e. weak exogeneity of the model regressors) fails. If the error term of the classical regression model is correlated with the explanatory variables we have biased and inconsistent OLS/GLS parameter estimates. In such circumstances, explanatory variables are correlated with the error term. The explanatory variables are correlated with the error term in three circumstances: 1. Measurement errors in the explanatory variables. If the explanatory x i is measured with error, the x i * = x i + v i, observations are available (where v i is a random variable measurement error ), instead of the genuine measure x i. In the model y i = β x i * + ε i * (with ε i * = ε i βv i ), x i * is stochastic (because v i is stochastic) and correlated with the model s error term ε i * (they both embody v i ). Therefore, OLS/GLS estimator of β is biased and inconsistent. This problem does not emerge if the measurement error characterises only the dependent variable of the model. 2. Endogeneity, i.e. economic simultaneity. The explanatory x i is generated inside the same economic system also generating y i. In this circumstance, in the equation y i = b x i + ε i, x i is correlated by definition with ε i error term. Assume that price p i and quantity q i are simultaneously determined in the i th market by the interplay of supply and demand. In the supply structural equation q i = b p i + ε i, the explanatory p i is stochastic and correlated with the ε i error term, i.e. endogenous (see Section 2.). Therefore, the OLS estimator of b is biased and inconsistent. Another classical example is that of the consumption function (limited-information model) nested in the IS-LM (full-information) model. 3. Autocorrelated errors in the dynamic model. In this case, the OLS estimator is inconsistent because the explanatory lagged dependent variable is correlated with the (autocorrelated) error term. However, if the model is static, errors autocorrelation simply causes OLS inefficiency (such as the heteroskedasticity case discussed above). In the static model with both autocorrelated and heteroskedastic errors, the GLS estimator is BLUE (i.e. the estimator with the best statistical properties) because it accounts for this through a non-scalar variancecovariance matrix of errors. If we face one of the previous three circumstances, in which the OLS estimator is biased and inconsistent, we can at least recover consistency (but neither unbiasedness nor efficiency) using the Instrumental Variables (IV) estimator, sometimes labelled as Two Stages Least Squares (2SLS). Very preliminary. Comments welcome. 1

A relevant IV-2SLS (henceforth only IV) feature is that it needs further information, in addition to that specified by the classical linear regression model. In particular, the IV estimator requires the additional w i variable, i.e. a valid instrument. To be valid, the instrument must be: (i) correlated with x i (instrument s relevance condition); (ii) unrelated with the model s error (instrument s exogeneity condition). Remember that the necessary condition for the parameters to be identified is that the number of instruments (exogenous) be equal to (or greater than) the number of explanatory endogenous variables (to be instrumented). If valid instruments are available, in matrix form the IV estimator is defined as: βˆ IV = ( W X) W y, i.e. the ratio of the sample covariance between the dependent variable y i and the instrument w i to the sample covariance between the explanatory x i and the instrument w i. The instrument s relevance condition sub (i) prevents the denominator of the ratio from being zero. If the explanatory x i * is measured with error (i.e. affected by the measurement error v i, see point 1 above), the instrument w i should be correlated with x i and unrelated with both the model s error (ε i ), and the measurement error (v i ). w i is chosen on the basis of both the economic nature and the statistical measurement of the variables of interest. For an equation with one endogenous explanatory variable x i (see point 2 above), the w i instrument is an exogenous variable that interacts with the solution of the whole model (in which the equation of interest is nested), without that such solution feeds-back to on w i. The specification of the full model often suggests the instrument to be used (see as an example the price-quantity model described in Section 2). The point 3 above can only arise over time, i.e. data must be time-series or panels. With timeseries, the improvement of the model dynamics is a better way than IV to cope with lagged explanatory variables related with the error. Contrary to what happens with time-series, dynamic panel models imply inconsistent OLS estimator even if errors are white noise (not autocorrelated). The latter point is tackled in the dynamic panel models lecture. 2. The limited information approach: the supply equation estimate In this first example we tackle the classical issue of the estimation of the parameters in the (full) supply-demand interaction model.. use kmenta, clear. descr Contains data obs: 20 vars: 4 5 Nov 2003 16:22 size: 340 (99.9% of memory free) - storage display value variable name type format label variable label - codice byte %8.0g q float %9.0g Q p float %9.0g P r float %9.0g R - 2

20 geographical zones (or markets) q per capita consumption of food p relative price of food with respect to the overall consumption price index r disposable income at constant prices Full model in structural form (SF): q s = a 0 + a 1 p + u s q d = a 2 + a 3 p + a 4 r + u d q s q d In the model above only the supply equation is identified. However, the supply equation parameters OLS estimates are biased and inconsistent because the OLS assumption of price exogeneity is not valid. OLS estimate. reg q p Source SS df MS Number of obs = 20 -------------+------------------------------ F( 1, 18) = 0.17 Model 2.58000329 1 2.58000329 Prob > F = 0.6807 Residual 265.534161 18 14.7518978 R-squared = 0.0096 -------------+------------------------------ Adj R-squared = -0.0454 Total 268.114164 19 14.1112718 Root MSE = 3.8408 p.0621821.1486891 0.42 0.681 -.2502022.3745664 _cons 94.67881 14.89652 6.36 0.000 63.38237 125.9752. predict ress, res. sktest ress Skewness/Kurtosis tests for Normality ------- joint ------ Variable Pr(Skewness) Pr(Kurtosis) adj chi2(2) Prob>chi2 -------------+------------------------------------------------------- ress 0.179 0.885 2.05 0.3594. hettest Cook-Weisberg test for heteroskedasticity using fitted values of q Ho: Constant variance chi2(1) = 0.05 Prob > chi2 = 0.8187. ovtest Ramsey RESET test using powers of the fitted values of q Ho: model has no omitted variables F(3, 15) = 0.97 Prob > F = 0.4323 3

The usual diagnostic tests do not suggest any deviation from the errors specification hypotheses of the classical regression model. However, they are not able to assess for the possible correlation between model s explanatory variables and errors. 2SLS estimation 1) FIRST STAGE: OLS estimation of the unrestricted reduced form (URF). Explanatory endogenous variables of the structural equation are estimated as a function of all the exogenous variables (both included and excluded in the structural equation). The identifying condition requires that the number of excluded exogenous variables (instruments) is the number of explanatory endogenous (if > we have an over-identified model; if = we have an exactly identified model). This stage is based on the asymptotic efficiency condition COV(X, W) 0, that in the present case becomes: COV(p, r) 0.. reg p r Source SS df MS Number of obs = 20 -------------+------------------------------ F( 1, 18) = 8.51 Model 214.17271 1 214.17271 Prob > F = 0.0092 Residual 453.078661 18 25.1710367 R-squared = 0.3210 -------------+------------------------------ Adj R-squared = 0.2833 Total 667.251371 19 35.1184932 Root MSE = 5.0171 p Coef. Std. Err. t P> t [95% Conf. Interval] r.2837938.0972907 2.92 0.009.0793936.488194 _cons 72.33922 9.555333 7.57 0.000 52.26421 92.41423 2) Store both fitted values and residuals.. predict pfit (option xb assumed; fitted values). predict resp, res Remember that, by definition, OLS decompose the endogenous explanatory p in two parts (p = pfit + resp): the first is correlated with the exogenous instrument, the second is correlated with the supply-demand shocks (hence correlated with the disturbance term of the supply equation). With OLS, the two parts (components of p) are orthogonal by definition:. corr pfit resp (obs=20) pfit resp -------------+------------------ pfit 1.0000 resp 0.0000 1.0000 3) SECOND STAGE: OLS estimate of the structural equation in which endogenous explanatory variables are replaced by the fitted values at the first stage (pfit in place of p). Given that pfit is the part of the endogenous explanatory variable not correlated with the error term of the structural equation of interest, this stage is based on the necessary condition for IV estimator being consistent, COV(ε, W) = 0, that in our case becomes COV(ε, r) = 0. 4

. reg q pfit Source SS df MS Number of obs = 20 -------------+------------------------------ F( 1, 18) = 26.41 Model 159.454397 1 159.454397 Prob > F = 0.0001 Residual 108.659767 18 6.03665374 R-squared = 0.5947 -------------+------------------------------ Adj R-squared = 0.5722 Total 268.114164 19 14.1112718 Root MSE = 2.457 pfit.8628519.1678866 5.14 0.000.5101352 1.215569 _cons 14.59657 16.80085 0.87 0.396-20.7007 49.89384 IV estimate. ivreg q (p=r) Instrumental variables (2SLS) regression Source SS df MS Number of obs = 20 -------------+------------------------------ F( 1, 18) = 4.14 Model -425.176018 1-425.176018 Prob > F = 0.0569 Residual 693.290182 18 38.5161212 R-squared =. -------------+------------------------------ Adj R-squared =. Total 268.114164 19 14.1112718 Root MSE = 6.2061 p.8628517.4240716 2.03 0.057 -.0280897 1.753793 _cons 14.5966 42.43794 0.34 0.735-74.5622 103.7554 Instrumented: p Instruments: r Note that, contrary to OLS, in the IV case R 2 may fall outside the 0-1 range because the orthogonality conditions of the residuals refer to the instruments and not to model s explanatory variables. For this reason, Stata does not report it. Note that standard errors of the second stage of 2SLS estimates are different from standard errors of IV estimates: the true explanatory variable is p and not pfit; the right standard errors are those of IV. See the following summary and comparison. Given the equation Y = Xβ + ε, we have what follows. OLS: min( Y Xβ ) ( Y Xβ ) ˆ βols = ( X X ) X Y ˆ ˆ 1 ) 1 with ˆ ˆ ε ˆ ε ( Y XβOLS ) ( Y XβOLS Var( β OLS ) = ( X X ) = ( X X ). N K N K IV: Y X PW Y X ˆ min( β ) ( β ) β IV = ( X PW X ) X PW Y where P W = W ( W W ) W is the matrix projecting Y upon the sub-space spanned by the columns of X that lies in the space spanned 5

by the columns of W. Note that, if W has the same dimension (N K) of X, it follows βˆ IV = ( X PW X ) X PW Y = ( X W ( W W ) W X ) X W ( W W ) W Y =. = ( W X ) W W ( X W ) X W ( W W ) W Y = ( W X ) W Y ˆ ˆ ) 1 The estimated variance of the estimator is ˆ ( Y Xβ IV ) ( Y Xβ IV Var( β IV ) = ( X PW X ), where N asymptotically it makes no difference whether we divide for N or N-K. 2SLS: min( Y PW Xβ ) ( Y PW Xβ ) ˆ β 2 SLS = ( X PW PW X ) X PW PW Y = ( X PW X ) X PW Y because P W is idempotent (P W = P W P W ). The estimated variance of the estimator is ˆ ˆ ˆ ( Y PW Xβ 2SLS ) ( Y PW Xβ 2SLS ) Var( β 2 SLS ) = ( X PW X ), that coincides with the IV estimated N K variance only if X=P W X. 1 2.1. Testing for exogeneity of the model s regressors The command hausman performs Hausman's (1978) specification test, also known as the Durbin- Wu-Hausman test 2, based on the following comparison: OLS IV H 0 : E(ε X)=0 Consistent and Efficient Consistent but not efficient H 1 : E(ε X) 0 Not consistent Consistent The idea is testing whether the difference ˆ δ = ˆ β ˆ IV βols is statistically significant: the rejection of the null H : plim ˆ 0 δ = 0 implies that the event E(ε X)=0 can not be accepted and that we must estimate our model by using IV, instead of OLS. Note that the Hausman test can be generalised: for example, we will see that it is applied in choosing between fixed effects and random effects in panel data model. The steps in Stata 8/9 are the following (note that the procedure to perform Hausman test has been totally revised if compared to the one of Stata 7). (1) Obtain an estimator that is consistent whether or not H 0 is true. (2) Store the estimation results under a name-consistent using the command estimates store. (3) Obtain an estimator that is efficient (and consistent) under H 0, but inconsistent otherwise. (4) If you want, store the estimation results under a name-efficient using again the command estimates store. (5) Use the command hausman name-consistent name-efficient to perform the test. If you do not want to run step (4), you may use a period (.) to refer to the last estimation results, even if these were not already stored. 1 2SLS is a special case of generated regressors, that provide consistent estimates of the parameters, but not consistent estimates of the covariance matrix of the parameter estimates. See Pagan A. R. (1984) Econometric issues in the analysis of regressions with generated regressors, International Economic Review, 25, 221-47 and Pagan A. R. (1986) Two stage and related estimators and their applications, Review of Economic Studies, 53, 517-38. 2 Following the works of Durbin J. (1954) Errors in Variables, Review of International Statistical Institute, 23-32, Wu De-Min (1973) Alternative Tests of Independence between Stochastic Regressors and Disturbances, Econometrica, 733-750, and Hausman J.A. (1978) Specification Tests in Econometrics, Econometrica, 46, 1251-1271. 6

The order of computing the two estimators may be reversed, but you have to be careful though to specify to hausman the models in the order always consistent first and efficient under H 0 second (see below). In fact, the test-statistic is ˆ δ Var [ ( ˆ) δ ] ˆ δ, where Var (δˆ ) is positive definite (>0 in the bivariate case), i.e. Var( ˆ β ) ( ˆ IV > Var βols ). Under the null, the test-statistic is distributed as a chi-squared with m degrees of freedom, where m is the number of regressors specified as endogenous in the original instrumental variable regression. The important result of Hausman is that of demonstrating that, under the null, Var( ˆ) δ = Var( ˆ β ) ( ˆ IV Var βols ) and not Var( ˆ) δ = Var( ˆ β ) ( ˆ ) 2 ( ˆ, ˆ IV + Var βols Cov β IV βols ). The proof strategy is to show that βˆ OLS can not be efficient if the result the variance of differences equals the difference of variances does not hold (see Maddala G. S., 1992, Introduction to Econometrics, Maxwell Macmillan, second edition, pp. 506-508). The order in which you specify the regressors in each model does not matter, but it is your responsibility to assure that the estimators and models are comparable, and satisfy the theoretical conditions (1) and (3) above. The command hausman may be used in any context, but you have to pay attention to the options (for example, constant specifies that the estimated intercept(s) are to be included in the model comparison, while by default they are excluded). The option sigmamore can only be specified when both estimators save e(sigma) or e(rmse) 3. It allows you to specify that the (co)variance matrices used in the test be based on a common estimate of disturbance variance (σ 2 ), namely the variance from the efficient estimator (obtained under H 0 ). This option provides a proper estimate of the contrast variance for so-called tests of exogeneity and over-identification in instrumental variables regression. (see Baltagi, 1998, Econometrics, p. 291). It is recommended when comparing fixed-effects and random-effects linear regressions because they are much less likely to produce a nonpositive-definite differenced covariance matrix (although the tests are asymptotically equivalent whether or not one of the options is specified). Save the results of the previous IV estimate, and then compare them with the OLS results:. est store IV. reg q p Source SS df MS Number of obs = 20 -------------+------------------------------ F( 1, 18) = 0.17 Model 2.58000329 1 2.58000329 Prob > F = 0.6807 Residual 265.534161 18 14.7518978 R-squared = 0.0096 -------------+------------------------------ Adj R-squared = -0.0454 Total 268.114164 19 14.1112718 Root MSE = 3.8408 p.0621821.1486891 0.42 0.681 -.2502022.3745664 _cons 94.67881 14.89652 6.36 0.000 63.38237 125.9752. hausman IV., sigmamore 3 See also the option sigmaless. 7

---- Coefficients ---- (b) (B) (b-b) sqrt(diag(v_b-v_b)) IV. Difference S.E. p.8628517.0621821.8006696.2162639 b = consistent under Ho and Ha; obtained from ivreg B = inconsistent under Ha, efficient under Ho; obtained from regress Test: Ho: difference in coefficients not systematic chi2(1) = (b-b)'[(v_b-v_b)^(-1)](b-b) = 13.71 Prob>chi2 = 0.0002 Note that, by default, the estimated intercept(s) are excluded in the model comparison. This is appropriate for models in which the constant does not have a common interpretation across the two models; for example, when comparing fixed effects versus random effects in panel data. Note that V_b-V_B = Var( βˆ IV ) may be negative, in such cases the Hausman test cannot be performed. However, be careful to list, after the hausman command, the names of the stored estimates in the right order: first the IV estimator (consistent under both the null and the alternative), and then the OLS (efficient under the null but inconsistent under the alternative) )-Var( βˆ OLS C. F. Baum, M. E. Schaffer and S. Stillman have written a very useful procedure, ivendog, that reports two tests. The "Durbin-Wu-Hausman" (DWH) test is equivalent to the standard "Hausman test" obtained by using hausman, sigmamore. The other test-statistic is the "Wu-Hausman" T2 statistic of Wu (1973); Hausman demonstrates that it could be calculated straightforwardly through the use of auxiliary regressions. The test statistic, under the null, is distributed like a F(m, N-K), where m is the number of regressors specified as endogenous in the original instrumental variables regression. Note that, differently from hausman, ivendog is not valid with robust covariance estimators.. qui ivreg q (p=r). ivendog Tests of endogeneity of: p H0: Regressor is exogenous Wu-Hausman F test: 54.27691 F(1,17) P-value = 0.00000 Durbin-Wu-Hausman chi-sq test: 15.22987 Chi-sq(1) P-value = 0.00010 You can also make by-hand Hausman test. The regression test is based on the following steps: 1) estimate the reduced form (reg p r); 2) save the residuals (predict resp, res); 3) estimate the augmented regression (reg q p resp) that is the structural equation plus the residual from the reduced form; 4) test H 0 : parameter associated to resp=0 by using a t statistic (or an F test in case we are testing for endogeneity of multiple explanatory variables; of course, for each of them, we must obtain the reduced form residuals as in 1) and 2) steps). 8

. reg q p resp Source SS df MS Number of obs = 20 -------------+------------------------------ F( 2, 17) = 27.48 Model 204.782568 2 102.391284 Prob > F = 0.0000 Residual 63.3315966 17 3.72538803 R-squared = 0.7638 -------------+------------------------------ Adj R-squared = 0.7360 Total 268.114164 19 14.1112718 Root MSE = 1.9301 p.8628517.1318875 6.54 0.000.5845934 1.14111 resp -1.17915.1600522-7.37 0.000-1.516831 -.8414698 _cons 14.59659 13.19832 1.11 0.284-13.24943 42.44262. di (_b[resp]/_se[resp])^2 54.276914. testparm resp ( 1) resp = 0 F( 1, 17) = 54.28 Prob > F = 0.0000 If we reject H 0, we conclude that p is endogenous: resp is the part of the p endogenous explanatory variable filtered from the effect of all the exogenous variables (remember again the OLS decomposition of the first-stage regression). Thus, if resp parameter is statistically significant, resp is significantly correlated with q (i.e. with the error term of the structural equation). Despite the OLS regression, the estimate of p parameter above is equal to the structural estimate previously obtained with IV because resp in this OLS regression clears up the endogeneity of p. Of course, in this test regression the standard errors of the parameters are not appropriate. Note also that the squared t associated to resp (test H 0 : parameter associated to resp=0 by using a F statistic) corresponds to the Wu-Hausman F test reported by the ivendog procedure. 2.2. Testing for residuals heteroskedasticity M. E. Schaffer has also written a procedure, ivhettest, to perform various tests of heteroskedasticity for both OLS and IV estimation. After OLS estimates, ivhettest performs Breusch-Pagan/Godfrey/Cook-Weisberg test (the same obtained by hettest) and a general version of White/Koenker test (the same obtained by hettest, iid). The same results of the whitetst procedure is obtained by appropriately selecting the indicator variables. ivhettest command has many options 4 : 1) the default uses the regressors after OLS estimates, and the full set of instruments (exogenous variables, excluding the constant) after IV estimates; 2) ivlev corresponds to the default; 3) ivsq uses the full set of instruments (excluding the constant) and their squares; 4 Remember that the trade-off in the choice of indicator variables in all these tests is that a smaller set of indicator variables will preserve degrees of freedom, at the cost of being unable to detect heteroskedasticity in certain directions. 9

4) ivcp uses the full set of instruments (excluding the constant), their squares, and cross-products (save case as whitetst); 5) fitsq uses the fitted value of the dependent variable and its square; 6) varlist specifies a user-defined set of indicator variables. 7) fitlev uses the "fitted value" of the dependent variable; 5 For example, after an OLS estimate, we can obtain:. reg q p Source SS df MS Number of obs = 20 -------------+------------------------------ F( 1, 18) = 0.17 Model 2.58000329 1 2.58000329 Prob > F = 0.6807 Residual 265.534161 18 14.7518978 R-squared = 0.0096 -------------+------------------------------ Adj R-squared = -0.0454 Total 268.114164 19 14.1112718 Root MSE = 3.8408 p.0621821.1486891 0.42 0.681 -.2502022.3745664 _cons 94.67881 14.89652 6.36 0.000 63.38237 125.9752. hettest Breusch-Pagan / Cook-Weisberg test for heteroskedasticity Ho: Constant variance Variables: fitted values of q chi2(1) = 0.05 Prob > chi2 = 0.8187. hettest, iid Breusch-Pagan / Cook-Weisberg test for heteroskedasticity Ho: Constant variance Variables: fitted values of q chi2(1) = 0.06 Prob > chi2 = 0.8010. whitetst White's general test statistic :.0753974 Chi-sq( 2) P-value =.963. ivhettest, all OLS heteroskedasticity test(s) using levels of IVs only Ho: Disturbance is homoskedastic White/Koenker nr2 test statistic : 0.064 Chi-sq(1) P-value = 0.8010 Breusch-Pagan/Godfrey/Cook-Weisberg : 0.053 Chi-sq(1) P-value = 0.8187. ivhettest, all ivcp OLS heteroskedasticity test(s) using levels and cross products of all IVs Ho: Disturbance is homoskedastic 5 In the IV regression case, fitted values are not calculated directly from the regressors and the estimated coefficients. Rather, the endogenous regressors are first replaced with their first stage fitted values, i.e., with fitted values from regression of the endogenous regressors on the full set of instruments. The exogenous regressors, the fitted values of the endogenous regressors, and the estimated coefficients from the main regression are then used to calculate the fitted values of the dependent variable. This because the indicator variables must be functions of exogenous variables (instruments) only. 10

White/Koenker nr2 test statistic : 0.075 Chi-sq(2) P-value = 0.9630 Breusch-Pagan/Godfrey/Cook-Weisberg : 0.062 Chi-sq(2) P-value = 0.9693 where the option all is used to report all applicable statistics. After IV estimates, ivhettest, all also adds two versions of Pagan and Hall's (1983) 6 teststatistic: the default, the general test-statistic, and the test-statistic assuming that the error term in the IV regression is normally distributed. These tests will be valid tests for heteroskedasticity in an IV regression only if heteroskedasticity is present in that equation and nowhere else in the system. The White/Koenker nr-squared test-statistic and the standard Breusch-Pagan/Godfrey/Cook- Weisberg test-statistic (assuming that the error term is normally distributed) will be distributed as chi-squared under the null only if the system covariance matrix is homoskedastic.. qui ivreg q (p=r). ivhettest, all IV heteroskedasticity test(s) using levels of IVs only Ho: Disturbance is homoskedastic Pagan-Hall general test statistic : 0.093 Chi-sq(1) P-value = 0.7609 Pagan-Hall test w/assumed normality : 0.133 Chi-sq(1) P-value = 0.7151 White/Koenker nr2 test statistic : 0.195 Chi-sq(1) P-value = 0.6584 Breusch-Pagan/Godfrey/Cook-Weisberg : 0.189 Chi-sq(1) P-value = 0.6641 2.3. Testing for the over-identifying restrictions When the number of excluded exogenous variables is higher than the number of explanatory endogenous variables we can test the overidentifying restrictions. The steps are the following. 1) Estimate the structural model by IV and obtain the residuals (ressf). 2) Estimate the auxiliary regression in which the residuals above are regressed on all the exogenous variables, and compute the test-statistic NR 2. 3) Under the null that all the IV instruments are unrelated with the error term of the structural equation, the test-statistic N R 2 χ 2 q, where q is the number of the overidentifying restrictions, i.e. the difference between the number of excluded exogenous variables (instruments) and the number of endogenous explanatory variables. If N R 2 exceeds the critical value of the chi-squared distribution, we reject H 0. In such case, at least some of the IV instruments are not valid (i.e., unrelated with the error term and correctly excluded from the structural model), given that the high value of the R 2 indicates that they should have been included as explanatory variables in the structural model. C. F. Baum, V. Wiggins, S. Stillman and M. E. Schaffer have written a procedure, overid, that computes the versions of Sargan's (1958) and Basmann's (1960) tests for overidentifying restrictions. 7 6 Pagan, A. R. and D. Hall. (1983), Diagnostic tests as residual analysis, Econometric Reviews, 2(2), 159-218. 7 Sargan, J.D. (1958) The Estimation of Economic Relationships Using Instrumental Variables, Econometrica, 26, 393-415. Basmann, R.L. (1960) On Finite Sample Distributions of Generalized Classical Linear Identifiability Test Statistics, Journal of the American Statistical Association, 55, 292, 650-59. The test-statistic is ( Y X ˆ β IV ) PW ( Y X ˆ β IV ) ( Y X ˆ β ˆ IV ) PW ( Y Xβ IV ) in the Sargan s case and, where V is the ( Y X ˆ β IV ) ( Y X ˆ ˆ ˆ β IV ) ( Y Xβ IV ) ( I PW )( Y Xβ IV ) N ( N V ) number of IVs, in the Basmann s case. The two denominators can be interpreted as two different estimates of the error variance of the estimated equation, both of which are consistent. Sargan s statistics can be calculated via steps 1)-3) 11

This procedure will not produce a result if either the robust or cluster options are employed in the preceding IV. The test for overidentifying restrictions that is robust to heteroskedasticity in the errors is Hansen's J statistic 8 that can be obtained via ivreg2 or xtabond2, two procedures that will be deeply shown in the lectures on panel data. Here, we just illustrate main points with an example.. g r2=r^2. ivreg q (p=r r2) Instrumental variables (2SLS) regression Source SS df MS Number of obs = 20 -------------+------------------------------ F( 1, 18) = 3.67 Model -173.876111 1-173.876111 Prob > F = 0.0713 Residual 441.990275 18 24.5550153 R-squared =. -------------+------------------------------ Adj R-squared =. Total 268.114164 19 14.1112718 Root MSE = 4.9553 p.5764313.3007852 1.92 0.071 -.0554949 1.208358 _cons 43.24409 30.10465 1.44 0.168-20.00342 106.4916 Instrumented: p Instruments: r r2. overid Tests of overidentifying restrictions: Sargan N*R-sq test 3.770 Chi-sq(1) P-value = 0.0522 Basmann test 3.949 Chi-sq(1) P-value = 0.0469. ivreg2 q (p=r r2), small 9 Instrumental variables (2SLS) regression ---------------------------------------- Number of obs = 20 F( 1, 18) = 3.67 Prob > F = 0.0713 Total (centered) SS = 268.1141644 Centered R2 = -0.6485 Total (uncentered) SS = 203877.0488 Uncentered R2 = 0.9978 Residual SS = 441.9902752 Root MSE = 4.955 p.5764313.3007852 1.92 0.071 -.0554949 1.208358 _cons 43.24409 30.10465 1.44 0.168-20.00342 106.4916 previously illustrated (see R. Davidson and J. G. MacKinnon (1993), Estimation and Inference in Econometrics, Oxford University Press, 232-37). 8 Hansen L. P. (1982) Large Sample Properties of Generalised Method of Moments Estimators, Econometrica, 50, 1029-54. Davidson-MacKinnon do not call it the J statistic, because of the name of their non-nested models test (R. Davidson and J. G. MacKinnon (1981), Several tests for model specification in the presence of alternative hypotheses, Econometrica, 49, 781-93). 9 The option small performs small sample corrections: Root MSE is computed as sqrt(rss/(n-k)) [while sqrt(rss/n) is the default]; if robust is chosen, the finite sample adjustment to the robust variance-covariance matrix is N/(N-K) [while 1 is the default]; if cluster is chosen, the finite sample adjustment is (N-1)/(N-K) N c /(N c -1), where N c is the number of clusters [while 1 is the default]. Note that the Sargan statistic uses error variance = RSS/N, i.e., there is no small sample correction. 12

Anderson canon. corr. LR statistic (identification/iv relevance test): 10.443 Chi-sq(2) P-val = 0.0054 Sargan statistic (overidentification test of all instruments): 3.770 Chi-sq(1) P-val = 0.0522 Instrumented: p Excluded instruments: r r2. ivreg q (p=r r2), robust Instrumental variables (2SLS) regression Number of obs = 20 F( 1, 18) = 6.89 Prob > F = 0.0172 R-squared =. Root MSE = 4.9553 Robust p.5764313.2195992 2.62 0.017.1150705 1.037792 _cons 43.24409 22.51143 1.92 0.071-4.050664 90.53884 Instrumented: p Instruments: r r2. overid Test not valid with robust covariance matrix: use ivreg2 r(198);. ivreg2 q (p=r r2), small robust IV (2SLS) regression with robust standard errors ------------------------------------------------ Number of obs = 20 F( 1, 18) = 6.89 Prob > F = 0.0172 Total (centered) SS = 268.1141644 Centered R2 = -0.6485 Total (uncentered) SS = 203877.0488 Uncentered R2 = 0.9978 Residual SS = 441.9902752 Root MSE = 4.955 Robust p.5764313.2195992 2.62 0.017.1150705 1.037792 _cons 43.24409 22.51143 1.92 0.071-4.050664 90.53884 Anderson canon. corr. LR statistic (identification/iv relevance test): 10.443 Chi-sq(2) P-val = 0.0054 Hansen J statistic (overidentification test of all instruments): 3.637 Chi-sq(1) P-val = 0.0565 Instrumented: p Excluded instruments: r r2 3. Hidden endogeneity With this example, we show how the estimation results (and the related quantitative findings) may be misleading when we refer to only one estimation approach, without comparing the robustness of what discovered in the light of only one regression. 13

. use orange, clear. descr Contains data obs: 45 vars: 7 5 Nov 2003 16:25 size: 1,260 (96.3% of memory free) - storage display value variable name type format label variable label - anno int %8.0g rev float %9.0g REV inc int %8.0g INC qty float %9.0g QTY curadv float %9.0g CURADV aveadv float %9.0g AVEADV cpi float %9.0g CPI - Nerlove-Waugh (1961) discovered a number of problems of a previous paper results that were supportive of the link between oranges sales and their advertising expenses in the USA. The databank includes: rev orange sales at constant prices, in dollars; inc consumers income, in dollars; qty orange sales in quantity; curadv current advertising expenses at constant prices; aveadv average advertising expenditure over the previous 10 years at constant prices; cpi consumer price index; Transformation in logarithms:. g lrev=ln(rev). g linc=ln(inc). g lqty=ln(qty). g lcuradv=ln(curadv). g laveadv=ln(aveadv). g lcpi=ln(cpi) NOTE: rev = qty pri, where pri is the oranges price. Therefore, we can obtain orange price as:. g lpri=lrev-lqty OLS estimate. reg lrev lqty linc lcuradv laveadv Source SS df MS Number of obs = 45 -------------+------------------------------ F( 4, 40) = 26.24 Model 3.43705189 4.859262973 Prob > F = 0.0000 Residual 1.30996101 40.032749025 R-squared = 0.7240 -------------+------------------------------ Adj R-squared = 0.6964 Total 4.7470129 44.107886657 Root MSE =.18097 lrev Coef. Std. Err. t P> t [95% Conf. Interval] lqty -.3898872.1881797-2.07 0.045 -.7702126 -.0095618 linc.9236468.1911266 4.83 0.000.5373655 1.309928 lcuradv.2332817.1249652 1.87 0.069 -.0192824.4858458 laveadv.103318.0449602 2.30 0.027.01245.194186 _cons -6.766265 1.450754-4.66 0.000-9.698347-3.834182 14

. est store OLS The demand equation we just estimated, might hide an endogeneity problem of lqty regressor, while this problem could not affect any other explanatory variable of the model. In fact, the dependent variable is by definition: lrev = lqty + lpri. If we solve and normalise the previous relationship for the quantity of orange sales lqty we have: lqty + lpri + 0.38 lqty = 0.92 linc +... 1.38 lqty = -lpri + 0.92 linc +... lqty = (-1/1.38) lpri + (0.92/1.38) linc +... The signs of the parameter estimates of the demand equation are those predicted by the economic theory: the price effect is negative, the consumers income effect is positive. In this context, advertising has a significantly positive effect on the orange real demand. However, if we instrument potentially endogenous orange prices (hidden in lqty) with the USA overall consumer price index, lcpi, estimation results change dramatically, and the Hausman test clearly rejects the null of lqty weakly exogenous. IV estimate. ivreg lrev (lqty=lcpi) linc lcuradv laveadv Instrumental variables (2SLS) regression Source SS df MS Number of obs = 45 -------------+------------------------------ F( 4, 40) = 7.69 Model.238632088 4.059658022 Prob > F = 0.0001 Residual 4.50838081 40.11270952 R-squared = 0.0503 -------------+------------------------------ Adj R-squared = -0.0447 Total 4.7470129 44.107886657 Root MSE =.33572 lrev Coef. Std. Err. t P> t [95% Conf. Interval] lqty 1.469806 1.19665 1.23 0.227 -.9487129 3.888326 linc -.4242562.9021958-0.47 0.641-2.247662 1.399149 lcuradv -.7766276.6633999-1.17 0.249-2.117409.5641536 laveadv.1577731.0898902 1.76 0.087 -.0239019.339448 _cons 4.297227 7.321893 0.59 0.561-10.50087 19.09532 Instrumented: lqty Instruments: linc lcuradv laveadv lcpi. est store IV. ivendog Tests of endogeneity of: lqty H0: Regressor is exogenous Wu-Hausman F test: 11.46150 F(1,39) P-value = 0.00163 Durbin-Wu-Hausman chi-sq test: 10.22101 Chi-sq(1) P-value = 0.00139. hausman IV OLS, sigmamore Note: the rank of the differenced variance matrix (1) does not equal the number of coefficients being tested (4); be sure this is what you expect, or there may be problems computing the test. Examine the output of your estimators for anything unexpected and possibly consider scaling your variables so that the coefficients are on a similar scale. ---- Coefficients ---- (b) (B) (b-b) sqrt(diag(v_b-v_b)) IV OLS Difference S.E. 15

lqty 1.469806 -.3898872 1.859694.6169794 linc -.4242562.9236468-1.347903.4471858 lcuradv -.7766276.2332817-1.009909.3350516 laveadv.1577731.103318.0544551.0180662 b = consistent under Ho and Ha; obtained from ivreg B = inconsistent under Ha, efficient under Ho; obtained from regress Test: Ho: difference in coefficients not systematic chi2(1) = (b-b)'[(v_b-v_b)^(-1)](b-b) = 9.09 Prob>chi2 = 0.0026 (V_b-V_B is not positive definite) Note how, without the sigmamore option, the Hausman s test is quite misleading:. hausman IV OLS ---- Coefficients ---- (b) (B) (b-b) sqrt(diag(v_b-v_b)) IV OLS Difference S.E. lqty 1.469806 -.3898872 1.859694 1.181761 linc -.4242562.9236468-1.347903.8817187 lcuradv -.7766276.2332817-1.009909.6515237 laveadv.1577731.103318.0544551.0778385 b = consistent under Ho and Ha; obtained from ivreg B = inconsistent under Ha, efficient under Ho; obtained from regress Test: Ho: difference in coefficients not systematic chi2(4) = (b-b)'[(v_b-v_b)^(-1)](b-b) = 2.48 Prob>chi2 = 0.6489 In the latter case, the following option prevents degrees of freedom problems:. hausman IV OLS, df(1) ------------- ---------------------------------------------------------------- ---- Coefficients ---- (b) (B) (b-b) sqrt(diag(v_b-v_b)) IV OLS Difference S.E. lqty 1.469806 -.3898872 1.859694 1.181761 linc -.4242562.9236468-1.347903.8817187 lcuradv -.7766276.2332817-1.009909.6515237 laveadv.1577731.103318.0544551.0778385 b = consistent under Ho and Ha; obtained from ivreg B = inconsistent under Ha, efficient under Ho; obtained from regress Test: Ho: difference in coefficients not systematic chi2(1) = (b-b)'[(v_b-v_b)^(-1)](b-b) = 2.48 Prob>chi2 = 0.1156 The df(#) option specifies the degrees of freedom to be used in the Hausman s test. The default is the matrix rank of the variance of the difference between the coefficients of the two estimators. 16

With IV for endogenous orange prices, the demand relationship has profoundly change in meaning: the advertising-supporting OLS results where based on big statistical problems. However, note that the IV results heavily rely on the specific instrument we used and on the exogeneity hypothesis of all the other explanatory variables. Summarising the findings of this lecture, we note the following relevant point. The choice between IV-2SLS and OLS-GLS must be based on the reliability of the exogeneity assumption for all the model s explanatory variables, and not on the estimation outcome; in doing so, the Hausman test may be of some help. The first example is constructive: it shows that the inappropriate use of OLS leads to the rejection of the existence of a demand equation, while IV supports such relationship. Viceversa, the second case is quite destructive since it shows that OLS would give quite reasonable estimation results that, however, are completely reversed by the use of IV. In other terms, the reasonableness (failure) of the estimation results cannot per se give support (cast doubts) to the estimation method used. Statistical testing (Hausman) and economic reasoning are the right ways to make the estimator choice. 17