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 ——————————
Alternatively to this procedure: local polynomial estimation (–lpoly–)
However, it should be used carefully, e.g. in the case of corner solutions or discrete data
Watch out, the HTML formatting might change some of the symbols. If the above does not work, let me know, and I will send you the do-file.