Programming the statistical procedures from SAS

2SLS

Reply
Contributor mei
Contributor
Posts: 62

2SLS

Hi I m writing a sas code for 2SLS test for endogeneity, and would like you to verify the correctness.

original model :

Y = b0+ b1 X1 + b2 X2 + b3 X3 + b4 X4 + e

X1 - independent variable

Y- dependent variable

X1 affect Y and it is estimated that Y also affect X1 (from theory).

X2, X3 and X4 are control variable.

Instrument variable Z1 and X1_lag1. (not sure how to select)

Codes wrote:

ods graphics on;

title 'test1-2SLS';

proc model data=testE2;

Y = b0+b1*X1;

fit Y/IT2SLS;

Instruments Z1 X1_lag1;

run;

quit;

ods graphics off;

title;

Question:

1) do i have to include the control variables, X2, X3 and X4 into the equation Y = b0+b1*X1 ?

2) how do i test wht Z1 and X1_lag1 is good instrument.

but the proc correlation test shows that Z1 also correlated with Y -

should we also test whether Z1 is not related to e in the original model:

Y = b0+ b1 X1 + b2 X2 + b3 X3 + b4 X4 + e

3) I used hausman test to test endogeneity

Hausman

ods graphics on;

title 'test1-hausman test-to obtain residuals by OLS';

proc reg data=testE2;

model X = X1_lag1 Z1  /spec white acov vif;

output out=res R=X_residual;

run;

ods graphics off;

title;

ods graphics on;

title 'test1-regression of the originial with residuals';

proc reg data=res;

model Y = X X_residual /spec white acov vif;

run;

ods graphics off;

title;

The result show that coefficient for X_residual is significant, rejecting the null hypothesis of no endogeneity, and conclude that X is endogenoues to Y.

I am not sure whether the interpretation and the test is done correctly?

Thanks

I attach the data

Ask a Question
Discussion stats
  • 0 replies
  • 580 views
  • 0 likes
  • 1 in conversation