Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: spline regression


From   David Airey <david.airey@vanderbilt.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: spline regression
Date   Fri, 7 Mar 2008 21:41:05 -0600

.

I don't see where yhat1 and yhat2 are created in your example here.

-Dave


*--------------------- begin example ------------------------
sysuse nlsw88, clear
gen ln_w = ln(wage)
gen black = race == 2 if race < .

mkspline  ten1 10 ten2 = tenure
reg ln_w ten1 ten2 union age black collgrad

mkspline tens=tenure, cubic nk(3)
reg ln_w tens* union age black collgrad

preserve
sum age if e(sample)
replace age = r(mean)
replace union = 1
replace black = 0
replace collgrad = 1
predict yhat

bys tenure: gen byte mark = _n== 1
twoway line yhat1 yhat2 tenure if mark, sort
restore
*-------------------- end example -----------------------------
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index