Age regressions

The following do-file can be used to plot age regressions that do not assume any functional form. It uses dummies for each year of age. Note though, that you need a dataset that has sufficient observations to estimate it.

---------------  begin do file ------------------------------
* reg_age.do
* regression with age dummies
* inspired by Lex Borghans
*
* Ben Kriechel
* v. 0.1
* 2007.01.23
*
* requires: `1' ==> y
*  variable y ==> wage
*   variable age ==> age in years

capture drop _Iage*

/* I leave out age 35 */
char _dta[omit] “_Iage_35”

capture drop y
gen y=`1′
xi: regress y i.age

capture drop b low high aage
gen b=.
gen low=.
gen high=.
gen aage=_n if _n>=15 & _n<=100

forvalues y=15/100 {
 capture replace  b  = _b[_Iage_`y’]    if _n==`y’
 capture replace  low  = _b[_Iage_`y’]-1.96*_se[_Iage_`y’] if _n==`y’
 capture replace  high  = _b[_Iage_`y’]+1.96*_se[_Iage_`y’] if _n==`y’ 
   }
line low b high aage if aage<.
exit

—————  end do file ——————————

2 thoughts on “Age regressions

Leave a Reply