Hi All,

My dataset resembles the following:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(year y x lagx lag2x lag3x)
1999 2  1  . . .
2000 3  2  1 . .
2001 2  1  2 1 .
2002 3  3  1 2 1
2003 3  2  3 1 2
2004 2 43  2 3 1
2005 1  1 43 2 3
end
In this table, I have a variable y, and x along with 3 lags, defined over the time variable, year. What I wish to do, is to run 3 regressions, all the while storing the estimates: i) y on x and its first lag, ii) y on x and its first and second lag, and iii) y on x, its first, second and third lag. Thereafter, I would like to produce this as a latex file (using the esttab command), but at the bottom of each column corresponding to the different regression, I wish to run a joint F-test of the sum of each of the coefficients that appear in that regression equalling 0. So, in principle, I wish to do something like this:

Code:
****First Regresion***
eststo: reg y x lagx
esttab using "table1.tex", scalar(F)  varwidth(25) keep(x lagx lag2x)  star(+ 0.15 * 0.10 ** 0.05 *** 0.01) p  label replace   

lincomest x+lagx
esttab using table1.tex, append coeflabel((1) "beta1+beta2=0") ///
f collabels(none) gaps plain nomtitles ///
refcat((1) "\textit{Joint Hypothesis Tests}", nolabel) starlevel(* 0.10 ** 0.05 *** 0.01) ///
cells( b(star fmt(3)) se(par fmt(3)) ) ///
noobs


***Second Regression***

eststo: reg y x lagx lag2x
esttab using "table1.tex", scalar(F)  varwidth(25) keep(x lagx lag2x)  star(+ 0.15 * 0.10 ** 0.05 *** 0.01) p  label append
lincomest x+lagx+lag2x
esttab using table1.tex, append coeflabel((1) "beta1+beta2+beta3=0") ///
f collabels(none) gaps plain nomtitles ///
refcat((1) "\textit{Joint Hypothesis Tests}", nolabel) starlevel(* 0.10 ** 0.05 *** 0.01) ///
cells( b(star fmt(3)) se(par fmt(3)) ) ///
noobs

***Third Regression***

eststo: reg y x lagx lag2x lag3x
esttab using "table1.tex", scalar(F)  varwidth(25) keep(x lagx lag2x)  star(+ 0.15 * 0.10 ** 0.05 *** 0.01) p  label append
lincomest x+lagx+lag2x+lag3x
esttab using table1.tex, append coeflabel((1) "beta1+beta2+beta3+beta4=0") ///
f collabels(none) gaps plain nomtitles ///
refcat((1) "\textit{Joint Hypothesis Tests}", nolabel) starlevel(* 0.10 ** 0.05 *** 0.01) ///
cells( b(star fmt(3)) se(par fmt(3)) ) ///
noobs
Something seem to be amiss here, as I am not getting the desired output. Any help on this is much appreciated.