Hi All,

I have data that resembles the following:


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(year y x z)
1989 234 324 342
1989 324  32 324
1989  32   4  24
1989 324   3   3
1989  32   2   2
1989 234   2   4
1989  32 345   2
1989 324  32   3
1989 324  23   .
1990 324   2  32
1990 324   4   5
1990   3  23  43
1990   4   5   3
1990   3  32  32
1990  32 324   6
1990   2   5  32
1990   3  32   2
1990   2  23   4
end

Here, I have information by year on dependent variable y, endogenous regressor x and instrument z. I am computing year-on-year regression coefficients, using the following code:


Code:
gen beta=.
levelsof year, local(year)
foreach i of local year {
ivregress 2sls y (x = z) if year == `i'  
gen temp2=_b[InteractionActual]
replace beta=temp2 if  year == `i'
drop temp2
}
However, I also wish to test the equality of the 2SLS coefficients with the OLS coefficients each year, by considering a Hausmann type test for each year, and then storing the p value (or the chi-2 vaulue) for that year. Any help on this is much appreciated.



Best,
CS